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

Macro to use Healing Potion with pop-up and image on chat

Macro to use Healing Potion with glow effect on character (in the map), pop-up to choose with one you want and image on chat, just to make more fun. &amp;{template:default}&nbsp; {{name=Healing Potion}} {{ &nbsp;?{Potion| &nbsp;Regular, **Healing Potion Used:** [[2d4+2]] HP recovered[image](<a href="https://i.ibb.co/DfRMpdP/healing-potion.png)|" rel="nofollow">https://i.ibb.co/DfRMpdP/healing-potion.png)|</a> &nbsp;Greater, **Greater Healing Potion Used:** [[4d4+4]] HP recovered[image](<a href="https://i.ibb.co/4NH9qQj/greater-healing.png)|" rel="nofollow">https://i.ibb.co/4NH9qQj/greater-healing.png)|</a> &nbsp;Superior, **Superior Healing Potion Used:** [[8d4+8]] HP recovered [image](<a href="https://i.ibb.co/DpTStzq/superior-healing.png)|" rel="nofollow">https://i.ibb.co/DpTStzq/superior-healing.png)|</a> &nbsp;Supreme, **Supreme Healing Potion Used:** [[10d4+20]] HP recovered[image](<a href="https://i.ibb.co/47csqM2/supreme-healing.png" rel="nofollow">https://i.ibb.co/47csqM2/supreme-healing.png</a>) }&nbsp; }} /fx glow-blood @{target|token_id}
This is Amazing!!
1592088419
GiGs
Pro
Sheet Author
API Scripter
Nice work!
It appears that I have to target a token with this, but am I correct in that it doesn't apply the healed points to the token?&nbsp; Or have I changed my hp bar and forgotten?
Correct, you will need to manually update the HP on the sheet or token yourself. Macros cannot change values.
I am wondering, how could something like&nbsp; !modbattr --name @{target|character_name} --silent --evaluate --hp|$[[0]]!!! be build into above macro. I tried, but I must admit, I still do not get the logic which command is executed at which time and how I can nest&nbsp; API calls into a query. Does anyone have an idea?
1592158588
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You could put it on its own separate line. I think you would need to actually input the HP, though. IIRC, the $[[0]] trick works for display, but the number can't actually be re-used programatically. I could certainly be wrong, though.
I would add the !modbattr in this way:&nbsp; &amp;{template:default}&nbsp; {{name=Healing Potion}} !modbattr --charid @{target|character_id} --hp|{{?{Potion|&nbsp;Regular, **Healing Potion Used:** [[2d4+2]] HP recovered[image]( <a href="https://i.ibb.co/DfRMpdP/healing-potion.png)|" rel="nofollow">https://i.ibb.co/DfRMpdP/healing-potion.png)|</a> Greater, **Greater Healing Potion Used:** [[4d4+4]] HP recovered[image]( <a href="https://i.ibb.co/4NH9qQj/greater-healing.png)|" rel="nofollow">https://i.ibb.co/4NH9qQj/greater-healing.png)|</a> Superior, **Superior Healing Potion Used:** [[8d4+8]] HP recovered [image]( <a href="https://i.ibb.co/DpTStzq/superior-healing.png)|" rel="nofollow">https://i.ibb.co/DpTStzq/superior-healing.png)|</a> Supreme, **Supreme Healing Potion Used:** [[10d4+20]] HP recovered[image]( <a href="https://i.ibb.co/47csqM2/supreme-healing.png" rel="nofollow">https://i.ibb.co/47csqM2/supreme-healing.png</a> )}&nbsp;}} --silent!!! /fx glow-blood @{target|token_id}
Uh, now that is indeed a clever way. I was not aware that you could simply put the query at the point where the actual addition to hp is executed, i.e., behind the bar (|). I just tested it and it works like a charm. Thanks for the code and thanks for the lecture :-).&nbsp;
1592340262

Edited 1592340629
PJ
Pro
Yeah, I have also found it only recently that there has been an update by Jakob last year, which allows inline commands within roll templates.&nbsp; If you do not need pictures (takes quite a lot of space in the chat) and want to have it in 5e sheet template by Roll20, then here is another version: &amp;{template:npcaction} {{name=Cheers, to my health!}} {{rname=Healing potion}} !modbattr --charid @{target|character_id} --hp|{{description= ?{ Potion type|Regular, One regular for [[2d4+2]]|Greater, One greater for [[4d4+4]]|Superior,One superior for [[8d4+8]]|Supreme,One supreme for [[10d4+20]]} HP}} --silent!!! {{charname=CHARNAME}} Regards and have fun
At a loss, and it may be the sheet template that's causing this. PJ, your potion macro worked perfectly in my game. I tried adapting it to the following healing spell from the AD&amp;D 2e simple sheet, it fails. I can't seem to figure out where !modbattr --charid @{target|character_id} --hp| gets placed inline. I reworked your potion one to be Cure Light and Cure Serious for now. &amp;{template:2Espell}{{title=@{selected|token_name} casts Cure Light Wounds }}{{school=Necromancy}}{{sphere=Healing}}{{splevel=Level 1 Priest}}{{components=V,S}}{{time=5}}{{range=Touch}}{{duration=Permanent}}{{aoe=Creature Touched}}{{save=Negates}}{{healing=[[1D8+(?{Do you receive a bonus to your healing spells?|0})]] HP}}{{reference=PHB, page 199}}{{effects=When casting this spell and laying his hand upon a creature, the priest causes from 1d8 points of wound or other injury damage to the creature's body to be healed. This healing cannot affect creatures without corporeal bodies, nor will it cure wounds of creatures not living nor those of extraplanar origin. Curing is permanent only insofar as the creature does not sustain further damage. }}
For using&nbsp;ChatSetAttr&nbsp; in the middle of a roll template, you need to (Jakob's instructions): write the ChatSetAttr command between the properties of a roll template, and end it "!!!" . I would try to place it here (to wrap it around the desired roll): &amp;{template:2Espell} {{title=@{selected|token_name} casts Cure Light Wounds }} {{school=Necromancy}} {{sphere=Healing}} {{splevel=Level 1 Priest}} {{components=V,S}} {{time=5}} {{range=Touch}} {{duration=Permanent}} {{aoe=Creature Touched}} {{save=Negates}}&nbsp; --charid @{target|character_id} --hp| {{healing=[[1D8+(?{Do you receive a bonus to your healing spells?|0})]] HP}}&nbsp; --silent!!!&nbsp; {{reference=PHB, page 199}} {{effects=When casting this spell and laying his hand upon a creature, the priest causes from 1d8 points of wound or other injury damage to the creature's body to be healed. This healing cannot affect creatures without corporeal bodies, nor will it cure wounds of creatures not living nor those of extraplanar origin. Curing is permanent only insofar as the creature does not sustain further damage. }}
Sorry to be absent, it has been dark times !! But thanks for the feedback and tips, I thought this formula would look really generic and could easily be changed for other applications, like an example of a healing skill with reference. My final goal would be to create a macro that would also change the character's HP, but I haven't gotten there yet. Other macros that I am creating are for spells, in addition to visual effects in the enemies' token (fire, explosion, etc.), an example I did was the "ice ray", literally a ray of ice comes out of my token to the enemy token and in the chat it already rolls the dice and effect ...