A basic health system is easy enough to put together in Unreal Engine. Add a Health variable, subtract some damage, and call a death event when it reaches zero. That's usually where most people start.
The interesting part is what happens afterward.
What if an enemy takes another hit while its death animation is playing? What happens when damage exceeds the remaining health? And why does a character sometimes go straight back to its idle pose after dying?
These aren't particularly complicated problems, but they're worth handling early.
Start with the damage event
For a straightforward setup, Unreal's built-in Event AnyDamage does most of what we need. It receives the damage amount whenever another Blueprint calls Apply Damage on the actor.
Before doing anything with that value, I like to check two things: whether the character is already dead and whether the incoming damage is actually greater than zero.
There's no reason to process another hit on a dead character, and allowing negative damage can produce some strange results if you aren't expecting it.
Once those checks pass, updating health is simple:
Health = Clamp(Health - Damage, 0, MaxHealth)
Using Clamp here saves you from dealing with negative health values later.
Keep hit reactions separate from death
One thing that's easy to overlook is the order in which animations are triggered.
If you play a hit reaction every time damage comes in, including the hit that kills the character, the hit and death animations can end up fighting over the same animation slot.
A cleaner approach is to update health first and then decide what happens next.
If health is still above zero, call GetHit. Otherwise, call DeadEvent.
This also keeps the main damage graph relatively small.
What should happen when the character dies?
For a basic system, I usually start with three actions:
Set
Is Deadto true.Disable character movement.
Play the death animation.
That's enough for a simple prototype, but there's a small catch: Disable Movement doesn't disable everything.
If your character can attack, interact with objects, or perform other custom actions, those systems should also respect the Is Dead variable.
There's also the animation itself. Depending on your Animation Blueprint setup, the character might return to its idle pose when the death montage finishes. You'll need to handle that separately if you want the body to remain in its final pose.
The Blueprint setup
I've put together a small example using three graphs: Damage Handling, GetHit, and DeadEvent.
Nothing particularly fancy, just a clean starting point that covers incoming damage, hit reactions, and death without turning it into an entire combat framework.
You can inspect the graphs and copy the Blueprint nodes directly from the library:
Simple Health & Damage System – UE5 Blueprint
The example is intended for basic single-player projects. Things like multiplayer replication, armor, regeneration, and respawning are deliberately left out.
Sometimes it's better to start with a small system you fully understand and build on it as your game actually needs more features.
Comments (0)
Join the discussion with other developers.
Login to CommentNo comments yet. Be the first to share your thoughts!