Health Bar not updating when being damaged

My health bar is not updating when the player is taking damage. Only when he dies does the health bar update correctly. Any thoughts?

While this is all the logic for calculating the health. Where is the logic for displaying ?

-m

BEcause the health bar works on a 0-1 for 0% to 100% filled.

You have health as 100. You need to divide that by 100 in your binding.

Also your max health/health will cause issues.

Hope this helps

Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

The health bar is displaying properly :slight_smile:

Well,…now I’ve a full picture…

The problem might be actually from the PlayerHealthWidget. As you divide the MaxHealth over the Health var.

Let’s say Max health is 100 and Health is 50 (that means we should see half of the bar).

100/50 = 2

But the float value of a bar is a value between 0 & 1, which means 2 will be treated as a 1 and ow a full health.

In that case yo to do:
Health / MaxHealth

which in my example 50/100 = 0.5 (half filled bar)

-m

Hi Ns,

I changed “Health” to “CurrentHealth”. With regards to dividing

the health by 100. Are you talking about the health widget nodes?

Awesome!!! Fixed!! Thank you very much Mamoniem!! Now I just need to sort out why my crouch attack is playing the wrong animation when firing :stuck_out_tongue:

Hi NS, I have fixed it! Thanks for your response!

Sweeeeet!!

Don’t forget to thumb up my comment :slight_smile:

-m

thanks mamoniem this helped i was getting so frustrated!