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

Big rolls macro [D&D 5e]

Hello everyone I've got a bit of trouble on my hands when attempting to use a macro i made for the resolution of a lot of rolls at once in 5e. This is for a mass combat system i'm using and it involves rolling attacks for everyone in a unit and totaling the damage. It's more elegant than it first sounds but my problem is that the macro i use is &{template:default} {{name=Mass combat}} {{Attack damage = [[[[{?{Number of attacks}d20+?{Attack Modifier}}>?{Target AC}]]d[[?{Dice Size}]]]]}} In pseudo code that'd be roll a number of attacks from the unit in d20's, apply attack modifiers and count the attacks that roll above the enemies AC. That number is then used to roll a number of dice of a specified size (i.e d8's).  The problem being that the end output of the macro doesn't include the damage modifier in the result and so i have to count that up and add it separately. Any idea's on how to add that?
The main problem you are running into is that you cannot reuse a dice roll without the use of the API, and, in this case, a custom script . I would recommend splitting this into two separate macros. The first rolls all of the attacks to see how many hits, and the second rolls the damage for the successful hits. For the attack macro, rather than adding the attack modifier to the individual d20 roll, I would recommend instead subtracting this modifier from the target AC. I believe the current way you are handling this is only accounting for the d20 rolls without the attack modifier. You can even keep the queries in the same order by moving them to the beginning of the macro and putting an exclamation point (!) in front of it. Lines starting with ! are assumed to be API calls and are not output to the chat window. You can even put the damage macro as an API command button in the attack macro for ease of access (I made the name of the damage macro Mass-Combat-Damage). !?{Number of Attacks} ?{Attack Modifier} ?{Target AC} &{template:default} {{name=Mass Combat}} {{Number of hits=[[ [[?{Number of Attacks}]]d20>[[?{Target AC}-?{Attack Modifier}]] ]]}} {{Damage=[Damage](!
#Mass-Combat-Damage)}} Once you know how many successful hits you would then click this damage macro &{template:default} {{name=Mass Combat}} {{Damage=[[?{Number of Hits}d?{Dice Size}+?{Number of Hits}*?{Damage Modifier}]]}} This is what the output would look like:
1536780179

Edited 1536782330
Thanks for the response. Having just tested it to see if a result of 23 or higher could be reached by checking 50 attacks and 49 hit (+20 modifier) as 23 cannot be reached with a d20 without modifiers the method seems to work ok.  But this looks good! thanks for the help, if there's any way to compress it into one macro that'd still be interesting to see