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

Easy cut-and-paste NPC spellcasting macro?

I've been trying and trying to get an NPC spellcasting macro to work.  I've searched around extensively (but perhaps just not in the right places?), and all I can find is one that apparently worked before the Roll20 software was updated.  Anything newer than that just says "Use the old macro, but make these modfications."  I've tried doing that, but it still doesn't seem to work for me. Pretty please, could someone kindly post a working version of an NPC spell macro that I (and similar macro newbies) could just cut and paste?
1560271508
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hi Juliet, This should be doable, but can you provide a little more context? There are hundreds (maybe thousands) of RPG systems being played on Roll20, and several of those systems have multiple character sheets available to use; what system and character sheet are you using? What are your goals for this spellcasting macro? Can you link to the old macro and/or some of the posts about updating it? -Scott
1560352250

Edited 1560352310
Scott, Ah yes, silly me!&nbsp; I meant for D&amp;D 5E.&nbsp; And here's a link to the thread with the macro I was trying to use, as well as the solution that I couldn't get to work: <a href="https://app.roll20.net/forum/post/5583618/5e-ogl-spellcasting-npc-macro-help" rel="nofollow">https://app.roll20.net/forum/post/5583618/5e-ogl-spellcasting-npc-macro-help</a>
Bumping just to see if anyone has the information.
1561734046
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Try this: For the first cantrip %{selected|repeating_spell-cantrip_$0_spell} For the first first level spell: %{selected|repeating_spell-1_$0_spell} For the second first level spell: %{selected|repeating_spell-1_$1_spell} For the first second level spell %{selected|repeating_spell-2_$0_spell} Hopefully the pattern is apparent: Spell-[level number or "cantrip"], and then $[number of spell, starting at 0 for first]
keithcurtis said: Try this: Thank you--that's much closer to working than anything else I've tried so far, since it at least gives me results.&nbsp; But when the drop-down box comes up asking me what level spell I want to cast, it ignores cantrips.&nbsp; Is that normal?
1562429620
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Cantrips are always cast by character level. This is not scalable by the rules as written, though you could always house rule that away and hover over any dice results to take the first roll, and ignore what you don't want to use.
1562431843

Edited 1562432181
That makes sense, but--and I apologize for being unbearably thick about this, but it's why I have to ask for the simple cut-and-paste macro in the first place--why am I entering macro lines for the cantrips when clicking the macro button doesn't give me the option of casting a cantrip in the first place?&nbsp; Am I still doing something wrong? Here is exactly what I have entered for a fourth-level caster NPC: &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-cantrip_$0_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-cantrip_$1_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-cantrip_$2_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-1_$0_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-1_$1_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-1_$2_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-1_$3_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-2_$0_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-2_$1_spell} &nbsp;&nbsp;&nbsp;&nbsp;%{selected|repeating_spell-2_$2_spell} When I click the button to activate this macro, the first thing I get is a box asking me what level I want to cast at, with no option to select a cantrip from that list.&nbsp; What am I missing?
1562449093

Edited 1562449313
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
To begin with, that macro will cast all spells at once. That's why it is asking for level: it has to resolve all spells. To make a menu of spells to cast is a bit more involved. Here is my suggested syntax. This will handle all cantrips, I'm assuming you can flesh it out from there: &amp;{template:npcaction} {{rname=Spells}} {{description=[@{selected|repeating_spell-cantrip_$0_spellname}](!&amp;#13;&amp;#37;{selected|repeating_spell-cantrip_$0_spell}) [@{selected|repeating_spell-cantrip_$1_spellname}](!&amp;#13;&amp;#37;{selected|repeating_spell-cantrip_$1_spell}) [@{selected|repeating_spell-cantrip_$2_spellname}](!&amp;#13;&amp;#37;{selected|repeating_spell-cantrip_$2_spell})}} It's in a Roll template to make it easier to view.&nbsp; !&amp;#13;&amp;#37;{selected|repeating_spell-cantrip_$1_spell} &nbsp;is the syntax for each button. The html replacements after the exclamation point are there to make the ability resolve properly. Save this as an ability on a character sheet, not a macro. Otherwise you will lose the replacements every time you go to edit. This will produce a chat menu of spell Ability Control Buttons. If you want to make this global, put it on a macro sheet, and call it from a global macro set as a universal token macro: %(macro_sheet_name|name_of_spell_ability}. It wouldn't recommend this though, because it will throw up error messages if the number of spells on the sheet don't match the macro. For a one-size-fits-all universal macro will require the API. Scripts like Universal Chat Menus or Menu Maker would do the job. I and others have even posted samples to do the whole sheet.