Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
Create a free account

Macro for Token Generation/Editing

Hey! I am working on a way to generate generic humanoid monsters with randomized traits as quickly as possible on the fly. I currently use the MonsterHitDice API to generate HP values when I drag out a character sheet, which is great except I have to make separate character sheet for each monster and their hit dice (Humanoid L1 with 1d6HD, Humanoid L2 with 2d6HD, ect.).  I currently have Rollable Tables for numbered generic monster tokens. I am imagining a way to create a macro that will do the following things: 1. Create a monster token from the Rollable Table 2. Fill the token bubbles using queries that ask for HP (with maximum to create a health bar), AC, etc. (or automatically roll for them on a Rollable Table) 3. Fill the token Name field with a random attribute from a Rollable Table (blade scar, missing finger, ect.). If creating the token as part of the macro isn't plausible (item 1), is there a way to edit an existing token with items 2 and 3? Are these ideas a pipedream? I would greatly appreciate help and advice in this matter! Gratefully, Ragnar
Forum Champion
Hi Ragnar,  Macros cannot do this as they cannot make alterations to anything. However, an Mod (API Script) probably can. I would suggest posting in the Mods (API Scripts) forum asking for scripts which might be suitable to do this.

Edited 1700432985
I looked into randomly creating an NPC about a year ago with a custom API/Mod Script.  I didn't really like how limiting it would be, even if I programmed every little thing and came to realize that in most cases, the NPCs I was creating on the fly were non-combat types.  That's when I discovered LLMs like ChatGPT.  The new ability to create GPTs, means I can take my master prompt and create a kind of dedicated Chatbot for creating NPCs.   I've spent some time perfecting my NPC Generation prompt that builds a semi-random NPC for me on the fly, puts it in Markdown format and generates a portrait, I can quickly upload to Roll20.   You can easily copy the text and place it in a handout or your favorite campaign tracking tool (Onenote, Evernote, LegendKeeper, ...).   Once it's generated, if I need additional detail like Stat Blocks, Spell List, Quotes they might use, Quirks, Secrets, or Rumors, I just ask ChatGPT for that additional info.   Here is an example prompt:    Generate an NPC based on a Crazy Human Wizard who is drunk on his own potions. Response: Here is the NPC you requested: A crazy human wizard, infused with the unpredictable effects of his own potions. He is a male with wild, unkempt gray hair and wide, unpredictable eyes that gleam with both excitement and a touch of confusion. His robes are a colorful, chaotic tapestry, stained with the remnants of various potion spills. In one hand, he holds a bubbling, glowing potion, and in the other, a crooked staff inscribed with mysterious runes. The background depicts his cluttered wizard's laboratory, brimming with books, bottles, and mystical artifacts, all bathed in a dim, magical glow emanating from the potion and other enchanted objects. --- **Name:** Alaric the Unpredictable **Race:** Human **Class:** Wizard **Alignment:** Chaotic Neutral **Appearance:** - **Hair:** Wild, unkempt gray - **Eyes:** Wide and unpredictable - **Robes:** Vibrantly colored, potion-stained - **Accessories:** Crooked, rune-inscribed staff; glowing potion **Personality:** - Eccentric and wildly imaginative - Prone to mood swings and unpredictable behavior - Fascinated by the effects and potential of potions **Abilities:** - Expert in potion making, with unexpected results - Skilled in various arcane arts - Unpredictable magic due to potion influence **Backstory:** Alaric was once a disciplined and respected wizard, known for his meticulous research in alchemy and the arcane. However, after an accident involving a potent experimental potion, his mind became as chaotic as his lab. Now, he pursues his potion-making with reckless abandon, often testing the limits of magical and alchemical boundaries, much to the concern (and sometimes amusement) of those around him. **Hook for Adventure:** Alaric could accidentally create a potion with unforeseen effects, leading to an urgent quest to find a rare ingredient to reverse its effects or to contain the chaos it unleashes.
Thanks for your responses, guys! Gauss, that is great advice – thank you!  Will M, I like the idea of using AI to generate NPC's, although I already have a pretty good system for it, and creating compelling NPC's are one of my few strengths as a GM!