• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

SetUnitAnimationByIndex

Status
Not open for further replies.

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
  • Custom script: call SetUnitAnimationByIndex (your_unit, AnimationIndex)
Maker made this line, I have a question:

If I want to make an unit play the attack 2 animation when casting a spell, what should I set on (your_unit) and on (Animation_Index)? I don't know how to use custom script (I suck very hard, delicious hard with Custom Script), so if you guys can tell me EXACTLY what should I write on these lines plz :/ , would be great.

EDIT: AnimationIndex I know that is specific and different for each unit/hero in the game, but what should I put here ? a number ? a word ? what and how?

And for (your_unit) ? What and how should I write exactly my unit?

Thx
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
The animation index for every unit varies, so if you want to play a certain animation, you need to find out what index value the animation is.

To determine which animation index you want to use, you could try this:
  • Custom script: call SetUnitAnimationByIndex (your_unit, <input an integer from 0 to something>)
Example:
  • Custom script: call SetUnitAnimationByIndex (GetTriggerUnit(),0)
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
I don't remember exactly, but I think it is, you should replace it with the one you need to use.

EDIT:GetTriggerUnit() It seems valid.
 
Level 5
Joined
Jan 27, 2014
Messages
164
To make life easier you can try this:

Code:
Set YOURUNIT = (Triggering unit)
Set YOURINTEGER = 1
Custom script: call SetUnitAnimationByIndex ( udg_YOURUNIT , udg_YOURINTEGER )
Create the 2 variables in the variable editor. One unit and another integer.
Just change the '(Triggering unit)' or '1' to whatever relevant unit/integer you're referring to.
And it should work as is.
 
Status
Not open for further replies.
Top