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

Dynamic Initiative Macro

1646528233

Edited 1646529908
Zaron
Plus
This is for a D&D 5e game, using D&D 5e Character Sheets. Part I: I am a DM for a game with many players who have many Player Characters, so we have a lot of movements and changes between games.  To help with this, I created a macro in the Macro Quick Bar.  The goal is that any player could click any of their PC's tokens, click the macro, and it will roll initiative and add it to the turn order.  My understanding is super basic, but it worked with the following: "%{selected|npc_init}" This means that it's only using their basic Initiative bonus, i.e. their DEX.  I was hoping to get one that uses the attribute "initiative_style", so whatever their bonuses (whether it's a custom initiative, or they'll have Advantage/Disadvantage), all the macro has to look at is the "initiative_style", roll appropriately, and add it to the turn order.  Is this feasible?  Part II: I have a character who has a special exception.  Every time they roll initiative, they roll another 1d4 and add the result to their initiative roll.  What macros can handle this?  I can't even get the macro to "/r 1d20 + {selected|initiative_bonus}". Conclusion: How can one make a macro for initiative that is NOT rolled from their sheet?  I want the result you get from clicking "Initiative" on the character sheet, but as a MACRO.  And then hopefully, I can manipulate it to make a custom Macro for those with unusual bonuses. Thank you!
What game are you playing and which character sheet template are you using?
D&D 5e, with the standard D&D 5e sheet.  Now updating the original post with this important information :)
It looks like your version of the macro is using npc_init.  what happens when you use "%{selected|INITIATIVE}" ?
Zaron said: This is for a D&D 5e game, using D&D 5e Character Sheets. Part I: I am a DM for a game with many players who have many Player Characters, so we have a lot of movements and changes between games.  To help with this, I created a macro in the Macro Quick Bar.  The goal is that any player could click any of their PC's tokens, click the macro, and it will roll initiative and add it to the turn order.  My understanding is super basic, but it worked with the following: "%{selected|npc_init}" This means that it's only using their basic Initiative bonus, i.e. their DEX.  I was hoping to get one that uses the attribute "initiative_style", so whatever their bonuses (whether it's a custom initiative, or they'll have Advantage/Disadvantage), all the macro has to look at is the "initiative_style", roll appropriately, and add it to the turn order.  Is this feasible?  Try this: @{selected|wtype}&{template:simple} {{rname=INITIATIVE}} {{mod=$[[1.computed]]}} {{r1=[[@{selected|initiative_style}+@{selected|initiative_bonus}@{selected|pbd_safe}[INIT] &{tracker}]]}} {{normal=1}} @{selected|charname_output} Part II: I have a character who has a special exception.  Every time they roll initiative, they roll another 1d4 and add the result to their initiative roll.  What macros can handle this?  I can't even get the macro to "/r 1d20 + {selected|initiative_bonus}". On the character with the special exception, open the character sheet Attributes & Abilities tab, and search down and find the 'initiative_bonus' attribute, and change it to:  [[@{selected|dexterity_mod}+[[1d4]]]]
Jack - That is a very astute observation.  It works much better than the original.  Unfortunately, it doesn't look like it's taking other factors such as Advantage into consideration.  But I will be using this until then!  Thank you! Jarren -  I tried the string you used, and it did indeed give an Initiative.  However, when a character's sheet changes from Normal initiative to Advantage initiative, it doesn't look like the string is registering it.  Whenever it rolls, it displays: " INITIATIVE  (INVALID INLINE ROLL!) ". However, your suggestion for Part II works awesomely!  It displays the text in the character sheet as well, but that doesn't matter as much.  Thank you for that suggestion!
Zaron said: Jarren -  I tried the string you used, and it did indeed give an Initiative.  However, when a character's sheet changes from Normal initiative to Advantage initiative, it doesn't look like the string is registering it.  Whenever it rolls, it displays: " INITIATIVE  (INVALID INLINE ROLL!) ". Just to be clear: you mean when a character sheet has the Advantage/Disadvantage setting set to ‘Toggle’, and they change the setting to be Advantage or Disadvantage (instead of normal)? Or is Advantage/Disadvantage setting set to ‘Query’? I think I can come up with a quick fix for that tomorrow (if someone else doesn’t beat me to it). I believe you just need to add the @{rtype} into the macro in the correct place. 
Jarren said: Zaron said: Jarren -  I tried the string you used, and it did indeed give an Initiative.  However, when a character's sheet changes from Normal initiative to Advantage initiative, it doesn't look like the string is registering it.  Whenever it rolls, it displays: " INITIATIVE  (INVALID INLINE ROLL!) ". Just to be clear: you mean when a character sheet has the Advantage/Disadvantage setting set to ‘Toggle’, and they change the setting to be Advantage or Disadvantage (instead of normal)? Or is Advantage/Disadvantage setting set to ‘Query’? I think I can come up with a quick fix for that tomorrow (if someone else doesn’t beat me to it). I believe you just need to add the @{rtype} into the macro in the correct place.  At the time it's all toggle.  I tried putting @{rtype} in myself but I think I messed it up, so I'll back off.  Thanks for your help with this!
Ah nevermind.  I just realized the reason that it won't do what you're expecting is because it is an initiative roll that is being sent to the Turn Tracker.  If you add a second roll in the simple template r2 field for advantage/disadvantage, it doesn't matter which roll is higher or lower - the second roll will update the first roll. That's why on any roll for initiative, it doesn't use the @{rtype} attribute; instead it uses the @{initiative_style} attribute (which is a hidden attribute that isn't able to be changed on the Attributes & Abilities tab).  Changing the Roll Queries setting to 'Always Roll Advantage' or 'Query Advantage' or 'Toggle Advantage' doesn't update the @{initiative_style} attribute unfortunately.  That may be a bug that should be reported to the sheet developers. In the meantime, you can create your own macro that queries for advantage: @{selected|wtype}&{template:simple} {{rname=INITIATIVE}} {{mod=@{selected|initiative_bonus}+1d4}} {{r1=[[?{Advantage?|Normal,1d20|Advantage,2d20k1[Adv]|Disadvantage,2d20kl1[DisAdv]}+@{selected|initiative_bonus}+[[1d4]]@{selected|pbd_safe}[INIT] &{tracker}]]}} {{normal=1}} @{selected|charname_output} If you want to always roll advantage: @{selected|wtype}&{template:simple} {{rname=INITIATIVE}} {{mod=@{selected|initiative_bonus}+1d4}} {{r1=[[2d20k1[Adv]+@{selected|initiative_bonus}+[[1d4]]@{selected|pbd_safe}[INIT] &{tracker}]]}} {{normal=1}} @{selected|charname_output} Or always disadvantage: @{selected|wtype}&{template:simple} {{rname=INITIATIVE}} {{mod=@{selected|initiative_bonus}+1d4}} {{r1=[[2d20kl1[DisAdv]+@{selected|initiative_bonus}+[[1d4]]@{selected|pbd_safe}[INIT] &{tracker}]]}} {{normal=1}} @{selected|charname_output} Or the best option might be to just roll a regular roll twice: @{selected|wtype}&{template:simple} {{rname=INITIATIVE}} {{mod=@{selected|initiative_bonus}+1d4}} {{r1=[[1d20+@{selected|initiative_bonus}+[[1d4]]@{selected|pbd_safe}[INIT] &{tracker}]]}} {{normal=1}} @{selected|charname_output} Or lastly you could always use this and add the result manually to the turn tracker: @{selected|wtype}&{template:simple} {{rname=INITIATIVE}} {{mod=@{selected|initiative_bonus}+1d4}} {{r1=[[1d20+@{selected|initiative_bonus}+[[1d4]]@{selected|pbd_safe}[INIT]]]}} {{r2=[[1d20+@{selected|initiative_bonus}+[[1d4]]@{selected|pbd_safe}[INIT]]]}} {{always=1}} @{selected|charname_output}