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 .
×

Calculating an allies total health after healing them, and making sure the new total health is not displayed over their max hp

Hi, I'm trying to do a certain thing with my macro for cure wounds. I've been trying to utilize @{target|Ally|hp} and @{target|Ally|hp|max} as well as the condition statements but I cant seem to get it to all work. What I'm trying to do is something like this: Player heals Ally for [2d8], their hp is now [if (hp roll + hp) ≤ max hp, display value. If (hp roll + hp) is greater than max hp. find the difference between the two ( (hp roll + hp) - max hp) and subtract that from the new hp so that the number displayed is just the max hp] In just numbers, in these example their current hp before healing is 20, and their max hp is 25: Initial statement is true: Player heals Ally for [3], their hp is now [if 23 ≤ 25, new hp = 23. If 28 > 25, 23 - (23 - 25 ), new hp = 23] Initial statement is false: Player heals Ally for [8], their hp is now [if 28 ≤ 25, new hp = 28. If 28 > 25, 28 - (28 - 25), new hp = 25] Hopefully this all makes sense, my apologies if it doesn't
1673546937

Edited 1673547017
What character sheet are you using? What is the full macro that you're using?
1673546942
GiGs
Pro
Sheet Author
API Scripter
You can use the KL mechanic (see dice reference on wiki) to stop a roll exceeding the max. We'd need to see your actual healing macro to tell you how to make this work, but the idea would be to do {hp+heal-roll,max-hp}kl1