Enemy health bar

I used a youtube tutorial to see how to make enemy health. I am now able to shoot an enemy tank, and when it gets shot 10 times the actor sprite disapears as it gets destroyed. all i need to do know is able to implement that health of the tank (which is invisible but there) into a health bar widget i made. the problem is i don’t seem to be able to use variables from different places in those blueprints. i will show screenshots to understand better

In UMG widget create reference variable to your tank. Set it after widget creation to your tank object. In that way you will have access to tank variables from widget level.
All you need to do is bind variable from tank to your progress health bar.

I am sorry I don’t understand what you mean. could you explain in a bit more detail or use pictures in your answers, I am just a beginner in unreal and don’t understand what you mean :frowning:

So…

  1. I see that your tanks blueprint is called TankBP
  2. In your UMG Boss_HP go to Graph
  3. Add variable of type TankBP and make it public (click the eye next to variable) lets call it tankBPRef
  4. Now a little problem - you have a progress bar, progress take variables in range 0.0 - 1.0. You health is integer in range 0 - 10. My suggestion is to add float variable to Boss_HP and each hit update it by deviding it by max health. In that way you will get percentage of health. Lets call this variable procHealth.
  5. Bind progress bar Percent variable to tankBPRef.procHealth.
  6. I dont know when you are spawning Tank and when you are creating widget, but when both are on scene you need to set tankBPRef from Boss_HP widget to tank on scene.