Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make opponents health bar color change when they're in danger? (AKA when they're danger/death icon is showing) #11296

Closed
luigiman0 opened this issue Nov 23, 2022 · 8 comments
Labels
question Further information is requested

Comments

@luigiman0
Copy link

What is your question?

Is there any way using a lua script to change an opponents health bar color while they're death icon is showing?

@luigiman0 luigiman0 added the question Further information is requested label Nov 23, 2022
@luigiman0 luigiman0 changed the title How to make opponents health bar color change when they're in danger? How to make opponents health bar color change when they're in danger? (AKA when they're danger/death icon is showing) Nov 23, 2022
@Mokona5901
Copy link

What is your question?

Is there any way using a lua script to change an opponents health bar color while they're death icon is showing?

maybe something like :

function onUpdate(elapsed)
	if rating >= 0.8 then
		setHealthBarColors(leftHex:String, rightHex:String)
	end
end

i forgot if 0.8 is the good rating for winning
replace leftHex and rightHex by the opponent and bf wanted hex colors

@Gostar64
Copy link

I think it should be

if getProperty('health') >= 1.6 then

instead of if rating >= 0.8, since they're talking about the opponents death icon

@luigiman0
Copy link
Author

image
Tried using the first script by Mokona5901 with the "if" thing Gostar64 made, but I keep getting this error. How do I fix this?

@Mokona5901
Copy link

image Tried using the first script by Mokona5901 with the "if" thing Gostar64 made, but I keep getting this error. How do I fix this?

Did you replaced leftHex:String by someting like '000000' for black ?
(I hope you didn't wrote something like leftHex:'000000')

@Mokona5901
Copy link

I think it should be

if getProperty('health') >= 1.6 then

instead of if rating >= 0.8, since they're talking about the opponents death icon

Idk I think rating goes from 0 (death) to 1

@Mokona5901
Copy link

Wait I'm dumb, rating is different of health, so I think Gostar64 is right if health goes from 0 to 2

@luigiman0
Copy link
Author

image Tried using the first script by Mokona5901 with the "if" thing Gostar64 made, but I keep getting this error. How do I fix this?

Did you replaced leftHex:String by someting like '000000' for black ? (I hope you didn't wrote something like leftHex:'000000')

I did try writing leftHex:000000 lmao

gonna try not doing that and see if it fixes it

@luigiman0
Copy link
Author

function onUpdate(elapsed) if getProperty('health') >= 1.6 then setHealthBarColors('opponenthex', 'bfhex') end if getProperty('health') <= 1.6 then setHealthBarColors('opponenthex', 'bfhex') end end

This is the final script I came up with, using a combination of the previous scripts, as well as the new info Mokona added.
Replace opponenthex and bfhex with the hex codes for the colors you want.

First part is for when the death icon is showing, and the second part is for when it's not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants