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

Help With Saves macro

Hello this is a macro that i found that is supposed to go on an individual npcs abilities page as a macro for a specific npc. I am hoping to modify it so i can make it a regular macro in the macros section set as a token action. I was able to do this with several others in the same format but i keep getting this error when i try this one for some reason. "TypeError: Cannot read property 'substring' of undefined".  Any help would be much appreciated :) /w gm &{template:default} {{name=Saving Throws}} {{Str Save= [[1d20+@{npcd_str_mod}]] | [[1d20+@{npcd_str_mod}]]}} {{Dex Save= [[1d20+@{npcd_dex_mod}]] | [[1d20+@{npcd_dex_mod}]]}} {{Con Save= [[1d20+@{npcd_con_mod}]] | [[1d20+@{npcd_con_mod}]]}} {{Int Save= [[1d20+@{npcd_int_mod}]] | [[1d20+@{npcd_int_mod}]]}} {{Wis Save= [[1d20+@{npcd_wis_mod}]] | [[1d20+@{npcd_wis_mod}]]}} {{Cha Save= [[1d20+@{npcd_cha_mod}]] | [[1d20+@{npcd_cha_mod}]]}}
Try this one: /w gm &{template:default} {{name=Saving Throws }} {{Str Save= [[ 1d20 + 0@{selected|npcd_str_mod} ]] | [[ 1d20 + 0@{selected|npcd_str_mod} ]] }} {{Dex Save= [[ 1d20 + 0@{selected|npcd_dex_mod} ]] | [[ 1d20 + 0@{selected|npcd_dex_mod} ]] }} {{Con Save= [[ 1d20 + 0@{selected|npcd_con_mod} ]] | [[ 1d20 + 0@{selected|npcd_con_mod} ]] }} {{Int Save= [[ 1d20 + 0@{selected|npcd_int_mod} ]] | [[ 1d20 + 0@{selected|npcd_int_mod} ]] }} {{Wis Save= [[ 1d20 + 0@{selected|npcd_wis_mod} ]] | [[ 1d20 + 0@{selected|npcd_wis_mod} ]] }} {{Cha Save= [[ 1d20 + 0@{selected|npcd_cha_mod} ]] | [[ 1d20 + 0@{selected|npcd_cha_mod} ]] }}
Yep. Silvyre nailed it. You need the "selected|" key identifier in the attribute call so that it knows which token's sheet to pull the values from.
Keep in mind that this macro doesn't necessarily do the saving throws for the npc. Each of the attributes used are for the base stat, not for its saving throw bonus. For the most part this is not a problem because the saving throw (for example @{selected|npcd_str_save}) is typically blank, but there are times where the npc will be proficient with a saving throw and you will either have to remember that yourself for the roll, or make a more complicated macro to use the ability modifier when the saving throw modifier is empty.
Thanks for pointing that out, Kyle G. Here's a "more complicated macro" (adapted from here ): /w gm &{template:default} {{name=Saving Throws }} {{Str Save= [[ 1d20 + [[@{selected|npcd_str_mod} * {1@{selected|npc_str_save}0, 0}=10 + 0@{selected|npc_str_save}]] ]] | [[ 1d20 + [[@{selected|npcd_str_mod} * {1@{selected|npc_str_save}0, 0}=10 + 0@{selected|npc_str_save}]] ]] }} {{Dex Save= [[ 1d20 + [[@{selected|npcd_dex_mod} * {1@{selected|npc_dex_save}0, 0}=10 + 0@{selected|npc_dex_save}]] ]] | [[ 1d20 + [[@{selected|npcd_dex_mod} * {1@{selected|npc_dex_save}0, 0}=10 + 0@{selected|npc_dex_save}]] ]] }} {{Con Save= [[ 1d20 + [[@{selected|npcd_con_mod} * {1@{selected|npc_con_save}0, 0}=10 + 0@{selected|npc_con_save}]] ]] | [[ 1d20 + [[@{selected|npcd_con_mod} * {1@{selected|npc_con_save}0, 0}=10 + 0@{selected|npc_con_save}]] ]] }} {{Int Save= [[ 1d20 + [[@{selected|npcd_int_mod} * {1@{selected|npc_int_save}0, 0}=10 + 0@{selected|npc_int_save}]] ]] | [[ 1d20 + [[@{selected|npcd_int_mod} * {1@{selected|npc_int_save}0, 0}=10 + 0@{selected|npc_int_save}]] ]] }} {{Wis Save= [[ 1d20 + [[@{selected|npcd_wis_mod} * {1@{selected|npc_wis_save}0, 0}=10 + 0@{selected|npc_wis_save}]] ]] | [[ 1d20 + [[@{selected|npcd_wis_mod} * {1@{selected|npc_wis_save}0, 0}=10 + 0@{selected|npc_wis_save}]] ]] }} {{Cha Save= [[ 1d20 + [[@{selected|npcd_cha_mod} * {1@{selected|npc_cha_save}0, 0}=10 + 0@{selected|npc_cha_save}]] ]] | [[ 1d20 + [[@{selected|npcd_cha_mod} * {1@{selected|npc_cha_save}0, 0}=10 + 0@{selected|npc_cha_save}]] ]] }}
sweet thank you everyone for the help. I was so tired and getting frustrated last night trying to get it to work. Roll20 has the best community :)