Make text object dynamically change color based on Hp

Is this code supposed to be in one continues line?

Because if it’s supposed to be one continues line it would be

ToString(lerp(0,255,(Variable(Enemy.HP.HeadPercent)-0.6)*2.5))+“;”+ToString(lerp(255,160,(Variable(Enemy.HP.HeadPercent)-0.6)*2.5))+“;0”+“255;”+ToString(lerp(160,0,(Variable(Enemy.HP.HeadPercent)-0.3)*3.3))+“;0”+ToString(lerp(255,0,(Variable(Enemy.HP.HeadPercent))*3.3))+“;0;0”

Or was it supposed to be like this.

Your first one is correct - each one on a separate line

image

though you will need to calculate headPercent before the actions. Maybe in the action of the event with the condition The scene variable Color.Head = 1.

Was this what you were talking about.

The colors are changing backwards.
First Black then dark orange to yellow then red to light orange.

13 12 11 10 9 8 7 6 5 4 3 2 1

I put calculate headPercent in the action of the Punch condition.
So that every time the enemy takes damage it also calculates headPercent.

wtf dude, you already got a working formula

if you did not understand, why did you not ask?

That’s getting a lot closer. It’ll just be tweaking the numbers. And good idea on setting headPercent on the punch condition. It has a typo though - you should divide it by Enemy.HP.HeadMax

Also, you’ve got a ‘;0’ missing from the third event that changes the colour.

Try those fixes, and see how it goes.

all you needed to do is give your enemys the stats, and the formula works perfectly.
if you dont want to do that, just change the variable to whatever you are using atm.
i really do not understand why you dont ask.