SetUnitAnimation

Parameters
whichUnit unit
whichAnimation string

animation name, case-insensitive

comment

Immediately start playing new animation.

If the animation requires a change, cancel current animation and start new animation. There is no smooth transition.

The start/end behavior (like forced restart or transition to a different animation at the end) depends on the animation itself.

Example (Lua, 2.0.3):

-- Start goblin merchant's forgotten slide animation
u_ngme = CreateUnit(Player(0), FourCC("ngme"), 0, 0, -80)
SetUnitAnimation(u_ngme, "Stand Work")
note

See: QueueUnitAnimation, `SetUnitAnimationByIndex, SetUnitAnimationWithRarity, AddUnitAnimationProperties

patch

1.00

Source
common.j (suggest an edit or discuss on Github)
return type
nothing
Source code
native          SetUnitAnimation            takes unit whichUnit, string whichAnimation returns nothing