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 for a macro!

1633000972

Edited 1633001005
Hi, I like some more... elaborated homebrew mechanics in my games and I'm still struggling a bit with macros so I'd like to have your help! On a DnD 5e Sheet, my Player has the class_resource and I need two macros to implement the following mechanics: 1. The propability: - Roll a d100 - Check, if the roll is equal or lower than the current resource amount. - If it is equal or lower, roll 1d10+1 and add that to the resource. - else, only add 1 to the resource. 2. Resting: - Roll 1d10 and multiply by 5 - Lower the resource by that percentage amount , rounded down: For example, if the Resource is currently at 90 and you roll a 10*5=50, lower the Resource by 50% aka. down to 45. - If this is to elaborated, it also suffices if the macro only shows the amount that needs to be lowered instead of lowering it themselve. Either way, we want to avoid an external calculator. I hope, my english is understandable (foreign speaker). Thanks in advance! Edit: Sorry for miscommunication; my title only refers to one macro, but I need two.
1633005836

Edited 1633005988
timmaugh
Forum Champion
API Scripter
Here is the first one in a roll template: &{template:default}{{name=Resource Check}}{{Result=[[{[[[[1d100<@{selected|class_resource}]]*[[1d10+1]]]],1}kh1]]}} ...let me see about the second.
Thanks, timmaugh! This one already functions quite good! Can the template be changed to include also the result of the d100 in the Chat? Currently, it seems to only visibly roll the d10.
1633012240

Edited 1633012272
timmaugh
Forum Champion
API Scripter
You can't make the 3d version of the d100 show, but if you just want to report the value, you can do that. Sort of. You can't isolate that d100 value and also use it to compare to your resource, so the best you can do is show the d100 in a roll tip. In this version, if you hover where it tells you to hover, you'll see the d100: &{template:default}[[{[[ [[ 1d100<@{selected|class_resource}]]*[[1d10+1]] ]],1}kh1]]{{name=Resource Check}}{{Hover for d100=$[[0]]}}{{Result=$[[3]]}} As for your second macro request, the below version is nearly there, though it also requires a little reading. Someone else might be able to get it over the finish line. Basically what is required is to take the computed value and multiply it by the output of the kh1 (which will be 0 or 1). If that could be managed, then you would arrive at a finished product that was either 0 or the amount to decrement. I don't see a way to do that, so this is the best I can come up with. &{template:default} {{name=Resting Check}}{{If This is 1=[[ ceil((({[[ ([[ [[ [[ [[1d10*5]]/100]]*@{selected|class_resource}]]/@{selected|class_resource}]]*100) + .001]]-@{selected|class_resource},0}kh1)/100) ) ]]}}{{Subtract This=$[[2]]}} Note, too, that this doesn't handle any rounding of the final number you should decrement. That can't be accomplished using the nested inline roll method I'm using, where you track the changes to a number in an inline roll before reversing that change on the next-outer roll. You can't un-round a number once rounded, so there is no way to isolate the value and still make the comparison work at the end.
Thank you very much for your help! I really appreciate it! Since my second request seems way to overboard for a reasonable solution, I stepped down a notch and decided to only show the current value of the resource and the new value after the roll: &{template:default}{{name=Strengthen Magic on a Short Rest}}{{Currently faded magic=@{selected|class_resource}}}{{Lower 'Fading Magic' down to=[[@{selected|class_resource}-floor(@{selected|class_resource}*((1d10*5)/100))]]}} Anyway, your examples on my specific problem helped me to gain a lot of insight into the Roll20-Macro-system. Thanks!