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

The Animation Doesn't work!

Status
Not open for further replies.
Level 11
Joined
Nov 15, 2007
Messages
781
Some animations won't play using that function. Instead use


  • Custom script: call SetUnitAnimationByIndex(unit, integer)
You'll need to get the index of the animation you want to play, though. Which is annoying because it doesn't match up to the order of the animations in the object editor's little animation player thingy, and it isn't standard for all units. I happen to know off the top of my head that a Footman's walk animation is 6, so if I wanted to make my footman play its walk animation I'd do

  • Set unit = Footman 0001 <gen>
  • Custom script: call SetUnitAnimationByIndex(udg_unit, 6)

This is the method I use for getting animation indexes, since I haven't heard of any better way.

  • Play
    • Events
      • Player - Player 1 (Red) types a chat message containing play as A substring
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set unit = (Picked unit)
          • Set int = (Integer((Substring((Entered chat string), 5, 6))))
          • Custom script: call SetUnitAnimationByIndex(udg_unit, udg_int)
Also worth noting animation indexes start at 0, not 1.
 
Level 12
Joined
Apr 28, 2012
Messages
166
This is the method I use for getting animation indexes, since I haven't heard of any better way.

  • Play
    • Events
      • Player - Player 1 (Red) types a chat message containing play as A substring
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set unit = (Picked unit)
          • Set int = (Integer((Substring((Entered chat string), 5, 6))))
          • Custom script: call SetUnitAnimationByIndex(udg_unit, udg_int)
Also worth noting animation indexes start at 0, not 1.

You can see the animation index from the WE Maybe that what I have noticed, when he show you the unit you selected you can choose the animation, search for the one you want and see which number it is, start counting from the first animation the WE put, usually it is(Stand -1).
 
Status
Not open for further replies.
Top