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

Simple script help request

I'm having trouble getting this script right. I want the amount recovered to bar1&nbsp;to be able to exceed the bar1_max&nbsp;by an amount equal to ( @{Arahorn Yhendorn|PB}+@{Arahorn Yhendorn|Wisdom_Mod}). Would someone be able to help me with this? Thank you! !token-mod {{&nbsp; &nbsp; --set bar1_value|[[{ (0@{selected|bar1} + 0d0+(@{Arahorn Yhendorn|PB}+@{Arahorn Yhendorn|Wisdom_Mod}) ),&nbsp; 0@{selected|bar1|max}d1 }kl1 ]]&nbsp; &nbsp;--report &nbsp; &nbsp; all|"{name} regained {bar1_value:abschange} hit points" &nbsp; &nbsp; gm|"{name} has {bar1_value}/{bar1_max} hp" &nbsp; --ids @{selected|token_id}&nbsp; }} [Barkskin](<a href="https://s3.amazonaws.com/files.d20.io/images/317266988/W0W6Jn7K4rQYmRekijMb4g/med.jpg?1670260786.jpg" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/317266988/W0W6Jn7K4rQYmRekijMb4g/med.jpg?1670260786.jpg</a>)
(Untested) From a quick look you have the macro set up to set the bar1_value to be the lower &nbsp;of your formula or the current max.&nbsp; So if the formula result is higher than the max value, then the max value will be kept. I think you just need to remove the 2nd part of the comparison and the kl1, or change it to kh1.&nbsp;
1670444852
timmaugh
Pro
API Scripter
Wouldn't the 2 things you compare be: The amount of bar1_value *after* points were returned to it and bar1_max +&nbsp; @{Arahorn Yhendorn|PB} + @{Arahorn Yhendorn|Wisdom_Mod} ? In effect, your "temporary" max value would be the normal max plus these 2 attributes that allow the current value to go above the standard max? In concrete numbers (pulled randomly out of the air just to demonstrate and make sure I have the math correct)... Arahorn PB = 3 Arahorn Wisdom Mod = 5 Arahorn is at 14 (current) out of 22 (max) Something in the game creates the opportunity for recovery, and by some mechanic the potential for 20 points of recovery is created. If Arahorn took all of that recovery, his current bar1 would go to 34 (14+20), however it can only exceed the max (22) by 8 (PB + Wisdom), meaning that it cannot go over 30. After all of the math, you want the bar1 value to be set to 30... in other words, to the lesser of (bar1 + recovery) and (bar1_max + PB + Wisdom). If all of that is right, I think that would be more like (untested): !token-mod {{&nbsp; &nbsp; --set bar1_value|[[{ (0@{selected|bar1} + 0d0+?{Recovery Available|0} ),&nbsp; (0@{selected|bar1|max}d1 +&nbsp; (@{Arahorn Yhendorn|PB}+@{Arahorn Yhendorn|Wisdom_Mod})) &nbsp;}kl1 ]]&nbsp; &nbsp;--report &nbsp; &nbsp; all|"{name} regained {bar1_value:abschange} hit points" &nbsp; &nbsp; gm|"{name} has {bar1_value}/{bar1_max} hp" &nbsp; --ids @{selected|token_id}&nbsp; }} You could replace the roll query in there with the appropriate generation of the potential/available recovery Arahorn could claim, or just leave it as is and provide the figure each time.
Thank you Timmaugh! Your suggestion was really great! For myself,&nbsp; I tweaked your suggestion a little but saved your response for other applications: !token-mod {{&nbsp; &nbsp; --set bar1_value|[[{ (0@{selected|bar1} + 0d0+@{Arahorn Yhendorn|PB}+@{Arahorn Yhendorn|Wisdom_Mod} ),&nbsp; (0@{selected|bar1|max}d1 + (@{Arahorn Yhendorn|PB}+@{Arahorn Yhendorn|Wisdom_Mod})) }kl1 ]]&nbsp; &nbsp;--report &nbsp; &nbsp; all|"{name} regained {bar1_value:abschange} hit points" &nbsp; &nbsp; gm|"{name} has {bar1_value}/{bar1_max} hp" &nbsp; --ids @{selected|token_id}&nbsp; }}