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

Formula Help Needed

1408675226
Finderski
Pro
Sheet Author
Compendium Curator
I'm working on a macro that needs to compare an attribute to a die roll and if the die roll is higher than an attribute, subtract the difference from a second attribute. Then a second die roll needs to happen with the same sort of comparison and arithmetic. And then a third die roll following the same process. Then I need to know what the final value of the second attribute is. Is there any way to accomplish this? I guess my real question is, is there a way for a roll to modify an attribute?
1408675915
Gauss
Forum Champion
The dice roller cannot modify attributes or do 'if then' type statements but the API can do this.
1408676155
Finderski
Pro
Sheet Author
Compendium Curator
That's what I was afraid of, but figured I would ask, just in case I was wrong. :) Thanks for the quick response Gauss .
1408676285

Edited 1408676482
You can't write back to attributes, but you can do arithmetic and report the final result. If I understand what you're trying to do, you'd probably want something like: /r @{second_attribute} - {@{first_attribute} - 1d10, 0d1}kh1 - {@{third_attribute} - 1d10, 0d1}kh1 ... Edit: Just to be clear, you'd have to manually write the result back to the attribute if the penalties are persistent. This would probably be easiest by linking a token bar to second_attribute. Edit2: Just noticed that you have mentor status. So yeah, the API is probably the way to go.
1408676875
Finderski
Pro
Sheet Author
Compendium Curator
Manveti, Thanks, unfortunately that's not quite it exactly... It's for a German game called Das Schwarze Auge and the rules run like this: ...in DSA you have those three dice rolls. Lets use the example from above: climbing [skill] of 10 using the following [Attributes]: Courage: 10 Agility: 12 Strength: 14 Now the dice rolls: 19, 18, 1 ... 19<=10, ... use 9 [skill] points. 1 Point remaining [Success] 18<=12, ... use [skill] points. But there are not enough left (only 1 point remains). [Failure] 14<=14, ... no [skill] points needed [Success] All three rolls need to succeed and the Skill Point pool doesn't refresh with each roll, it has to span all three rolls, and each roll is made against a different attribute with a potentially different score...so, unfortunately, I believe this has to be an API type of formula. Thanks, though.
The rolling and subtracting part should work then (although my math was reversed above). To use more concrete attributes: /r @{climbing} - {1d20 - @{courage}, 0d1}kh1 - {1d20 - @{agility}, 0d1}kh1- {1d20 - @{strength}, 0d1}kh1 If any of the (1d20-stat) results is less than 0 (i.e. stat is greater than roll), then the "kh1" makes that part of the formula 0; otherwise, that part of the formula is the roll minus the stat. If you don't have to write back the new result into the climbing stat after making the three rolls, then you can do it without the API.
1408695217
Finderski
Pro
Sheet Author
Compendium Curator
Manveti - you're brilliant! Doing it this way as long as the result >= 0, then the roll succeeds. Awesome! Thank you very much.
Now I see who manveti is :-) Thank you! You are helping creating this Sheet! :-)