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

Need help with a macro

1549764139

Edited 1549764525
Hello, I need some assistance with a macro.  I do not know if this can even work in here.  I will enter it here as standard programming logic.  If someone could send me with what the macro command would be, It would be much appreciated.  I have a spell that has a 20% chance of going off.  Each 2 turns the spell fails, it increase the damage die count by 3.  lets say its 1d8 damage.  If you fail twice and then succeed on the 3rd time, it would be 4d8 (1d8 for the turn plus 3d8 for the 2 failures). If you fail four times and then succeed on the 5th time, it would be 7d8 (1d8 for the turn plus 6d8 for the 4 failures) . Int Attempts_Count Int Modifier Int Chance int Damage Chance = Roll 1d100 If Chance > = 80    If Attempts_Count > 1       Modifier = (Attempts_Count / 2) * 3    Else       Modifier = 0    Damage = (Modifier + 1)d8     /me hits the enemy with a bolt of lightning for  (Damage) points of electric damage    Attempts_Count = 0  Else    /me looks disappointed that the spell failed    Attempts_Count++
1549765415
GiGs
Pro
Sheet Author
API Scripter
You cant do If Then logic in roll20 macros. You can do it in API scripts, but they are a Pro subscriber feature. The best you can do is print the roll, ask for the number of previous failures, and roll that. Something like: &{template:default} {{name=Random Spell}} {{Spell Roll=[[1d100]] }} {{Damage If Roll < 20=[[ [[floor(?{How many Previous Failures?|0}/2)*3]]d8]] }} Or using simpler syntax: /me rolls A Random Spell /roll 1d100<20 for Success /roll [[floor(?{How many Previous Failures?|0}/2)*3]]d8 for Damage
Thanks GiGs