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

DXWarlock said: Hmm, does it act that way with my script disabled, or only when its enabled? I cant seem to simulate that on my game or my test game.  Hiya, tried to make a copy out of the game in pure frustration and then it worked.... I have no idea of why. Anyway it works fine with the copy! ( My guess is that I've been laborating with a lot of scripts lately and somehow managed to break the state object or something )
1488194444
Ziechael
Forum Champion
Sheet Author
API Scripter
Loving the changes to one of my favourite scripts so far... any legs to being able to set particular tokens to be 'bloodless' (skeletal undead, constructs and the like)? 
1488200946

Edited 1488201596
DXWarlock
Sheet Author
API Scripter
You mean disable the blood on specific tokens, or change the blood color on specific tokens so its not blood colored? Edit: Actually thinking on it, I could do both. 2 Birds with one stone of sorts. Add a second attribute it creates for blood. Default it does what it always does, if a color is put there use it instead, if 'OFF' dont do any blood. If I'm going to have to make an attribute to disable on certain characters, might as well make it work so if it sees a hexcode there make custom blood color for that token. That sound like a workable solution?
1488204350
Ziechael
Forum Champion
Sheet Author
API Scripter
Sounds great to me :)
1488206960

Edited 1488207162
DXWarlock
Sheet Author
API Scripter
This is getting way more encompassing than I thought it would when I started. :) 1.2.0: Added toggle/color option for spurt FX: New attribute called "BLOODCOLOR". Set to DEFAULT on creation. Changing to " OFF " disables blood spurt for that character, putting in a 6 digit hexcode changes the color for that character. So now you can have red blood, green ooze, white..bone shards I guess, black..goo stuff. whatever you wish as the damage effect on characters, or just turn it off totally per character.
1488208722
Kirsty
Pro
Sheet Author
This is so cool. My players are going to love it!
My players wanted me to express our gratitude for this script!  We all were amazed at how quickly you tweaked the layer issue we were experiencing.  Thank you ...and keep up the good work!  We are fans.
1488213941
Ziechael
Forum Champion
Sheet Author
API Scripter
Legend, that colour option will make the myriad hordes my players come up against a LOT more interesting :) Thanks!
1488282848

Edited 1488282920
Ziechael
Forum Champion
Sheet Author
API Scripter
For anyone wanting to either change blood options on the fly or simply make it part of their token set up process I've thrown this together using  ChatSetAttr : !setattr {{ --sel --BLOODCOLOR|?{Blood Colour?|Default (Red),DEFAULT|Off,OFF|Other,?{Colour|Black,000000|Green,008000|Blue,7F7FFF|Purple,800080|White,FFFFFF|Other,?{Hex Code}}} --USECOLOR|YES }}
1488283476
TheWhiteWolves
KS Backer
API Scripter
Hey, Just giving the script a quick try and encountered an issue. Now its a strange one and I have a few guesses to the origin but whats happening is when I do some damage/heal on one of my monsters the API throws out the below error. TypeError: Cannot read property 'match' of undefined at hex (apiscript.js:1713:28) at handleToken (apiscript.js:1440:61) at eval (eval at <anonymous> (/home/node/d20-api-server/api-dev.js:146:34), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api-dev.js:146:34), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api-dev.js:911:16) at updateLocalCache (/home/node/d20-api-server/api-dev.js:1194:18) at /home/node/d20-api-server/api-dev.js:1378:11 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) From a quick look at the code I think it might be from line 120  if (UseBlood !== "DEFAULT") HurtColor = HEXtoRGB(UseBlood); it tries to pass across the UseBlood value but I suspect this is undefined as the token that causes the crash is not linked to a character sheet and thus probably doesn't have a UseBlood attribute. To explain about the token that is causing the crash it is just an image token I quickly dropped onto the page and gave it HP, AC and XP values on the bars and a name, but nothing else, thus why it has to character sheet to pull an attribute from.
1488288945
The Aaron
Pro
API Scripter
You're right!  I should have put (hex||'').match in there...
1488300971

Edited 1488302728
DXWarlock
Sheet Author
API Scripter
That was it, good find! I tested it on linked tokens to characters, linked tokens to non-assigned characters, but not a non-linked 'one off' set to on character for the FX when I added the color option. It should be fixed :) Sorry about that. Added The Aaron's change, and changed it so if its undefined it shouldn't try to call it to start with. Was more my fault trying to call the code snippet Aaron gave me, than his code. Was also causing it to making non-linked tokens blood black if one off was on, should be whatever you set it to on the menu again also..
1488302893
Zym
Sheet Author
I've used this API for a long time. I really enjoy this for all its ttrpg goodness. I love the new fixes, heal and blood. I also noticed a bug (which I was always to lazy to report) has now gone. [GM sees player names was not working]
Is it possible for it to add blood if say something drops from 20 to 0 and just seeing a X? The work around i do is 20 to -19 then -1 so the X is there. 
1488319303

Edited 1488319806
DXWarlock
Sheet Author
API Scripter
I'm sorry, Not quite sure I understand what you mean.  You are having to go from 20 to -19 to -1 to get the X to work? edit: OH I see, Aaron explained what you meant. When it dies to show the X, also show the spurt. Got it. I changed it, see if that works for you how you expect.
1488362171

Edited 1488362222
Ziechael
Forum Champion
Sheet Author
API Scripter
Just a note to let you know that my players LOVED the blood spurts, weirdly they weren't as excited by the healing glow but I guess they are just sadistic... was a lot of fun when the Lich Lord they were fighting didn't bleed and they realised that he wasn't just a middle-aged human with a bad temper after all!
Ziechael said: Just a note to let you know that my players LOVED the blood spurts, weirdly they weren't as excited by the healing glow but I guess they are just sadistic... was a lot of fun when the Lich Lord they were fighting didn't bleed and they realised that he wasn't just a middle-aged human with a bad temper after all! Heh that's awesome.
1488368830
DXWarlock
Sheet Author
API Scripter
Whoo! Glad they liked it!
1488378589
TheWhiteWolves
KS Backer
API Scripter
Just to confirm for you, its working now, looks awesome and can't wait to introduce it to my players in our next session.
One of my favorite scripts just keep getting better. :)
Would it make sense to include options in this script to prevent hit points from dropping below zero or healing above maximum? I mean I obviously can add those options myself with my own scripts, but was just thinking since this script deals with healing and such already, might make sense to include them here instead.
1488470306
Kirsty
Pro
Sheet Author
I used the new version with players for the first time last night and they LOVED the special effects! One very small thing that we noticed is that if the percentage is set to anything less than 100% and a character is healed to full, the healing effect doesn't show up. 
Another small request... vary the angle slightly so that the VFX doesn't always go straight up.
1488508708

Edited 1488509166
DXWarlock
Sheet Author
API Scripter
@SkyCaptainXIII Not sure I want to get into actually adjusting core characters attributes. Right now it just reads them and gives a visual indication of what they are. I think delving into game mechanic attribute manipulation would be out of the scope of the script. There is a few scripts that already cover attribute setting, but if a few people wanted it I suppose I could add it. For the angle I'm running it at 180 for random angle now (but with the speed to get it moving vs just floating off like the heal, they all go out and up in a fan shape). I did an upward "fan" because some people use topdown tokens, and some isometric/side angle ones. A balance of what looks 'least worse' on both for a blood spray was an upward fountain type. @Kirsty That's by design currently. If the players aren't suppose to know the full range, my logic was they shouldn't be able to gauge by size of blood spurt or heal how many HP it has and if that hit was a 'substantial hit or heal'. It only works up to the point where the aura goes away also. Id be happy to change it, just not sure what the consensus would be from the other people if they want blood/heal on "not knowing full range" characters.
1488547435
Kirsty
Pro
Sheet Author
Ah, I see. That makes total sense! I'm happy with the script either way. :)
1488555703

Edited 1488556602
Bill
Pro
Just added this to a new campaign i'll be starting shortly. I'd like to use the Death Sound feature, but I fear the same sound effect on every death could get repetitive. I'd love the ability to provide a comma separated list of sound names that the script would then just play a random one.  EDIT : Threw this together for your consideration. The below does introduce a bug/exception if the name of track has a comma in it, obviously it would erroneously trigger the random selection, but i'll leave it up to you if you think it's worth extending this or using a different delimiter (a pipe perhaps?) PlayDeath = function(trackname) { //Pull random track if a list is provided if trackname.indexOf(",") > 0 { tracklist = trackname.split(","); trackname = tracklist[Math.floor(Math.random() * tracklist.length)]; } var track = findObjs({type: 'jukeboxtrack',title: trackname})[0];
Honestly, I'd vote against expanding the scope of this script to encompass death sounds, especially when the functionality is already handled by other, existing scripts exceptionally well, e.g.  Roll 20 Audio Master .
Not sure if this is a bug or intended behaviour, but when updating my game to the latest Aura version, I found that "Show on PC" is no longer being respected unless I change the USECOLOR attribute to NO. I'm hoping this is just a bug as while my players prefer to only have the auras be on NPCs, I do believe they would enjoy the new blood and heal FXs, however these only seem to work if the token has USECOLOR set to YES which currently means that they have an aura automatically atm. Hope that someone can help with this as I've really enjoyed using this script over the past few months, my players find it very helpful.
Love the idea of a variety of sounds for the death. Silly question, this update seem to have killed the link between the Alter token script and this one, has anyone found a workround?
Jon M. said: Love the idea of a variety of sounds for the death. So do I!
1488703284
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
No real comment, just wanted to say thanks again. The players are loving it, and we got a big chuckle when the fire elemental they were fighting started spurting blood!
1488767209

Edited 1488769926
DXWarlock
Sheet Author
API Scripter
Both added: 1.2.3: Random Death Sounds: No longer singular option. A randomly picked from comma delimited list of death sounds you want to use. Independent Hurt/Heal FX: FX no longer tied to if specific token uses aura or not.
Awesome.
keithcurtis said: No real comment, just wanted to say thanks again. The players are loving it, and we got a big chuckle when the fire elemental they were fighting started spurting blood! There should be a way to use a fire type fx and maybe mix in some smoke.
1488770102
DXWarlock
Sheet Author
API Scripter
Small update not worth listing, but mentioning. Since its a list of sounds now. It will show in console the name of the track if it cannot find it to help troubleshooting. "HealthColors: No track found named DEATH1"
1488770500

Edited 1488770727
DXWarlock
Sheet Author
API Scripter
SkyCaptainXIII said: There should be a way to use a fire type fx and maybe mix in some smoke. Hmm not actually sure how I could do that, without making some complex input system people would have to define their own custom FX values for as another attribute, and store FX values per token.Or have to define them in the custom FX menu themselves in the toolbar, and store that name of it on the token to call. But then the example you gave would be 2 FX to spawn at once. One for fire and one for smoke. Not sure off the top of my head an 'easy' way to define them per token for the players, and if more than 1, to know that and do 1+. If anyone has any ideas, Id be happy to try them.
I will poke around the script and see what can be done Tuesday. I have a friend's birthday and a game tomorrow.
Had a few moments here at work tonight (it's soooo slow ugh...) and I have some ideas. Nothing concrete, but you could create any number of hurt and heal fx definitions and add way to set which definition you use. I haven't tested it, but I'm pretty sure you can spawn multiple fx at the same time. So once you have your FIREDMG / SMOKEDMG fx definitions, you could just do a switch statement based on the type set in a similar fashion to usecolor, and in that switch statement, call both firedmg and smokedmg at the same time.
1488774067

Edited 1488774200
DXWarlock
Sheet Author
API Scripter
Oh yea, but I could see that getting out of hand quick. Without a way for people to add their own the list, over time ones people want to me add would be line wise over the size of the script itself :\ We add fire, someone wants ice, then a water, then a fog, then an earth, then one for ethereal damage..etc :) Way easier to give them the tools to make them how they want vs me having to always push updates for a new FX idea someone had for X mob. On top of that, if it gets accepted to the repo for one click, it could be a week plus before I new one I put in actually is usable.
Yeah. Which can be done. Just have them define the FX on the token's GM Notes and pull it from there and parse it.
1488774323

Edited 1488774403
DXWarlock
Sheet Author
API Scripter
Cant do that without problems I dont think, people use the GM area for other scripts variables. A few of them blindly read the whole thing expecting 'their' syntax in it. Adding that in there would cause theirs to error. like the mob importer would freak out if FX definitions was in the area. And I think I remember a one off one that stored food/sleep into it. (Not saying what they are doing is right, just I dont want to be the one to break their script even if its done wrong).
Then you could use a Handout the way I do in PowerCards for different card formats.
1488774960

Edited 1488775074
DXWarlock
Sheet Author
API Scripter
I could try it see how streamline I can refine the fx syntax to be 'readable text' format. If some the GM's are like the few I know that play in my game. They aren't 'code savvy' even as simple as the coding for FX is. They don't understand the FX syntax without messing it up trying to create one and have me help figure out where they had an extra space, or a comma here or there, or 2 part gravity where you need to define it as " gravity": { "x": 0.01, "y": 0.01 },. They break it 1/2 the time and just gave up and used the built in ones in their game. Trying to keep it as simple as possible. Where pushing a button does something. I was uneasy about doing the hexcode for color, since some people dont understand them ( had to explain it to my son that GMs what it is, and where to find out what 'dark red' would be online). Don't want someone not to be able to use a part of it, just because they dont know JSON/HTML/color codes like someone else that uses it.
1488775076

Edited 1488775102
I just gave them the options and let them figure it out and learn how to do it right. :D  And build in a failsafe and default option so the script doesn't crash.
1488775446

Edited 1488815693
DXWarlock
Sheet Author
API Scripter
Let me see what I can work out, and test it on my son. Hes the typical "PC gamer, online savvy but not code(ish) savvy.". And that's what I'm trying to avoid to an extent.The Powercards thread has pages of people asking for tips/how to. Not that its bad! Just I dont have that patience or time to reply to them all. I'm more about "It just works when you hit buttons".
Heh, Silvyre often jumps in and answers questions for powercards. He probably knows how to better use it than I do. :D
1488833117

Edited 1488833713
DXWarlock
Sheet Author
API Scripter
Talking it over with TheAaron I think we came up with the simplest solution! I can read customFX from the FX menu, so instead of having to make a confusing for everday user Array of JSON entries in a handout that would get unwieldy after a handful. People can just define them in the custom FX as normal. Then I can use the "BLOODCOLOR" attribute we have now to figure out if its a customFX to use. So the attribute options would be: DEFAULT #AAFFAA (New Option Example): Fire And the custom FX you named fire will be used. Logic for it will be: "If default use default, if matches custom FX name use it, if not any of those assume its a hexcolor." This way people that dont want to get into that area can just leave it as default, people that just want color changes can just use colors, and advanced users can define custom FX and call them. Will take me a day or 2 as I think I need to re-write how Im doing the FX so its not overly redundant code wise. And right now for the first version of that, Its going to be only one FX. Need to work out a reliable way to check if all the comma list is valid, and fire them all off vs a single default or color change
That is sweet. What about multiple FX calls for like fire and smoke? Will that be possible?
1488834251
The Aaron
Pro
API Scripter
Probably.  Would just need to have a comma separated list of them, something like: BLOODCOLOR: [Fire,Smoke]/[burst-holy,nova-magic]