Try to create the monster's HP bar!

https://answers.unrealengine.com/questions/ask.html

Hello. First, I followed a video clip of C ++ on YouTube, connected to Progress Bar.
They said that the player’s index(Get Player Character) is only given to the player…

The monster’s HP also wanted to connect like this, so I don’t know what to add to it.
Just plug in the Cast To Monster before Get Current Health, so it won’t work …
How should I connect? Monster’s parents class is Character class.

And how do you use the Add Component - Widget in blue print?

most people will tell you to implement an interface. I personally find them confusing and hate using them in blueprints.
The first thing to do is, somewhere in youre enemy blueprint, you either have this as a component, or are creating it and adding it to the viewport. If the latter is the case, then right click on the blue return value from the create widget node and choose promote to variable. Call it something like MyHealthBar

After that, go to the widget blueprint for the health bar and add a new float variable called barFillAmount, make a new function called refresh bar, and make a new input for that refreshBar function called updatedHealth.

here is what the function will look like

210467-capture3.png

and heres what GetPErcent0 will look like

go back to youre enemies blueprint, any time you add or decrease health, youre going to call that refreshBar function on the healthbar variable.

Thank you for your kindness. But it’s not working …The explanation is difficult for me.