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

Temporary variables in macros

I'm trying to write a macro for a large number of identical enemies attacking a single target in D&D 5e (+4 to hit, 1d6+2 damage). I'd like to have a macro that queries for the number of attackers, rolls against their armor class, and then rolls damage for each attacker that managed to hit. The idea is: numHits = /roll {?{numAttackers|1}d20+4}>@{target|ac} damage=/roll #{numHits}d6+#{numHits}*2 But the problem is I don't see a way to create a temporary variable that I can reference later. Repeatedly rolling numHits is wrong, since it would be basically rolling one attack doing 1d6 damage and then a second attack dealing 2 damage. Or, equivalently, I could repeat the 1d6+2 roll numHits times:  damage= /roll {1d6+2} {?{numAttackers|1}d20+4}>@{target|ac} times and then add them all up. But I don't know of die-rolling syntax that allows me to do, like "/roll 3{1d6+2}" which would expand into "/roll {1d6+2}+{1d6+2}+{1d6+2}" instead of "/roll 3*{1d6+2}" Any suggestions?
1587140792
The Aaron
Roll20 Production Team
API Scripter
If isn't possible without the API.
There is a simplistic way to deal with this from the DMG. It's "Handling Mobs" from chapter 8 " Running the Game".
The Aaron said: If isn't possible without the API. Shucks.  Well, time to learn me some Javascript.