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

Can Aura/Tint Health Color use a Token/Character's Negative Constitution Score instead of 0 hp for the Death Marker X?

I love the Aura/Tint Health Color API, but I am wondering if there is a way for Aura/Tint Health Color to get brought into line with Pathfinder 1e Death/Dying rules.  I have imported the script and modded it (starting line 377) with The Aaron's suggestions for multiple tints for various percentages. At 0 hp a Character should be Disabled but Alive. At -1 or less hp a Character is Unconscious and Dying. If the character's current Hit Points drop to a negative amount equal to his Constitution score or lower, he is Dead, with the Big Red X! Bonus question:  Can I integrate TokenMod commands into this script? It would be Cool to set a Disabled, Unconscious, or Dying status marker on a Token, and move a "Dead" Token to the Map Layer!
Well,  I figured out one thing. Changing //SHOW DEAD by adding this  obj.set("layer", "map"); moves a dead token to the map layer. Line 77 //SHOW DEAD---------- if(ShowDead === true) { if(curValue > 0) obj.set("status_dead", false); else if(curValue < 1) { var DeadSounds = state.HealthColors.auraDeadFX; if(DeadSounds !== "None" && curValue != prevValue) PlayDeath(DeadSounds); obj.set("status_dead", true); obj.set("layer", "map"); SetAuraNone(obj); } } }
Now I need to replace  if(curValue > 0) with  if(curValue < -1 * @{selected|constitution} ) I need to get the constitution from the Character sheet associated with the Token.
1677636808
Pat
Pro
API Scripter
...so would this apply when the HP is 0 or below AND the constitution is negative? If that's the case, you'd be looking at the curValue < 1 statement, not the curValue > 0, and you'd want either an && or another conditional interior to it, plus given that obj refers to the token, you need to get information from the token to point to the character sheet it represents and not the token. 
1677682637

Edited 1677682908
Yep, I did that and it wasn't easy.  I barely know any Javascript and I don't know the Roll20 object model at all!  lol I altered the code starting at Line 78 to this: //SHOW DEAD---------- if(ShowDead === true) { var oConstitution = findObjs({_type: "attribute",name: "constitution",_characterid: oCharacter.id})[0]; //Strength----------------- var cConstitution = parseInt(oConstitution.get("current")); var mCon = 0 - cConstitution; if(curValue > 0) { obj.set("status_pummeled", false); obj.set("status_skull", false); obj.set("status_dead", false); } else if(curValue == 0) { obj.set("status_pummeled", true); obj.set("status_skull", false); obj.set("status_dead", false); } else if(curValue > mCon) { obj.set("status_pummeled", false); obj.set("status_skull", true); obj.set("status_dead", false); } else if(curValue <= mCon) { var DeadSounds = state.HealthColors.auraDeadFX; if(DeadSounds !== "None" && curValue != prevValue) PlayDeath(DeadSounds); obj.set("status_pummeled", false); obj.set("status_skull", false); obj.set("status_dead", true); obj.set("layer", "map"); SetAuraNone(obj); } } and that seems to work. Next, I might set the Condition of the Token.  Staggered, Dying, etc., to match the status.
1677750133

Edited 1677750165
GiGs
Pro
Sheet Author
API Scripter
I dont know the sheet, but to avoid breaking crashes you might want to change this line to account for con attributes that aren't numbers (typos, etc): var cConstitution = parseInt(oConstitution.get("current")) || 0; Change 0 to whatever you want to use as a default COn, maybe 10? Also the very last else if is this: else if(curValue <= mCon) { It could probably be this: else { Since you have accounted for every other case, the else there is everything that's left.
Thank you, sir!  I will put that right in.