PlayKnockback
Tracking Issue: #1463
This feature allows animations to be played for alive units being knocked down. Modders wanting to use this feature only need to create new animation sets and add them to pawns.
Animation selection is done in X2Action_Knockback::ComputeAnimationToPlay
, which looks for the following animations:
HL_MeleeKnockback
: default animation used when an unit being knocked back doesn't move any tiles, or if the ability being used is a melee ability andbOverrideMeleeDeath
is false, and the weapon being used hasbOverrideMeleeDeath
set as falseHL_Knockback
,HL_KnockbackRight
,HL_KnockbackLeft
: animation used depending on how the victim is facing the source of the attack. In most cases, units are facing each other, soHL_Knockback
will be used much frequently than these two others.HL_"$OverrideAnimEffectString$"Knockback
,HL_"$OverrideAnimEffectString$"KnockbackRight
,HL_"$OverrideAnimEffectString$"KnockbackLeft
: special animation determined by the highest rankingX2Effect_Persistent
the victim unit is affected by. For example, if the victim is mind controlled, it would look forHL_MindControlKnockback
. If the pawn doesn't have such special animation in their animsets, it will default toHL_Knockback
.CustomKnockbackAnimationName
: override animation name: if this variable has been set inX2Action_Knockback
, it will select this animation name over anything else. As for how to set this variable, see this example on how it's done inX2Action_Death
.
After animation is selected, it will ragdoll the pawn and play the corresponding animation on it. If selected animation doesn't exist in the pawns animsets, it will only ragdoll the unit.