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

Auto Health Potions...

So I've been trying to find a macro that both auto rolls a potion, and then applies the hp to the character automatically... so far I have... &{template:default} {{name=Healing Potion}}{{?{Potion|Regular, **Healing Potion Used:** = [[2d4+2]]|  Greater, **Greater Healing Potion Used:** = [[4d4+4]]|  Superior, **Superior Healing Potion Used:** = [[8d4+8]]|  Supreme, **Supreme Healing Potion Used:** = [[10d4+20]]  } HP recovered}} This lets me select the kind of potion I wanna use, and rolls it out for me, I just dont know what I need to add to it for that to use an API like token mod to increase the HP of the character by an equal amount... I dont even know if its possible, I just presume it is... So... plz help, it would be greatly appreciated.
1643590003
The Aaron
Roll20 Production Team
API Scripter
TokenMod has a rudimentary reporting system that you can use to report the change you have applied to a token.  here's and example: !token-mod {{ --set bar1_current|+[[4d4+4]]! --report all|"{name} healed {bar1_value:abschange}hp" }} You could build out a TokenMod command with a Roll Query to select the potion size and build the right reporting for it.
OK... my brain isn't working it would appear... you said I could set it up as a roll query... and I tried...But the output is altering the health of the token to "+"... where did I go wrong ? !token-mod {{   --set     bar1_current|+ {{?{Potion|Regular,= [[2d4+2]]| Greater, = [[4d4+4]]| Superior,= [[8d4+8]]| Supreme,= [[10d4+20]]  }   --report     all|"{name} healed {bar1_value:abschange}hp" }}
1643590915
The Aaron
Roll20 Production Team
API Scripter
You have a space after the +.  Also, you don't want to have {{ there, and you probably want to put ! on the end to prevent any healing from going over the max value: !token-mod {{ --set bar1_current|+?{Potion|Regular,[[2d4+2]]|Greater,[[4d4+4]]|Superior,[[8d4+8]]|Supreme,[[10d4+20]]}! --report all|"{name} healed {bar1_value:abschange}hp" }} Also, make sure the result of the Roll Query is just the roll.
I cannot begin to tell you how amazing this is, and you are... thank you so much... this macro is straight up awesome... and will be so helpful to so many peeps :D.... you are such a legend !
1643591634
The Aaron
Roll20 Production Team
API Scripter
No problem! =D
as an aside.. is this possible to do with an @selected kind of setup, so i could click the macro, and apply the hp to another players token ?
1643592527
The Aaron
Roll20 Production Team
API Scripter
It wouldn't be @{selected} at that point (TokenMod operates on all selected tokens already anyway), it would be @{target}: !token-mod {{ --set bar1_current|+?{Potion|Regular,[[2d4+2]]|Greater,[[4d4+4]]|Superior,[[8d4+8]]|Supreme,[[10d4+20]]}! --report all|"{name} healed {bar1_value:abschange}hp" --ignore-selected --ids @{target|token_id} }}
This macro had no effect, the second tokens Hp didnt alter at all.. and there was no output in the chat... also im starting to feel guilty about taking up so much of your time.
1643597773
The Aaron
Roll20 Production Team
API Scripter
hmm.  I just tried it and it's working perfectly for me?  Did your API crash?