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

OGL 2.1 NPC Spellbook help

Hey guys, I had this working but now that there are new variables to call I am rewriting it. The only problem is that I don't code for a living and once I stopped using it I forgot a lot of it. This is what I am currently using, I think I know what to swap out for the repeating spells, but what do I change to get the name for the button? /w gm &{template:default}{{name=@{selected|character_name} Spellcasting}}{{Spell Save DC @{selected|npc_spelldc}= @{selected|npc_spellattackmod} to hit with spell attacks}}{{Cantrips=[@{repeating_spell-npc_$0_spellname}](~selected|repeating_spell-npc_$0_spell)[@{repeating_spell-npc_$1_spellname}](~selected|repeating_spell-npc_$1_spell)[@{repeating_spell-npc_$2_spellname}](~selected|repeating_spell-npc_$2_spell)[@{repeating_spell-npc_$3_spellname}](~selected|repeating_spell-npc_$3_spell)}}{{1st level (4 slots)=[@{repeating_spell-npc_$4_spellname}](~selected|repeating_spell-npc_$4_spell) [@{repeating_spell-npc_$5_spellname}](~selected|repeating_spell-npc_$5_spell)[@{repeating_spell-npc_$6_spellname}](~selected|repeating_spell-npc_$6_spell)[@{repeating_spell-npc_$7_spellname}](~selected|repeating_spell-npc_$7_spell)}}
So the main thing that changed from v1.6 to v2.1 is NPC spells now follow the same naming structure of PC spells. This means that each spell is stored within a list specific to the level of the spell. So to fix the macro, you will need to replace every instance of repeating_spell-npc with repeating_spell-LEVEL (where LEVEL is the level of the spell, for example repeating_spell-cantrip or repeating_spell-1). Aside from this, the macro should work as intended.
Thanks Kyle, will this create the button without having to use repeating_spell-cantrip_spellname?
No, you need to keep the _spellname as that is where is label for the button comes from. You could hardcode the label instead of referencing the spell's attributes but you lose the dynamic ability of the button to react to changes to the spell.
Ok so the issue I am now having is that I can't find the new variable for "spellname"  here is what I get, and this is the code. I'm sure "@repeating_spell-npc_$0_spellname" is wrong but, changing it to "@repeating_spell-cantrip_$0_spellname" does not work. /w gm &{template:default}{{name=@{selected|character_name} Spellcasting}}{{Spell Save DC =@{selected|spell_save_dc} }}{{To Hit =@{selected|spell_attack_bonus}}}{{Cantrips=[@{repeating_spell-npc_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell)[@{repeating_spell-npc_$1_spellname}](~selected|repeating_spell-cantrip_$1_spell)[@{repeating_spell-npc_$2_spellname}](~selected|repeating_spell-cantrip_$2_spell)[@{repeating_spell-npc_$3_spellname}](~selected|repeating_spell-cantrip_$3_spell)}}

Edited 1508503706
You need to change repeating_spell-npc_$X_spellname to repeating_spell-LEVEL_$X_spellname same as how you are directly referencing the roll information.

Edited 1508519206
Use a text editor with find and replace feature and find -npc and replace -1 for level 1, 2 for 2 ect. Should look like [@{selected|repeating_spell-4_$0_spellname}] when done. My macro [@{selected|repeating_spell-cantrip_$0_spellname}](!
#Cantrip0) [@{selected|repeating_spell-1_$0_spellname}](!
#Spell1-0) [@{selected|repeating_spell-1_$1_spellname}](!
#Spell1-1) [@{selected|repeating_spell-1_$2_spellname}](!
That did it, thank you both!