It can go negative, but since you never expect it too the code works fine. If you worry about it you can add a TempHP= max(TempHP,0) at the start to make sure it is never negative.Awesome, that's much more elegant. I assumed TempHP was an integer that could go negative, so I was testing too much.
There are 4 sections of macros, 1 deals with the token selected, the others do not.I put Jay's code into the campaign preferences, but it still demands values when I try to make use of them in a macro.
That code was surprisingly hard to figure out. Basically what it does is checks your HP and puts the correct state marker on your token and adjusts your states accordingly.<!--
{VARa = if(HitPoints<=BloodiedHP, 1,0)}
{VARb = if(HitPoints<=0,1,0)}
{VARc = if(HitPoints<= 0-BloodiedHP,1,0)}
{state.Dead=VARc}
{VARa = if(state.Dead,0,VARa)}
{VARb = if(state.Dead,0,VARb)}
{state.Dying=VARb}
{VARa = if(state.Dying,0,VARa)}
{state.Bloodied=VARa}
-->
[h, if(ENC1==0), CODE:
{[assert(1==0,add("<b>LOUT! You already used this power!</b>"),0)]
};{[h: ENC1=0]}
]
AddedJay, could you please add these variables to your game.
ENCsp: 2
ENC1: 1
DAILY1:
UTILITY2:1
ENC3:1
DAILY5:1
Taking Damage Macro, it also sets the appropriate states for each.<!--
{MyINIT=1d20+Initiative}
{addToInitiative(0,MyINIT)}
-->
<b>Initiative</b>(+{Initiative}) : {MyINIT}
This is a Death Saving throw that counts how many times you have failed and sets the correct state when you reach 3I start with {HitPoints} HP and take
<!--
{TempHP=max(TempHP,0)}
{CurrHP = Hitpoints}
{DamageValue = DamageTaken}
{DamV=TempHP - DamageValue}
{HitPoints = CurrHP + min(0,DamV)}
{TempHP = max(DamV,0)}
{setBar("Health", HitPoints/MaxHP)}
-->
{DamageValue}
points of damage, my HP is now
{HitPoints} with {TempHP} Temp HP
<br>
<b>
{if(HitPoints<=BloodiedHP,"I am Bloodied","")}
<br>
{if(HitPoints<=0,"I am Dying","")}
<br>
{if(HitPoints<=0-BloodiedHP,"I am Dead","")}
</b>
<!--
{VARa = if(HitPoints<=BloodiedHP, 1,0)}
{VARb = if(HitPoints<=0,1,0)}
{VARc = if(HitPoints<= 0-BloodiedHP,1,0)}
{state.Dead=VARc}
{VARa = if(state.Dead,0,VARa)}
{VARb = if(state.Dead,0,VARb)}
{state.Dying=VARb}
{state.Prone=VARb}
{state.Helpless=VARb}
{VARa = if(state.Dying,0,VARa)}
{state.Bloodied=VARa}
-->
For attacking multiple targets, this prompts you for how many then returns a result (has some testing values in it), it also calculates critical hits add returns damage for them (but it's aesthetically ugly)<!--
{SV=d20}
{DeathSave = DeathSave + if(SV<=9,1,0)}
{state.Dead=if(DeathSave>=3,1,0)}
-->
<b>Saving Throw: </b>{SV}<br>
[h: AttackBonus=5]
[h: DamBonus=5]
[h: DamageString="damage."]
[h: x=input("NumberOfTargets|0|Number of targets")]
[h: abort(x)]
<b>AttackName</b><br>
Attacking {NumberOfTargets} {if(NumberOfTargets==1,"creature","creatures")} in the burst.<br>
[count(NumberOfTargets,"<br>"), CODE:
{
[h: d20roll=d20]
[h: AttackRoll=d20roll+AttackBonus]
Target [r:roll.count+1]: (+{ AttackBonus}) = <b>{AttackRoll}</b>
[if(d20roll>=CriticalHit), CODE:
{<font color=Red> CRITICAL HIT!</font> [16+DamBonus+CritImp,2d8+DamBonus] };{}
]
}
]
[h: TokenList = getVisibleTokenNames()]
[FOREACH(name, TokenList, ""), CODE:
{[IF(getProperty("Initiative",name)!="Z"), CODE:
{<b>[name]:</b> [d20+getProperty("Initiative",name)]<br>};{}]
}
]