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

[Help] Reroll until lower than value macro ?

So, in my game I have this howebrew ability that makes the PC reroll each time he succeeds at hitting a target adding another attack as long as he succeeds, because it is clumsy to do manually and takes more time than necessary to each time check the AC of the enemy, I tried to make it a macro to no avail...

It would be something like

"Roll 1d20+14 vs @{target|AC}" 

if result is greater than @{target|AC} then repeat

Thank you for your time ! I'm a new DM on Roll20 and making full use of the macros is a daunting task.

June 21 (5 years ago)

Edited June 21 (5 years ago)
Oosh
Sheet Author
API Scripter

Try this:

/r 1d20!>[[{(@{selected|AC}-?{Modifier|0}),2}kh1]]>[[{(@{selected|AC}-?{Modifier}),2}kh1]]

A couple of things about it:

- It's using a @{select} call instead of @{target}, as with a target call you have to click the token for every single reroll. If a player needs to use this macro and can't select the target, changing it to a Query ?{Target AC?|0} will probably be the next best option to avoid constant clicking. Also keep in mind the difference between {ac} and {npc_ac} if using the 5e sheet.

- The modifier is applied as a negative on the right side of the equation, as the Compare operator works only on base rolls, not modified rolls, AFAIK

- I've assumed that 1 is a critical fail and will always miss, otherwise if your modifier is equal to or greater than the target AC you'll get an infinite roll & break the internet.


See if it does what you want.