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')
{
TopHalfAnimSlot.StopCustomAnim(0.15);
`Log("Left Leg Hit Impact Damage");
FullBodyAnimSlot.SetActorAnimEndNotification(true);
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?