Progress bar percentage is not correctly representing actual values

So I am making a First person shooter. In this fps I have made some basic enemies that have a health bar on top. The actual function (health decrease and death) are working fine. And the health bar was working correctly too. I set up the enemies so that they die in 2 hits (a total of 1 health, with 0.5 damage in each shot) and the health bar widget worked fine. What i cant get to work however is to reflect the health loss in a progress bar correctly when i increase the hits that are required to defeat the enemy. I am not increasing the total health, i am simply decreasing the damage per shot (from 0.5 to 0.25) In the first video i show the health bar widget working correctly when i am dealing 0.5 damage in each shot, killing the enemy in 2 hits. In the second video i show the health bar widget working incorrectly when i deal 0.25 damage in each shot (you can also see the health remaining after each shot on the top left corner)

In this screenshot is the variables that i use to change the damage per shot and the total enemy health.

Here is the bind in the widget blueprint, I suspect this is where i mess up,however i am not sure what is my mistake

And here in the enemy blueprint is the system that I use to decrease the health after each shot

Any help would be much appreciated

ok well first things first you dont need that cast node that you have in the widget (in the current implementation). also the way you are getting the health is a poor way to accomplish it since you are getting all actors of a class( this could cause issues).

why are you not using the built in damage systems? there are nodes for apply damage and event any damage. if you were to use those you could create a much more dynamic scenario.

to start try cleaning up the widget and see if that helps. if not we can work from there. or you could just set the value of the health bar manually as pictured below. make a variable on the health bar and bind that to the progress bar percentage. then whenever damage is applied just update the variable.

I didnt even know that these nodes existed, thanks for telling me!
I looked up some tutorials and most seem to use line trace to work with these nodes, however i use a projectile. So i assume that what i would have to do is to apply damage on event hit of the projectile and cast to the actors that i want for the apply damage node.so my problem now is what do i plug in, in the object thingy when casting(i feel like the answer is going to be simple but i cant seem to find it on my own)

This is in the projectile blueprint on the event hit.

When using the apply damage node you dont beed the cast node. If you look on you hit event node there should be a blue pin that says other actor. Just drag off that pin and plug it into the damaged actor. This way anything you shoot than can take damage will. I would post a picture but im on my phone right now

That makes sense. Ok so i got it to work with the apply damage and any damage but i am still not sure how to fix the health bar issue i mentioned above. (i didnt change anything in the widget yet, not sure what to change)

OOOK sooo i found my mistake.

Turns out i didnt scale the health bar to 100% so i could see the first hit effect the health bar…

…sometimes i question my sanity :stuck_out_tongue:

Thank you to ThompsonN13 though for taking the time to help me!