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 .
×

Macro: explode only part of the successful roll

Hi there, I am trying to write a macro for a custom game system where only a limited number of "maximum" rolls can explode. For example rolling D6, a success could be a value of 4 or more, and you would be able to explode a maximum of 2 successes. So: 4d6 could give 1,4,4,6 => I explode only 2 successes and get: 3,5 => this would give a total of 4 successes. Is there a way to do this? Thanks a lot for your time!
There isn't any syntax to limit the number of explosions directly but it is possible to keep dice in sequence. So if we create a sequence that has two successes that explode followed by two non-exploding successes we can limit the sequence by counting initial successes to create the effect of limited explosions. /r { d0=0*(1+d6>4) + d0=0*(1+d6>4) + 2d0=0 }k[[4d6>4 +2]] The d0=0 is used to select how far into the sequence to keep; one is kept per success The d0=0*(1+d6>4) represents an exploding success The 2d0=0 represents the remaining non-exploding successes This does assume only initial successes can explode
Wow that's great, thanks! I think I understand the formula, however how can I make it so that the number of dice rolled (4 in our example) comes from a variable? From what I understand it is not possible to use a "query variable" twice in a formula, so I would be stuck?
You can use queries multiple times by using the same query prompt. So it'll become /r { d0=0*(1+d6>4) + d0=0*(1+d6>4) + (?{How Many|4}-2)d0=0 }k[[?{How Many}d6>4 +2]]