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

D&D 5E Generic Saving Throw Macro Help

1689607072

Edited 1689607248
Made this macro for 'D&D 5E by Roll20' character sheets because I was sick of having to go into the character sheets for NPCs when doing Saving Throws I mostly have it doing what I want the only difficulty I'm having is that I would like the rname to also show what type of save is being made. when clicked the Macro prompts with a drop down for what type of save it is: It then reads the character sheet associated with the currently selected token to apply the appropriate save bonus. Ideally it would show the type of Saving Throw in the rname for clarity and would have the option to determine advantage/disadvantage from the associated character sheet but I wasn't sure how to do that. Macro: &{template:simple} {{rname=Saving Throw}} {{advantage=1}} {{r1=[[d20+?{Modifier|Strength,@{selected|strength_save_bonus}|Dexterity,@{selected|dexterity_save_bonus},|Constitution,@{selected|constitution_save_bonus}|Intelligence,@{selected|intelligence_save_bonus},|Wisdom,@{selected|wisdom_save_bonus}|Charisma,@{selected|charisma_save_bonus}}]]}} {{r2=[[d20+?{Modifier|Strength,@{selected|strength_save_bonus}|Dexterity,@{selected|dexterity_save_bonus},|Constitution,@{selected|constitution_save_bonus}|Intelligence,@{selected|intelligence_save_bonus},|Wisdom,@{selected|wisdom_save_bonus}|Charisma,@{selected|charisma_save_bonus}}]]}} {{charname=@{selected|character_name} Mod: ?{Modifier}}}
I wanted to do something like the below but it doesn't seem to accept using ?{} inside of @{selected|} &{template:simple} {{rname=?{Save|Strength,strength|Dexterity,dexterity,|Constitution,constitution|Intelligence,intelligence,|Wisdom,wisdom|Charisma,charisma} Saving Throw}} {{advantage=1}} {{r1=[[d20+@{selected|?{Save}_save_bonus}]]}} {{r2=[[d20+@{selected|?{Save}_save_bonus}]]}} {{charname=@{selected|character_name} Mod: ?{Save}}}
1689608369

Edited 1689608545
Gauss
Forum Champion
Pulled from Token Action Maker:  @{wtype}&{template:npc} @{npc_name_flag} @{rtype}?{Saving Throw|Strength, +@{npc_STR_save}@{pbd_safe}[STR SAVE]]]}} {{rname=Strength Save}&#125 {{mod=@{Strength_save_bonus}}} {{r1=[[@{d20}+@{npc_STR_save}@{pbd_safe}[STR SAVE]]]|Dexterity, +@{npc_DEX_save}@{pbd_safe}[DEX SAVE]]]}} {{rname=Dexterity Save}&#125 {{mod=@{Dexterity_save_bonus}}} {{r1=[[@{d20}+@{npc_DEX_save}@{pbd_safe}[DEX SAVE]]]|Constitution, +@{npc_CON_save}@{pbd_safe}[CON SAVE]]]}} {{rname=Constitution Save}&#125 {{mod=@{Constitution_save_bonus}}} {{r1=[[@{d20}+@{npc_CON_save}@{pbd_safe}[CON SAVE]]]|Intelligence, +@{npc_INT_save}@{pbd_safe}[INT SAVE]]]}} {{rname=Intelligence Save}&#125 {{mod=@{Intelligence_save_bonus}}} {{r1=[[@{d20}+@{npc_INT_save}@{pbd_safe}[INT SAVE]]]|Wisdom, +@{npc_WIS_save}@{pbd_safe}[WIS SAVE]]]}} {{rname=Wisdom Save}&#125 {{mod=@{Wisdom_save_bonus}}} {{r1=[[@{d20}+@{npc_WIS_save}@{pbd_safe}[WIS SAVE]]]|Charisma, +@{npc_CHA_save}@{pbd_safe}[CHA SAVE]]]}} {{rname=Charisma Save}&#125 {{mod=@{Charisma_save_bonus}}} {{r1=[[@{d20}+@{npc_CHA_save}@{pbd_safe}[CHA SAVE]]]}}} {{global=@{global_save_mod}}} {{type=Save}} {{typec=Save}} @{charname_output} Note: this will follow whatever you have Advantage/Disadvantage set to. If you don't want to toggle Advantage/Disadvantage my suggestion is to set the tokens to query Adv/Disadv or to set "Always Roll Advantage" (this is really misnamed, it is just rolling 2d20, it doesn't actually roll Adv/Disadv) and ignore the second roll when appropriate.
@{wtype}&{template:npc} @{npc_name_flag} @{rtype}?{Saving Throw|Strength, +@{npc_STR_save}@{pbd_safe}[STR SAVE]]]}} {{rname=Strength Save}} {{mod=@{Strength_save_bonus}}} {{r1=[[@{d20}+@{npc_STR_save}@{pbd_safe}[STR SAVE]]]|Dexterity, +@{npc_DEX_save}@{pbd_safe}[DEX SAVE]]]}} {{rname=Dexterity Save}} {{mod=@{Dexterity_save_bonus}}} {{r1=[[@{d20}+@{npc_DEX_save}@{pbd_safe}[DEX SAVE]]]|Constitution, +@{npc_CON_save}@{pbd_safe}[CON SAVE]]]}} {{rname=Constitution Save}} {{mod=@{Constitution_save_bonus}}} {{r1=[[@{d20}+@{npc_CON_save}@{pbd_safe}[CON SAVE]]]|Intelligence, +@{npc_INT_save}@{pbd_safe}[INT SAVE]]]}} {{rname=Intelligence Save}} {{mod=@{Intelligence_save_bonus}}} {{r1=[[@{d20}+@{npc_INT_save}@{pbd_safe}[INT SAVE]]]|Wisdom, +@{npc_WIS_save}@{pbd_safe}[WIS SAVE]]]}} {{rname=Wisdom Save}} {{mod=@{Wisdom_save_bonus}}} {{r1=[[@{d20}+@{npc_WIS_save}@{pbd_safe}[WIS SAVE]]]|Charisma, +@{npc_CHA_save}@{pbd_safe}[CHA SAVE]]]}} {{rname=Charisma Save}} {{mod=@{Charisma_save_bonus}}} {{r1=[[@{d20}+@{npc_CHA_save}@{pbd_safe}[CHA SAVE]]]}}} {{global=@{global_save_mod}}} {{type=Save}} {{typec=Save}} @{charname_output} So that gives me ' TypeError: Cannot read properties of undefined (reading 'substring')' not seeing anything referencing substring so not sure why that would be happen
1689609452

Edited 1689609784
Gauss
Forum Champion
Where are you putting the macro?  By the looks of it, you put it in the Collection tab. The Collection tab should not be used for macros that include HTML substitution because it will revert the HTML substitution. Additionally, this macro is a per-character Ability macro. Ability macros auto-fill the character name (in most cases). You will need to tweak it to make it a universal NPC macro. Add "selected|" (without quotes) before attribute name in every attribute call. Example: "@{npc_name_flag}" becomes "@{selected|npc_name_flag}" Put it in a Macro Mule . Then call that macro via a Collection tab Macro. 
Liam F. said: Made this macro for 'D&D 5E by Roll20' character sheets because I was sick of having to go into the character sheets for NPCs when doing Saving Throws  If you are trying to avoid opening the character sheet, then you may be interested in a Universal Macro Mule approach. This will output chat menus with buttons for all savings throws, which function exactly the same as clicking from the character sheet itself.