well, if you're making a trigger where you want the unit to play an animation, just do what i said above.
if you're trying to make a unit that will only use one animation whenever it attacks, sorry cant help.
That last thing ain't too hard, here is a small example, perhaps not the most efficient of code, but hench it should work
-
Attack Animation Blademaster
-

Events
-


Unit - A unit Is attacked
-

Conditions
-


(Unit-type of (Attacking unit)) Equal to Blademaster
-

Actions
-


Set attackingUnit = (Attacking unit)
-


Custom script: call SetUnitAnimationByIndex (udg_attackingUnit, 2)
-


Animation - Queue attackingUnit's stand animation
The event enables the trigger when a unit is attacked (there is no real function for "if a unit is attacking") so were basically doing it the other way around.
because you only want a specific type of unit(s) to do this, you narrow the enablement down with a conditional statement, in this case "Unit - Type Comparison", we use the attacking unit, cause we don't want to know whom the attacked unit is, but the attacker; in this case the Blademaster unit type.
Next up the actions, first of all I saved the attacking unit, in a unit variable (this allows easier acces in your custom script next up).
Following up, we make A script call "SetUnitAnimationByIndex", between the () we first fill in the first parameter which is the unit we are refering to, so in this case attackingUnit, cause of the global scope the variable has, we have to put udg_ in front of it.
We close that with a ","to then fill out the next parameter, this is the Index number of the units animation (in this case2)
Note: you can find animation index numbers easily with wc3viewer.
Conclusively we Que the stand animation, so the unit doesn't freeze after it has attacked.
And there you have it, hope this helps you out
