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

Macro to draw a card from a deck when a dice rolls a specific result

For context, I made a weapon that (when it crits), draws a card from a deck to add a random effect. I was wondering if it was possible to put a macro somewhere in that would say something along the lines of "if the attack roll is 20, then draw a card from this deck".  And if this is possible, make it so only the GM sees the card. Any and all suggestions (or outright solutions) are welcome.
1696865585
timmaugh
Forum Champion
API Scripter
The MetaScriptToolbox (specifically, APILogic) can conditionally alter your command line, allowing you to run a card-drawing command if the condition passes, or doing something else if the condition check fails. {&if [[1d20]] = 20}True command text{&else}False command text{&end} The metascripts can combine with other scripts, so your "true case" could execute a script (like Dealer) whose job was to deal a particular card.