Help with custom pawn animations playback

Hello guys!!!

I need a small help with unreal scripting.

The enemies in my game have custom animations for hit damage, like hit left leg, hit right arm, and so on.

I trigger these animations in my Pawn’s code on the take damage event, like this:

      if(HitBone == 'b_LeftToe' || HitBone == 'b_LeftAnkle' || HitBone == 'b_LeftLeg' || HitBone == 'b_LeftLegUpper')


      `Log("Left Leg Hit Impact Damage");

       FullBodyAnimSlot.PlayCustomAnim('hit_left_leg_UT3', 1.0, 0.35, 0.75, false, true);

The code works well, it always plays the hit animation, however, the gun that these enemies hold has a function inside function FireAmmunition() to play a shooting animation on the pawns body on the top half slot:

simulated function RifShootAnimPawn()
  TopHalfAnimSlot.SetActorAnimEndNotification(true);            //loop
  TopHalfAnimSlot.PlayCustomAnim('idle_ready_rif', 1, 0.15, 0.25, false, false);

And the problem is that many times the hit animation is played in the full body slot of the pawn (enemy), while the shoot animation keeps playing in the topslot, and this makes the animation look weird.

I think that the funcion **TopHalfAnimSlot.StopCustomAnim(0.15); **which I called just before playing the hit animation is not working well, it does not stop the shooting animation.

Any help?

I’m a bit rusty with animtrees. Is there a blend node that’s accessible from UnrealScript? You could have two animation chains, one for being shot and another for not being shot, and then control the node’s blend strength or alpha or something like that.

Hello dude, thanks for the tip. However, I think it has to do with blend in and blend out properties of the function PlayCustomAnim(). What you told me I have already done for creating two states of the enemy walking, which is walking normal and walking injured using Enum var and blend by property node (you gave me this tip some time ago) :cool:.

The question is that I need to completely stop the TopHalfAnimSlot shooting animation before playing the FullBodyAnimSlot Hit reaction animation.

Thanks :smiley: