We’re a group working on a school project, and we’ve fallen into a little bit of a headache. The problem is that the healthbar (progressbar) doesnt update on damage taken.
Here is a picture of the blueprints that are suppose to update it:
The blueprint is written in the Character BP.
The “HP Main” float has a value of 100.
The widget (healthbar) shows up on screen.
The character DOES take damage, and dies after X hits from the enemy.
Im really at a loss right now, and Im hoping someone can aid me in solving this.
I plugged a print string inbetween the Cast and Set Percent, and nothing happend. When I plugged it into Cast Failed it printed.
So I guess the cast doesnt work. However, I dont see why. I made a exact set-up for the enemy and its health bar, and it works just fine! So something has to be wrong with that exact cast (“Cast to W_HUD” on main character).
A better approach is to go to widget graph > go to the bound function graph, from there do the same thing but instead cast to the blueprint where the player health is stored. And you should be just fine. This is the proper way to deal with a widget. In my example it is stored inside the character BP.