• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Animation would not work

Status
Not open for further replies.
Level 31
Joined
Jun 27, 2008
Messages
2,557
Hello there.

Currently I am trying to launch unit's animation while activating an ability, but animation would not launch.

Ability's: Art - Animation Names
Have been set exactly to the name of animation, but it would not work.

clipboardmn.png


I added string: Attack - 1
It didn't work. I also tired Attack 1 and Attack1, but it didnt work either.
Animation Spell would work, but this one - not. I think there is problem with these numbers there, because there are 3 or 4 animations with Attack. Ex. Attack - 1; Attack - 2; Attack - 3.

How could I make exact Attack - 1 work while casting spell, maybe triggers included?

Thanks.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
In object editor, you cannot specify the exact version of "attack", only give "attack" in general, so everytime a random one from the set is played.

You can run an exact unit's animation with the trigger function SetUnitAnimationByIndex(unit, integer)

but need to know the animation's index in the model for this. Either analyze the model or try numbers out. They climb from 0 upwards.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Because it's a jass function. You have to type it in. If you use GUI (graphical user interface), choose the Custom Script action (3rd from above in the all actions list) and write

call SetUnitAnimationByIndex(udg_u, <number>)

udg_u refers to a unit variable, which you have to create in the variable editor (only name it "u", variables that you create via the GUI variable editor are automatically prefixed with "udg_" in jass). This variable helps you so you do not have to ask me what is "Triggering unit" in jass etc. Just set this variable to your unit before this line is run.

But really people, just learn jass. GUI is like playing soccer without using the legs to score.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
If there was no animation, the code is not run or given unit is false. The model may have countless animations but it starts from 0, so you should see some animation.

From your description above, you have probably chosen the unit begins casting an ability/starts effect of an ability event. The ability itself however tries to apply its own animation setting, thus would overwrite yours in time.
 
Level 17
Joined
Sep 25, 2004
Messages
508
You can use Prophet's model viewer to find the animation index more easily, since it lists animations in chronologic order: the first animation index is 0, second is 1, and so on. In alternative you can convert a model to mdl, check its animation list in notepad and count them manually, but it takes longer.

http://www.hiveworkshop.com/forums/tools-560/warcraft-iii-viewer-62878/

Also, running that script will make your unit perform that animation until your next order, so you may want to chain another order after. Otherwise, depending on the nature of the animation, the unit may either "freeze" or repeat the animation endlessly.
 
Level 31
Joined
Jun 27, 2008
Messages
2,557
Variable have been set: Set u = Hero 003 in initialization event trigger. Custom script is being run after ability is being cast and you were right, Waterknight, ability itself tried to animate its animation setting through object editor. Once Animation Names were cleared, it kept animating Spell even though custom script is being launched at any integer.
I may also take a look at Nasrudin's linked viewer.
Thank you for assistance guys.
 
Status
Not open for further replies.
Top