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

Finding animation index by name?

Status
Not open for further replies.
Level 5
Joined
Apr 26, 2006
Messages
160
The only suggestions I've found from Googling were old threads saying that they just tediously go through animations and find it through trial and error.

The issue is that I have a script that affects any unit the player controls, but the player can have several different units in control, so they all have different indices. I'm not going to go through all the animations of every single useable unit to find the right index to use for each one.

Is there really not a way to find an animation by its name? Even the editor shows the Stand 1 animation consistently in the model previewer, and clearly the game itself has a way of finding the name of an animation and playing it.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
If I remember correctly, you can open the model via some model editor and look for indices. Model itself contains that information (that is how game can find it) but somehow that information is not shown to mapmakers in the world editor interface.
 
Level 5
Joined
Apr 26, 2006
Messages
160
Is there any difference with Reforged? Are model viewers able to view the new models?
 
Level 23
Joined
Apr 3, 2018
Messages
460
You could make a test map for it.
Use a cycle to create a unit for every animation say from 0 to 20, and put down a text tag under each unit showing the index which animation is played for it. Then use a timer to play these animations by index in a repeating loop.
Once it's done you can just look which of the units is playing the animation you want and under it you'll see the index on the texttag.
You can then re-use the map for different models just changing which model is used for the unit in the object editor.
I've done this before but on a different computer.

Edit: re-read the question; there's no quick way to get the indexes during the game, so you'll have to save them in a database for each unit that needs to be affected.
In the test map, may be put down all possible units in some area where you could click on them to choose whose animations would be displayed, to avoid having to run test map again and again for every unit.
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
Yeah, it's a pain but it should only take 1-2 minutes to write down each unit's Animations. Like others have said you can create a small system/test map that makes it easy to test these out. In my current project I have a test mode that I turn on by typing -test.

While "test mode" is on I can press escape to play the current selected unit's animation using an Integer as the Index. Simply increase the Integer by 1, display the Integer as a text message, and set the current selected unit's Animation Index to the Integer. Typing -reset will set the Integer back to 0.

While doing this I write the info down in notepad so I don't forget it. Then once I have the needed info I save it as a bunch of Variables so I can easily reference it in the future.

Note that the Animation Indexes I used are just examples and most likely incorrect
  • Setup Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Setup_UnitType[1] = Peasant
      • Set VariableSet Setup_WalkAnimation[1] = 2
      • Set VariableSet Setup_AttackAnimation[1] = 3
      • -------- - --------
      • Set VariableSet Setup_UnitType[2] = Footman
      • Set VariableSet Setup_WalkAnimation[2] = 3
      • Set VariableSet Setup_AttackAnimation[2] = 4
      • -------- - --------
      • Set VariableSet Setup_UnitType[3] = Knight
      • Set VariableSet Setup_WalkAnimation[3] = 5
      • Set VariableSet Setup_AttackAnimation[3] = 6
      • -------- - --------
      • Set VariableSet TotalUnitTypes = 3
  • Setup Unit
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
    • Actions
      • For each (Integer A) from 1 to TotalUnitTypes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Setup_UnitType[(Integer A)]
            • Then - Actions
              • Set VariableSet UDex = (Custom value of (Triggering unit))
              • Set VariableSet WalkAnimation[UDex] = Setup_WalkAnimation[(Integer A)]
              • Set VariableSet AttackAnimation[UDex] = Setup_AttackAnimation[(Integer A)]
            • Else - Actions
  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- Play the unit's Walk Animation --------
      • Set VariableSet TempUnit = (Triggering unit)
      • Set VariableSet UDex = (Custom value of TempUnit)
      • Custom script: call SetUnitAnimationByIndex(udg_TempUnit, udg_WalkAnimation[udg_UDex])
 
Last edited:
Level 12
Joined
Mar 21, 2008
Messages
358
mdlvis organizes animations by index ¯\_(ツ)_/¯
just open model with mdlvis, press f3, then open animation list at top right
doesn't show any numbers or anything so you have to count from the start (from 0)
if ur model has 99999999999 animations enjoy counting my man
 
Level 3
Joined
May 17, 2019
Messages
45
What is the animation you are looking for ?

If you are using custom script I don't know any other way than using index, but if you are using GUI you can use 'attack' 'stand' 'spell' etc and it will work for all units.
 
Status
Not open for further replies.
Top