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 HP query?

1656069851

Edited 1656069898
Hey, API noob here I'm trying to implement a way to basically, at the start of it's turn, check for a golem's HP in D&D. If they are below a certain amount (for example 40) it's giving a warning or displays a button to roll for a berserk check. Something like this: If @{Golem|hp} < 40 then redtextRAGE & /r1d6 or: If @{Golem|hp} < 40 then  &{template:default} {{name=Rage Check}} {{Golem= HP @{Golem|hp}/@{Golem|npcd_hp}}} I'm using OnMyTurn script for this and was hoping for APILogic could help me with this. But i couldn't manage so far. I'm using most other popular APIs like CombatTracker and Token-Mod and i think APILogic only works through another script? At least i couldn't manage to give out a {& simple} message with it. Can someone give me a hint how to make this? Or is there a pre-made way already? Thanks in advance
1656072039

Edited 1656072157
David M.
Pro
API Scripter
You could try using a Scriptcards macro (available for 1-click install). Which sheet is this for? From your 2nd example I'm assuming npcd_hp is the max hp of the character? If so, try this in an ability called OnMyTurn: !script {{ --#whisper|gm --#title|Rage Check --=hpCurrent|@{hp} --=hpMax|@{npcd_hp} --+hp|[$hpCurrent] / [$hpMax] --?[$hpCurrent] -ge 40|[ --+Status|Not raging --]|[ --+Status|[#990000][b]Raging[/b][/#] --]| }} I tested on a Goblin I pumped up to max 80hp using the 5e by Roll20 sheet (using different attribute names also, of course) You could also add these two lines in the "Raging" code block to have it roll the 1d6 for you:   --=roll|1d6   --+Rage Damage|[$roll]
1656072807
timmaugh
Pro
API Scripter
Hey, Kev... Just to be clear, {&simple} is a function of ZeroFrame (the metascript organizing script). You'll want both ZF *and* APILogic to do this. It would look something like... !{&if @{Golem|hp} < 40}{&template:default}{{name=Rage Check}} {{Golem=HP @{Golem|np}/@{Golem|npcd_hp}}}{&simple}{&end} ...OR... !{&if @{Golem|hp} < 40}/r 1d6{&end} I'm not sure what redtextRAGE is supposed to be, but I think maybe you just meant "RAGE", and you meant it to be in red...? In any case, you can't put text before the /r if you want the die to be rolled. You can put it after: /r 1d6 RAGE , or you can use an inline roll: RAGE! [[1d6]] . Hopefully this gets you where you wanted to go.
That's exactly what i hoped to do. Thanks a lot, both of you. A little less things to remember for me and my players.