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 .
×
The developers are currently investigating an issue with logging in + accessing the VTT.
Create a free account

New to Roll20; how can I do this rolling macro

1494100403

Edited 1494102554
So essentially what I want is to create a macro that takes the amount of Strength someone has and multiplies it by their weapon multiplier (given as a percentage). Then, it'll roll that amount of 4-sided die (if a fraction, round up), ignore any 3 and 4 rolls (they would count as zero), and give out the sum of the rolls. Is this possible? Also, if you do manage to do it, explain what each part of the code does, so I can replicate and learn from it. Thank you in advance :) Example: Character X has 10 strength and a 50% weapon multiplier, so it would roll five 4-sided die. Of those five, one landed on 4, one landed on 3, one landed on 2 and two landed on 1. So, it would ignore the 3 and the 4, but add the 1s and the 2, displaying the result as "Damage: 1+1+2 = 4"
1494109885

Edited 1494112739
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I'm guessing you don't have a internal character sheet in your game. You'll need to create a strength and a weapon multiplier attribute for the below macro: [[ [[ceil(@{strength}*[[@{wmult}/100]]) ]]d4]] If you store your strength score in the attribute, it'll put that number in place of that call; same for the wmult (for the above enter it as an integer %, 20,30,40,etc). The nested inline rolls will evaluate and the system will roll that many d4's. The ceil() function rounds up to the nearest integer. EDIT: Woops, missed the need to gate out 3's and 4's. Yes, use Silvyre's much better answer below.
Heaven Builder said: ignore any 3 and 4 rolls (they would count as zero), and give out the sum of the rolls. This is a dice mechanic that merits the use of a Rollable Table roll in place of a dice roll. I would create the following Rollable Table: Table Item Weight 0 2 1 1 2 1 After naming Rollable Table (e.g. "damage"), you could replace the "d4" within Scott's macro with "t[damage]": [[ [[ceil(@{strength} + @{wmult} / 100)]]t[damage] ]]
Not sure how to tag people in this, but thank you very much Scott C and Silvyre :) I was beginning to think what I wanted wasn't possible, this language is really confusing... I mean, square brackets instead of parentheses? Feelsbadman. Anyways, thank you very much! Glad I can rely on effective player support, this probably won't be the last you hear from me in this sub-forum... 
1494123861

Edited 1494123876
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Parentheses still group like they do in arithmetic. The double square brackets cause an inline roll, single square brackets are roll tags. and there isn't a way to tag people, we just follow threads that we've posted in and may want to follow up on.
Roll syntax can be a bit tricky to get a handle on when starting out (the Dice Reference page can be a useful "translation guide"). Good luck!