Realistic injury animations

I want to be able to have a NPC that when he is in 100% health he can walk, run, etc problemfree, and if I shoot a line trace by channel on his right leg, he will from there on walk with a limp.

ATM I can shoot the NPC with a linetrace in a weaponblueprint. From the linetrace I can detect what bone was hit, and subtract health from the NPC. But I have no idea how to set this up in the animations ot make it all work.

Make a new set of states in your state machine, that have the same transition rules as the regular states, but add a bool to each transition to check if the player is hit in the leg. Then you just hook up alternative animations to the states and your done.

I got this set up. Not exactly the same as the regular states because unlike the regular ones, i dont want the NPC to be able to return to regular states after he is injured. Here is how it looks:

here is how it looks inside the state “injured leg”. its a blendspace there with the animation “walking injured” and “idle injured” that blends together.

How do I set up the variable in the weapon blueprint that defines the bool? Here is how my noob-instinct wanted to do it, and it didnt work:

hahah omg yes it WORKED!!! =)

I actually had that same thing in the animation blueprint, but I put it in a different place. I changed it to the place you had it, right after the “anim” red event thing and it works now. :slight_smile:

Amazing thank you a lot! I been trying to get this to work since yesterday.

okay i ran into another problem now. what if I want more animations? i have 1 animation for “left thigh hit limp”. which animates the NPC with a limped left leg. but i also have a “right leg limp”.

i tried setting it up like this but it only worked for the left leg. when i shoot the right leg, he goes stiff and into his T-pose.

As long as your cast does not fail, what you got should work so far. But then you still need to do the following:

You need to grab the Bool from your Animation Blueprints Event Graph. You can either cast to your character directly if you have a ref to it, or you should be able to use the “Try get pawn owner” node. Then just move the Value from your characters bool Var into a new Bool Var that belongs to your AnimBP and is used in the transition rules. (IsLimp)