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

Map same roll to ranged rules.

Dear roll20 community, I'm very new to the roll20 and try to make my sessions a bit simpler on math, so I am to write a macro. My game system says, that to roll damage i need to: 1. Roll Nd6 dices. 2. For each dice with 1-3 get .5 points of damage 3. For each dice with 4-5 get 1 points of damage 4. For each dice with 6 get 2 points of damage 5. Round down to an integer (5.5 gives 5) In pseudocode, close to roll20 syntax: ``` X = 3d6 result = floor([[X<3]] * .5 + [[4<X<5]] * 1 + [[X=6]] * 2) ``` The main problem: I can't figure out how to map same roll (X) to 3 sequential computations with /roll or even with nested-rolls. Could this be achieved with roll20 default Dice Rolling expressions at all? Thanks in advance!
1584484281
GiGs
Pro
Sheet Author
API Scripter
You cant do conditional operations in roll20 macros. No "if die is 1-3, multiply by half, but if if over 3, do this instead". If you cant express it as a single operation it cant be done in roll20. The ony way to do the above without using the API (a Pro subscription perk) would be to use a rollable table instead. Create a rollable table with three entries: name: 0.5, weight 3 name: 1: weight 2 name: 2: weight 1 Call it d6. Then you can use  /roll ?{Dice?|3}t[d6]
Thank you very much, saved me a ton of time.
1584484815
GiGs
Pro
Sheet Author
API Scripter
You're welcome :)