HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Basic Animations

09-06-2008, 05:13 PM#1
Kwah
Basic Animations

This tutorial contains a brief and simple overview, of unit animations both through triggers and the object editor, as well as their uses.

Common Ability/Animation Strings

Common Animation Strings Include:
  • walk
  • attack
  • morph
  • morph alternate
  • defend
  • birth
  • death
  • spell
  • decay
  • dissipate (hero only)

Modifiers:
  • fast (walk)
  • swim(walk/stand)
  • throw (spell)
  • slam (attack/spell)
  • channel (stand)
  • work (stand)
  • spin (attack walk)
  • hit (stand)
  • ready (stand)
  • lumber (attack, stand, walk)
  • gold (attack, stand, walk)
  • flesh (decay)
  • bone (decay)



To these when you cast an ability, is very simple. For an example I'll look at the Human > Mountain King > Storm Bot

You'll notice near the top that it says, Art > Animation Names > spell, throw.
If you open up the value, you'll find that it shows two separate strings, 'spell' and 'throw'. The first string ('spell'), assigns at least part of the animation. If you were to delete 'throw' it would play the mountain kings spell animation. Since 'throw' is there, it, in effect, modifies the 'spell' and makes the mountain king play his "spell throw" animation instead.

Now, I have a problem for you: What would you do to play the Tauren Warchiefs "slam" animation?


Built in Unit Animations

When you select a unit, under its art there area a few animation related things. These are:
  • Blend Time - The time it takes a unit to switch between two animations. This will stop it from jumping between, animations instantly, and move the limbs normally.
  • Cast Backswing - Cast Backswing is the amount of time that the unit will continue to play its animation for after it has cast.
  • Cast Point - After the order is given, the unit will play its animation. After the "Cast Point" time has expired it will begin the effect. For example: A sorceress begins playing her cast animation for Slow. She will wait a fraction of a second, before the effect actually begins.
  • Run Speed - The amount that the unit travels in the time of one walk animation. The game automatically detects some features as well.
  • Walk Speed - See Run Speed.

Now for the combat animations: These can be found under Combat, near the top of the list.
  • Animation Backswing Point - This is the same as "Cast Backswing", seen above.
  • Animation Damage Point - The point into the animation at which damage is dealt. Same as "Cast Point", also seen above.

Triggered Animations

Triggering Animations, can be very useful for spell making, cinematics and many visual displays. Some of the most basic commands are:

Trigger:
Basic Actions
Animation - Play <A unit's> stand animation
Animation - Play <A unit's> stand animation, using only Common animations
Animation - Queue <A unit's> stand animation
Animation - Reset <A unit's> animation

General advice and tips:

- The unit animation is selected using the same method (mentioned earlier in the tutorial) as common animation strings, and abilities.

- The selected unit could be: A unit from a unit group (picked unit), a specific variable (<YourUnit>), or an event trigger (ie: Triggering Unit).

The commands:
  • Animation - Play <A unit's> attack animation - forces the play of an animation. Plays it only once.
  • Animation - Play <A unit's> stand animation, using only Common animations - Stops it from playing strange animations (ie: Skeletal "Leg Wobble" walk animation. Useful in cinematics.
  • Animation - Queue <A unit's> stand animation - This will play the animation after, the current animation has been completed.
  • Animation - Reset <A unit's> animation - Resets the current animation to the action that the unit is undertaking.

An extra JASS feature:

I can't seem to find a GUI equivalent of this, so I'll use the JASS instead. This is what you use to play a looping animation, so it plays more than one time.For example: you cannot play a walk animation with "play <Unit's> walk animation," and to play a walk animation you must use JASS SetUnitAnimationByIndex

This is SETUNITANIMATIONBYINDEX. To incorporate this properly into the GUI code, first make a custom script action. Once there, type: call SetUnitAnimationByIndex(unit,integer). The unit will be the unit that you are setting the animation for, and the integer is the Animation ID. This animation ID is in what order the animation appears on the animation list. You can find this out by either looking at it in the World Editor, Wc3viewer or a similar program. The number starts at 0 ignoring Un-animated.

Collapse JASS:
call SetUnitAnimationByIndex(GetTriggerUnit(),4)

Another useful link, which can be fun to play around can be found here. Playing Animations Backwards.




Credits


Pyrogasm - For miscellaneous help, review, and inspiration.
Rao Dao Zao - for "Blend Time" explanation
Anitarf - For being amazingly helpful
PitzerMike - For review, and whatnot
Donut3.5 - additional animation tags
Just_Spectating - additional animation tags
DevineArmy - additional animation tags

09-06-2008, 07:02 PM#2
Pyrogasm
And how about playing these animations backwards with triggers? This ought to help you figure it out completely, as I never really did fully figure it out.

Edit: And this.

You should probably explain how SetUnitAnimationByIndex (not sure of the GUI equivalent) works, and in doing so mention that the "walk" animation cannot be played except with using SetUnitAnimationByIndex. Additionally, I would add stuff about adding animation tags to a unit does (E.G.: Demon Hunter).

This is what "Reset Unit Animation" does, so it's pretty useless (also your description is wrong):
Collapse JASS:
function ResetUnitAnimation takes unit whichUnit returns nothing
    call SetUnitAnimation(whichUnit, "stand")
endfunction
09-06-2008, 07:09 PM#3
Kwah
Oh. . . I'll fix that up. Updated with additional tags, also.
09-09-2008, 02:34 AM#4
Kyrbi0
Wow, you sure are proflicicl;ds.a.fd.... prolific. Good work.
09-09-2008, 09:25 PM#5
Kwah
Mmmm, I often take a break from my projects, and am looking for something to do. Pyrogasm suggested a Basic Anomation Tutorial, so here we are.
10-08-2008, 06:54 PM#6
Anitarf
Quote:
Originally Posted by hawk900
  • Blend Time - The time that it takes the unit to switch betweem two animations. ie: A Footman is walking around, and is then ordered to attack an adjacent unit. Since his Blend Time is 0.15 seconds, it will wait that time before starting the other animation.
  • Cast Backswing - Cast Backswing is the point at which the unit will start its animation , before casting an ability. For example: A priest is casting Heal. Before he does so, he will play an animation, like swinging back his staff or lifting his hands.
  • Cast Point - Is the point in its cast animation that a unit will start the effect. If a sorceress is casting slow, she'll wait until .450 until the effect starts.
  • Run Speed - The speed at which the animation is played. For units, which you want to appear to be traveling fast (High MS values) you should input a higher value here as well.
  • Walk Speed - See Run Speed.
These descriptions are poorly written and sometimes not even true. For example, blend time, it doesn't mean the unit waits that long before starting another animation, it means that this is how long it takes to blend between animations. The next animation starts immediately, but for the blend duration the unit will interpolate between the old animation and the new one so there's no sudden change, for example if the unit is in the middle of it's walk animation and it's legs are in the air, and it starts it's stand animation, the legs won't suddenly move into a standing position, instead they'll gradualy move there over the blend time.

Cast Backswing/Point are likewise pporly explained. When a unit beins casting a spell, it starts playing it's spell animation first, then, after cast-point seconds, the spell will actually be cast (if the unit is not interrupted in the meantime by another order or a stun effect) and then the unit will continue to play it's cast animation for cast-backswing seconds before going back to standing (again, unless it's interrupted earlier).

Run speed is not the speed at which the walk animation is played, rather it says what distance the unit travels in one walk animation loop. The game then uses this information to calculate the animation speed when the unit is walking based on it's movement speed, so if you give your unit a higher movement speed you don't need to change the animation-run speed at all.

Furthermore, you still have no information about the SetUnitAnimationByIndex native function even though Pyrogasm already asked you to do that.
10-08-2008, 09:04 PM#7
Kwah
It seems that this tutorial has slipped my mind temporarily. As of now, I'm busy with some of my contests, and will get around to this as soon as possible. If someone else is at all interested in developing this further, I offer what I have to them: No credits required, or wanted.
10-08-2008, 09:51 PM#8
PitzerMike
With the problems mentioned by Anitarf fixed, it will definitely be approvable.
10-17-2008, 11:51 PM#9
Kwah
~Updated.
10-18-2008, 05:15 AM#10
Pyrogasm
I would change every "No Unit" into "<A unit>" to show exactly what is going on in each function. In addition, in your section about SetUnitAnimationByIndex, use some [ljass] tags and mention this: you cannot play a walk animation with "play <Unit's> walk animation," and to play a walk animation you must use SetUnitAnimationByIndex.
10-18-2008, 05:57 AM#11
Kwah
Fixed
11-05-2008, 10:15 AM#12
laxa88
I hope this question isn't "noobish", but can all the animations have more than one variation? Like, say "Stand" can have "Stand - 2" and so on; Can "Birth" or "Spell" or "Death" animations be varied?
11-05-2008, 12:09 PM#13
Kwah
That is actually a good point. It all depends on the model, and its animation set.

EDIT: Pitzer?
11-16-2008, 06:20 PM#14
PitzerMike
Undoubtedly approved!
11-16-2008, 06:21 PM#15
Kwah
Thanks -- and Pyro, Sorry about the backwards animations. :P