• 🏆 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!

[Solved] How do you play a units "Stand Ready Alternate" animation via triggers?

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,240
You can try
  • Custom script: call SetUnitAnimationByIndex(unit, index)
The index is an integer. Indexes start from 0, you'll have to find the correct number.

Animation - play unit animation plays the anim once, that custom scripts keeps looping it until it is interrupted.
 
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
Try this:
  • Custom script: call SetUnitAnimationByIndex (your_unit, AnimationIndex)
your_unit is a unit variable (use udg_ if your going to use globals)
AnimationIndex is the index of the animation name which can be retrieved from the preview pallet.


EDIT: Maker beat me to it while I was writing this >.<
 
Level 12
Joined
Mar 28, 2005
Messages
160
i have never quite understood exactly how animation names work when using triggers

some seem fine, others, not so much

this script should take care of the "finding" mentioned above

just call it for whatever unit you a re interested in

JASS:
function ShowAnimationIndexes takes unit u returns nothing
    local integer i=0 // animations start at 0 actually
    
    loop
        exitwhen i>15 // have yet to see a unit with more than 16 animations
        // though some may have only half so many
        call SetUnitAnimationByIndex(u,i) // set animation to index i
        call BJDebugMsg("Animation Index: "+I2S(i)) // display to players what animation index is being performed
        call TriggerSleepAction(3.) // wait so we can see what the animation actually is
        set i=i+1 // try the next one
    endloop
endfunction

from the preview pallet

I am interested in this - because when viewing a unit in the Object Editor, the order of the animations rarely corresponds to what their index is - unless I am missing something
 
Status
Not open for further replies.
Top