Playing a random Death Animation in Unreal Engine

- by

When a character dies, we can play a death animation either as a montage, or via the animation blueprint. In this quick tip I’ll explain the latter principle. We typically have a boolean (like “is dead”) that checks if the character has died, and it’s true, we’ll transition to a new state in our state machine (like the “death state”). Here’s what this might look like:

There’s no way to come back from death, so we only need a transition one way that checks for the death value.

In the death state, we can plug multiple animations into the Blend Poses by int node, which when provided with an integer value, will play the attached animation in the current slot. I’ve plugged in 4 in total, and provide he Death Index variable (a random number between 0 and 3). Each animation can be blended into the current one individually, it’s really neat!

If you need more poses, right-click the node and choose “Add Blend Pin”.

Creating the Random Death Index

Be mindful to only set the variable for the Death Index once, as hooking into the Update Animation Event will be called on every frame. Here’s an example that will avoid issues:



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment