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

i'm looking for a macro to set temp HP

i have a lot of players who like fiendish vigor, and i want to make a macro that then can put on there sheet so when they roll the temp hp, it automatically applied to the @{hp_temp} on there sheets, but i can't think of a way to set it. i'd prefer it without APIs but if not i'd still like to know. something that would be along the lines of "set @{hp_temp} [[1d4+4]]"
1597286819
The Aaron
Roll20 Production Team
API Scripter
This is only possible with API scripts. 
what would be the API script to use and what would the macro be? if you don't mind me asking i'm assuming Tokenmod but from there i'm stumpt
1597317580
Oosh
Sheet Author
API Scripter
ChatSetAttr will do what you need, available via one-click library. Something like this might work: &{template:default} {{name=Fiendish Vigor}} !setattr --silent --sel --hp_temp|{{[[1d4+4]]=Temp HP to @{selected|token_name}!}}!!! This is pretty basic and would overwrite whatever value of temp HP they have. It might be an idea to have it check if the current value is already higher, and not apply the HP if that's the case. Or you might not be worried about it.
Looking at ChatSetAttr I wouldn't know how to do the first thing with it, thank you for the code. I will try and mess around but I doubt I'll manage lol