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

[Script] Aura/Tint HealthColor

1488834987

Edited 1488835055
DXWarlock
Sheet Author
API Scripter
Sure! but not sure if I will get it in the first iteration of it. Need to work on a way to check if all the comma list is valid FX to use, and fire them all off vs a single default or hex color default one. Plus adding in a _.each/while/(something) to fire off all of them. First time even diving in the custom defined FX in the menubar, with API. So rather get it working and make sure no one has any issues before I make it more complex.
That would be cool. I can just imagine players having a blast attacking a giant fire elemental and everytime it takes damage flames and smoke erupting from it. Combine it with a simple api script to allow players to deal the damage themselves... like AlterBar and it would probably be even more fun for the players.
DXWarlock said: Sure! but not sure if I will get it in the first iteration of it. Need to work on a way to check if all the comma list is valid FX to use, and fire them all off vs a single default or hex color default one. Plus adding in a _.each/while/(something) to fire off all of them. First time even diving in the custom defined FX in the menubar, with API. So rather get it working and make sure no one has any issues before I make it more complex. Wrapping it in _.each should work. :D
First of all. Love this script. You've done an amazing job, this has streamlined combat for my group so much. I no longer have to answer "How bad does that one look?" every round. Would it be possible to make it use different settings for NPCs vs PCs? I love that it marks the NPCs dead for instance at 0 health, but for PCs I they still have their death saving throws. Would also be nice to be able to set different Thresholds for PCs vs NPCs. 
1488916962

Edited 1488917107
There's actually a bug in v1.2.0 where Show on PC doesn't do anything, but I think that would disable the auras and tints, not just the death X marker. Might be a good idea to re-do the !aura menu and break all the settings down into PC and NPC and allow each one to be set independently.
1488920851

Edited 1488920919
DXWarlock
Sheet Author
API Scripter
@Mike I'll see what I can do in the next update :) @SkyCaptianXIII So it does..:hmm:, I'll fix it in this update. I'm going to get it out today for the customFX I'll fix that while I'm in there.
1488922720

Edited 1488922810
DXWarlock
Sheet Author
API Scripter
I rewrote a good chunk of logic for this so if you have ANY bugs feel free to slap me and let me know. After MUCH fighting it, and harassing TheAaron for some tips: 1.3.0 ( hopefully no major bugs in the FX update ) : Custom Damage FX: FX can now use multiple custom FX you have created on specific characters. To change it set the BLOODCOLOR attribute to the custom FX names (comma for multiple). IE: Fire or Fire,Smoke . This does not effect using hex colors, they are still an option also. Editable Default FX: The default heal/hurt FX are now auto generated as custom FX labeled -DefaultHeal -DefaultHurt. You can edit them to be how you wish (color for them comes from menu or token settings). Added TokenMod Support: Now triggers updates when TokenMod is used to change a token. RE-Fixed bug where token set to OFF, would not auto update See Names on tokens. Fixed PC/NPC toggle aura bug created by fixing above issue.
DXWarlock said: Added TokenMod Support: Now triggers updates when TokenMod is used to change a token. Firstly can i say how great this script is! is there anyway it can be triggered by the AlterBars script?
1488927121
The Aaron
Pro
API Scripter
The facility it takes advantage of to work with TokenMod is TokenMod's observeTokenChange() function.  A similar facility would need to exist in AlterBars.
1488927154

Edited 1488927224
DXWarlock
Sheet Author
API Scripter
Not sure, TheAaron gave me the code I needed to hook it into TokenMod. He has a function that watches for token changes and sends my script the info. If there is something in Alterbars I can tell "hey I'm here let me know when you change it" I can. Edit: He beat me to it..
1488927303
The Aaron
Pro
API Scripter
MUAHAHAHAHAH!
Thanks both, it did work before a recent update of health colours, in the alter script it sendds: if('undefined' !== typeof HealthColors && HealthColors.AdjustToken){ HealthColors.AdjustToken(Target); } Was a function name changed?
1488928725

Edited 1488929272
DXWarlock
Sheet Author
API Scripter
try this: if('undefined' !== typeof HealthColors && HealthColors.handleToken){ HealthColors.handleToken(Target,prev); }  That MIGHT work, that function name hasn't changed in a long time in mine. all the way back in oct 25th it was still  handleToken = function . Thats the oldest save I have to check. Only thing is, it needs the obj and prev (obj would be 'Target' I assume so that's correct, not sure what the equal of prev is for it to send). Edit: Come to think of it I dont think that would work either, as I'm not exposing the handleToken function outside of the script but I can change that. Not sure how it worked at all before :P
Jon M. said: Thanks both, it did work before a recent update of health colours, in the alter script it sendds: if('undefined' !== typeof HealthColors && HealthColors.AdjustToken){ HealthColors.AdjustToken(Target); } Was a function name changed? That is not part of the default AlterBar script. You've added that in from a fix elsewhere.
1488930834

Edited 1488931277
DXWarlock
Sheet Author
API Scripter
1.3.1:  Added a call HealthColors.Update() so people can call it from another script now. Added a check to it so it makes sure its actually passed a token to it, and not just some random object, and will whisper the GM letting them know if its not. Just add this to any script somewhere that can pass it the token obj and prev. if('undefined' !== typeof HealthColors && HealthColors.Update){ HealthColors.Update(obj,prev); }
Added that to AlterBar to test it out and it's not triggering the FX reliably. Deal damage to a token and the first time I heal it with AlterBar, the FX doesn't play. Sometimes on the second and subsequent heals with AlterBar do work, but not always. Gonna try putting a 100ms timeout on calling HealthColors.Update and see if that helps.
Nope, that didn't help. Made it worse to where no FX would spawn... but the auras still changed.
1488933661
DXWarlock
Sheet Author
API Scripter
Hmm toss me a copy of what you are using..I'll see if its something I got off in mine.
Copied my old script from here:&nbsp; <a href="https://app.roll20.net/forum/post/1216260/script-a" rel="nofollow">https://app.roll20.net/forum/post/1216260/script-a</a>... And added the snippet you posted above in the final sendChat area.
1488935272
DXWarlock
Sheet Author
API Scripter
Ah I think I see why, there is no prev in your script to send. So the FX is seeing: if(curValue == prevValue || prevValue === "") return; And returning. Since it has no prev value to do the math to see if its a hurt or a heal for the FX. You know a way to get the prev of an object other than on the&nbsp;on("change:token")? If there is a way I can just change mine to work from the object passed to figure out the prev.
1488935676

Edited 1488935778
Not sure... I would probably have to make my own prev object and send that instead. I'm updating AlterBar to have some more options and prettier output... so I'll look at adding a prev object somehow to the callback to HealthColor.
i fear i have opened a can of worms here, thank you both so much for looking at this :)
DXWarlock said: Ah I think I see why, there is no prev in your script to send. So the FX is seeing: if(curValue == prevValue || prevValue === "") return; And returning. Since it has no prev value to do the math to see if its a hurt or a heal for the FX. You know a way to get the prev of an object other than on the&nbsp;on("change:token")? If there is a way I can just change mine to work from the object passed to figure out the prev. Looks like the only thing you need from the previous object is the bar values, which should be easy enough to send. Testing a simple fix in AlterBars now.
And that solved it. Pushing an update out on my AlterBars script that you can find here:&nbsp;<a href="https://app.roll20.net/forum/post/4741812/alterbars-2-dot-0-new-and-improved" rel="nofollow">https://app.roll20.net/forum/post/4741812/alterbars-2-dot-0-new-and-improved</a>
1488975154
DXWarlock
Sheet Author
API Scripter
WHOO!&nbsp; Anything I can do on my side to make it easier to be compatible?
DXWarlock said: WHOO!&nbsp; Anything I can do on my side to make it easier to be compatible? Nah, it was easy enough. I already had the token object so saving the current value before the script alters it was easy.
That is amazing, thank you both so much
1489189972

Edited 1489191286
DXWarlock
Sheet Author
API Scripter
Here you go Mike: 1.3.2 &nbsp;: Separate&nbsp;PC/NPC dead: You can now toggle "Show Dead" for NPCs and PCs independently. Separate start percentages for PC/NPC toggle: Changed popup to ask for 2 percentages for when health indication starts.&nbsp; Reorganized menu so it follows the same pattern of PC then NPC.
Wonderful script! This is something I might finally switch to in order to replace the bloody-ing script I have on all my campaigns. Just one little question I do have, is if it's possible to make it so that the script only uses a &nbsp;singular aura, or you can specify which aura is used? I only ask this because sometimes my players need to use the auras for AoE effects (such as Spirit Guardians in 5e, or paladin aura).
1489299992

Edited 1489300002
DXWarlock
Sheet Author
API Scripter
You can switch it to use the tint instead if that helps. So the auras aren't used.
Well, I do want to use the auras, but it'd be nice if I had the option to use only one of them rather than both (since the script uses both by default). I would prefer not to use the tint since it is a bit of a distraction. Perhaps it's just an aesthetic nitpick.
Hey there, I went from version 1.0.3 to the latest one and now the script seems to always hide PC names regardless of whether "PC sees PC names" is set to Yes, No or Off. Am I missing a setting?
1489330794
DXWarlock
Sheet Author
API Scripter
I can make a custom one for you Pakki, its just one line to remove depending on which aura you want to keep. it should be working Brother Sharp, I cannot get it to replicate that for me. You can PM me an invite to the game I could take a look if you like when we both have time.
DXWarlock said: I can make a custom one for you Pakki, its just one line to remove depending on which aura you want to keep. it should be working Brother Sharp, I cannot get it to replicate that for me. You can PM me an invite to the game I could take a look if you like when we both have time. That would be neat then ^^ We usually use aura 1 for everything in my campaigns.
Brother Sharp said: Hey there, I went from version 1.0.3 to the latest one and now the script seems to always hide PC names regardless of whether "PC sees PC names" is set to Yes, No or Off. Am I missing a setting? I am having this same issue, was driving me nuts haha, good to see I am not alone :P On 1.2.0 no issue.
1489366849

Edited 1489367317
DXWarlock
Sheet Author
API Scripter
Hmm one of you invite me to your game? I cannot seem to replicate it. Created a clean new game, copied the script and setup some tokens, name toggles works OK for me. Wonder if its a issue with the state variables.
I copied the script into a game that did not previously use it and it seems to work fine. Three of my games where I previously used earlier versions of the script seem to not work properly. I will send you an invitation later, however in the meantime is there a method to clean all variables used by a script in a campaign? Merely changing the slot and name in the API editor does nothing obviously.
1489367658

Edited 1489367864
DXWarlock
Sheet Author
API Scripter
Only thing I can think of is when I change it to use its own namespace to be more compliant. It might have confused it on older versions. Change this one line on line 11 should do it: &nbsp; &nbsp; &nbsp; &nbsp; schemaVersion = '1.0.3', Changing it to anything else should delete the whole HealthColors state and reset it. You will get the debug message the scheme was updated. So change it to something like 1.0.0 save it, then back to 1.0.3 and save (just so your back to matching in case I update). I'm sure there is a cleaner way, but that's the easiest without making you add lines that delete the state, and then remove them again. I suppose I should put in a commented out line that can do it incase someone will need it..then they can just un-comment, save and re-comment.
This is amazing.&nbsp; Any chance the we can change the full health "color" to being just the regular token? and then slowly going to orange and then red? The green tint ruins a bunch of portrait style tokens.
Just found this script today, it's awesome! I can tell I'm going to be using it in all my games going forward!
1489374445
DXWarlock
Sheet Author
API Scripter
Craig said: This is amazing.&nbsp; Any chance the we can change the full health "color" to being just the regular token? and then slowly going to orange and then red? The green tint ruins a bunch of portrait style tokens. Change the percentage of when the colors kicks in, and it wont start until that percentage. So say set it to 50% and it will remain off until at 50% health, or 90% for 90% etc.
Yeah, I changed the options to reflect changes after 50%. However, sadly, the FX don't kick in anymore above 50%. I wish they did. I like the healing and blood effect.
1489384532
DXWarlock
Sheet Author
API Scripter
Are you on the latest version? I had a couple people PM me about them showing up regardless of percentage so I changed it. FX should spawn regardless since the last version.
1489386333

Edited 1489386576
DXWarlock
Sheet Author
API Scripter
@ Pakki Here you go :) It wont do anything with aura 1. Only 1 Aura Custom Also for general usage: 1.3.3 : Added !Aura Reset command to delete/rebuild state.HealthColors if needed.
With the addition of reset, I was able to toy around and found what seems to cause my problem. When I toggle the "Show PC Health" to "No" it seems to reset the token's "Show Nameplate" and the view permissions of Name to false. In my games I primarily use health aura for NPCs (as players can view each other's bars). When I installed it on the fresh game I did not turn the "Show PC Health" to off. At this point the option regarding "PC sees all PC names" seems to be irrelevant.
1489401106
DXWarlock
Sheet Author
API Scripter
AHH I see why, The change I made for the player/monster toggles for each causes it. &nbsp; Its not triggering the part that pull the info for monster/player with it off..so it sets it to 'nothing'. Give me about 10 minutes I think I know how to fix it.
1489401419

Edited 1489402520
DXWarlock
Sheet Author
API Scripter
Give it a try now I just pushed a tiny update. I really need to rewrite that whole part today if I can, its a code mess from me adding on requests on top of requests to separate players from monsters on options and my JS proficiency is garage tinker at best :). Lot of redundant and 'not logical' order of operations trying to get them all to play nice with each other.
Thank you for the update, it has fixed the issue and the PC name settings are working properly. Try not to stress yourself too much, I would have still used this even if it did not differentiate NPCs from PCs all those extras that you add just make it even better.
1489402476

Edited 1489402630
DXWarlock
Sheet Author
API Scripter
Not a problem at all :) If I make it a public script and add things people ask for, I might as well make it actually work like I said it does, mostly, LOL. I'm just flattered people are using it, it started as a cheap 'hack' for my players to help remember who was hurting what in a 10+ mob count battle.