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

Unit Animation Problem

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
I Want to control a unit's animations during an in-game cinematic. The unit's animations are:

Stand
Stand - 2
Stand - 3
Stand - 4


2 Questions:

1.)
Why doesn't this work? Seems he plays his Stand animation. Sometimes he plays a Stand - 3 or Stand - 4. I don't get it....

  • Animation - Play Grom Hellscream MiniBoss2 0002 <gen>'s Stand - 2 animation
Looking at the picture, his animation string is Stand - 2. I've tried Stand2. Stand 2, stand - 2, stand 2, etc. Doesn't work.

anim.jpg


2.) Warcraft 3 play animations at random. How can I lock the unit's animation to Stand (I don't want other stand animations playing at random).
 
Did you try "Stand 2"? (I doubt it will work, but give it a shot) iirc any part after the dash "-" is considered a comment and is ignored

Otherwise, use animation indices. It is the most reliable way to get the animation you want.
  • Set TempUnit = <Put Your Unit Here>
  • Custom script: call SetUnitAnimationByIndex(udg_TempUnit, 5)
The example above will play the 5th animation index for 'TempUnit'. You'll have to look up the indices manually (e.g. open it in mdlvis and look at the order of animations), or convert it to mdl and count the order, or just guess and check.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Did you try "Stand 2"?

Just tried. It didn't work.

Something I should have mentioned is that if I play an attack animation, it works fine. I only have trouble playing stand animations. I wonder if it's because, by chance, the unit is already halfway through a Stand 2 animation? (I can't tell in my cinematic. I will change camera angle to check)

The animation indicies thing didn't solve the problem. I used mdlvis to check which number it was on and it didn't play properly.
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
The animation indicies thing didn't solve the problem. I used mdlvis to check which number it was on and it didn't play properly.

Maybe you got the number wrong.
Try testing it individually. Something like when you pressed Esc,
  • Set i = i + 1
  • Set TempUnit = <Put Your Unit Here>
  • Custom script: call SetUnitAnimationByIndex(udg_TempUnit, udg_i)
  • Custom script: call BJDebugMsg("Index = " + I2S(udg_i))
When the unit is playing the desired animation, you got your number displayed.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Only SetUnitAnimationByIndex allows accessing individual sub-animations.

The normal "Play unit animation" will always play a random animation, even if you enter a specific number afterwards.
I use WC3 Viewer as it was proven that it does display the animations in correct order. Don't forget that the "No animation" is not an animation and that the first indexed animation has index 0.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
The normal "Play unit animation" will always play a random animation, even if you enter a specific number afterwards.

That explains why I was originally getting random animations. Thanks.

Maybe you got the number wrong.
Try testing it individually. Something like when you pressed Esc,
Set i = i + 1
Set TempUnit = <Put Your Unit Here>
Custom script: call SetUnitAnimationByIndex(udg_TempUnit, udg_i)
Custom script: call BJDebugMsg("Index = " + I2S(udg_i))
When the unit is playing the desired animation, you got your number displayed.

Ahh thanks heaps! This is working now. My Stand was number 7, and my Stand - 2 was number 0. Plays properly now :)
I use WC3 Viewer as it was proven that it does display the animations in correct order. Don't forget that the "No animation" is not an animation and that the first indexed animation has index 0.

Yeah this must be the case. Mdlvis didn't display it in the correct order. Not to mention 0 was the animation number I needed for my Stand - 2.

Thanks everyone.
 
Status
Not open for further replies.
Top