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

Get Unit Animation by Index?

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
So I use the Set Unit Animation by Index function
  • Custom script: call SetUnitAnimationByIndex(udg_unit, udg_integer)
Now, I wonder is there a way to check what animation a unit is currently playing and get it returned as a number? Essentially a Get Unit Animation by Index?
 
Level 5
Joined
Sep 16, 2008
Messages
47
You mean check specific animation index?

  • Anim check
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set u = Here you have to select the unit
      • Custom script: call SetUnitAnimationByIndex(udg_u, udg_i)
      • Game - Display to (All players) for 0.01 seconds the text: (String(i))
      • Set i = (i + 1)
once you press ESC it will play specific unit animation and return it's index. It will start from 0. Keep pressing ESC to get animation's index.
 
Level 7
Joined
May 11, 2010
Messages
278
There is no such function in either jass or gui. So unless there's a bug, I doubt it's possible.

Ah, that's unfortunate. I'll have to figure out another solution then.

You mean check specific animation index?

  • Anim check
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set u = Here you have to select the unit
      • Custom script: call SetUnitAnimationByIndex(udg_u, udg_i)
      • Game - Display to (All players) for 0.01 seconds the text: (String(i))
      • Set i = (i + 1)
once you press ESC it will play specific unit animation and return it's index. It will start from 0. Keep pressing ESC to get animation's index.

No, that's not what I mean at all. I know about this and I've used it to figure out which index the animation has (8). What I want to do is make a trigger that checks if the unit is currently playing that animation at certain points in time.
 
So I use the Set Unit Animation by Index function
  • Custom script: call SetUnitAnimationByIndex(udg_unit, udg_integer)
Now, I wonder is there a way to check what animation a unit is currently playing and get it returned as a number? Essentially a Get Unit Animation by Index?
You'd need to write a system for that that manually triggers all animations based on the current order of the unit. Only then can you know which particular index is currently played (as now you can keep track of it manually).

So no, it's not possible without some heavy-weight stuff behind the scenes.

You should really re-consider if you need that feature. Maybe there's a different option for you? What are you trying to achieve?
 
Level 7
Joined
May 11, 2010
Messages
278
Solved it by adding a separate loop that tells the unit to play the animation when certain conditions are met. Not the most elegant solution as it will tell the unit to play the animation even though it already is playing but hey it looks good enough so I'm happy with it.
 
Status
Not open for further replies.
Top