Health bar not updating to boss health

So the health bar i made for my boss enemy checks if the interface im using is initialized and if it is it will update, but its not initializing. Any thing im doing wrong?

I already gave the boss bp its interface and set up its health yet its not working at all.
image

image

image

image

I could be way off, but I think your player implements the interface, not the pawn?

image

( really depends how you’ve implemented everything )

It shows the health but it still doesnt initialize it so it can update

It is being initialized yet its still going into false

i’ve tried:

-Get owning player
-Get player character
-Get ai controller
-Get owning player pawn
-Even casting directly to the enemy bp
all have the same result

Is the widget made before the player exists?

After i believe

The health is working correctly its just not wanting to update

Does it evaluate to true? ( check with a print string )

image

Have you found the right thing to test?

Ah, get owner returns the controller…

How about?

( or whatever your player is ). Then it will support the call.

I’ve tried all of these and still nothing

image

When i tried to cast to the bp itself, the cast fails

I plugged all the nodes in the first pic into the cast object and the casting failed on all of them

It works for me.

You have to cast the actual player you’re using.

Isn’t that your boss thing?

wait so the boss health i would need to add the viewport into my main character and then implement the interface aswell?

The main player, the one who has the player controller, the one you added the widget to. Cast to that player type.

All widgets are on your main player. You can’t put a widget on your bosses viewport, unless it’s multi player or something.

I’m sensing a bit of confusing here, conflicting goals.

  1. A blueprint interface is used to talk from one actor to another when you don’t know, or don’t want to know, what kind of actor it is. If you’re doing any casting, you might as well not use it.

  2. Sometimes people use event dispatchers with widgets, to avoid the way they are bound on tick. But that also doesn’t really matter when it’s just a health bar.

If you can tell me in one sentence what you’re trying to do, I can explain a simple method.

Something like ‘I want to see my players health and the bosses health in the viewport’

Thats exactly what im trying to do. I want to see the boss(s) health and my health on the screen working accordingly

I created the event dispatcher and im getting the same result but i did find that casting to the enemy’s bp is failing for some reason, so i’m assuming everything is due to something being wrong with the boss bp?

image

(Also, i added the boss health bar to the hud widget)

You can never cast to the boss from your widget, because the widget is being shown to your player.

So you just have one widget with both health bars in.

For your player, you can use ‘get player character’, but for the boss, you’ll something like

Is there a reason why this has to be convoluted and ticking and firing functions every frame.

What if I:

  • in the widget:

  • and then in the boss:


  • boss creates the widget
  • boss gets hit with Any Damage, updates its health
  • boss sends health value to the widget
  • ???
  • profit!

No ticking, no interface, no casting, no function binding, no blueprint spaghetti.


I might be, of course, assuming too much - no idea how complex you need this to eventually become.

1 Like

Thank you this solved the problem and now everything is working like suppose to!