I have been playing around with Blueprint recently and I have been trying to learn how to create a Health System for the player and also impliment that health system within the HUD. I have had little success myself in attempting this so far. I have followed a HUD Tutorial on YouTube from TeslaDev so I have been able to get something to appear on the HUD when I hit a trigger but I would like a HUD that is constantly there showing the players health and does not dissapear when I enter or leave a trigger. Obviously I would like things to appear on the HUD when I hit triggers but I already know how to do that. For the time being I would be happy with a simple health system appearing on the HUD but do have plans on expanding later on so if any of you guys know how to impliment something like this then please help me. I have left screenshots of what I have achieved so far with the trigger HUD.alt text
You can see a working example of a simple HUD created in Blueprints in the Content Examples sample project. Open that project and then open the Blueprint_HUD.umap level. You can read a bit about how it works here:
The main thing to take away from this is that in your Game Mode’s HUD Class Blueprint, you want to have your Draw Text node to come off the Event Receive Draw HUD node directly if you want it to appear all the time. As you have it now, it is only called when the Gate is open, which only happens after the Begin Overlap calls the Show Text event.
Hope that helps! Let me know if you have more questions.
Excellent! Thank you. I completely forgot about the example blueprints in the Content Examples. Thanks again!
I don’t suppose you would know of how I would change it to work on a number system rather then a health bar?
I’m not certain I know what you mean by a number system. Can you describe it a little more?
So instead of a health bar I have it say Health: 100
If i remember correctly, the Healthbar uses ScalarParmater to scale it from 0 to 100%.
This scale depens on the Health of the character. So, you must have a variable that is changed. I guess it’s just called “health”. Look what variable is changed by the healthpickup.
So to have the numbers instead of the texture, just use the Drawtext Node and plug the health variable from your character to it.
Remember DrawText can only be used in your HUDClass. You need to get the player Character, cast it to your CharacterClass and get the Health Variable from it, all inside the HUDClass.
As eXi mentions, you would use the same variable, Health Value, and just plug that into your Text input on the Draw Text node. Using the setup from the Content Examples map, it would look like this:
Thanks guys for your help! I really appreciate it.