How to bind Health Bar Widget to an enemy

Hello my friends. My character and enemies are derived from the base character. I was able to bind the health bar of my character using the “get player character” operation. However, what do I need to do to create the health bar for enemies?

Hey!
We can aprouch this issue in a couple of way..

One easy way is creating a function inside your widget that allow you set some custom variable OwningBaseCharacter (BaseCharacter Type), this will by pass the cast, which is good…

The the key for this work is: create the enemies’s widget on its character Event BeginPlay and call the SetFunction… WELL DONE! This will work great.

WIDGET:

BaseCharacterClass:

The great about this is: You can use the same step to initialize the main character widget and avoid cast every single frame

1 Like

thank u sir