Health HUD

Hello, I was able to implement the Health and menu HUD from the content example. Menu works fine, the health bar shows up but there is no health in the bar. I have the health bar material in the folder, everything seems to be the same. Any help with this would be great!

Thanks,
Quigs

Kind of hard to say what the issue is, just by what you stated, but on an off chance, check that your character blueprint implements health and that a value has been assigned for it.

I found an error as I was going through the blue prints. Under Draw objective locator. Not sure if this has anything to do with it.

That error should go away if you compile the Blueprint, so that’s nothing to worry about. I think the issue here is that you either haven’t created a “Health” variable in your pawn for the HUD to read from, or you haven’t set up the Blueprint Interface the example uses to allow the HUD to read that variable in the pawn. So because it can’t find a value for health, it’s just stuck at the default zero.

Did you migrate the HUD Blueprint from the Content Examples project? If so, a Blueprint Interface asset should have come along with it. If you haven’t already, you’ll need to open up your pawn Blueprint, click the Blueprint Props button at the top, then where it says “Implemented Interfaces” in the bottom left you can use the Add button to implement “BPI_HUD_Interface_Events”. After doing that and compiling, you should see a “Get player health” function appear in the MyBlueprint panel, which you can double-click to edit. In there, you can just hook up your pawn’s health variable like this:

c1f18fd97a87db565175106b25e532241876a364.jpeg

And in the HUD Blueprint, the relevant part for calling that Interface function and getting the player’s health is here:

de82f2c65ce8acf930f33063ab223abde9462ac3.jpeg

So when the HUD calls that Interface Message with the pawn as the target, it’s getting the health value you hooked up and using it to update the scalar parameter responsible for filling up the bar in the health bar material. Hope that helps.

Thank you very much for the detailed reply, I will try it when I get home. Some of this is overwhelming at first when you are learning. Thanks for breaking it down for me.

Thanks again I missed the step where I had to add BPI_HUD After doing that and connecting the health it worked like a charm. Its really cool that you guys take the time to post on the forums to help us.