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

Forcing unit animation

Status
Not open for further replies.
Level 5
Joined
Feb 8, 2015
Messages
93
Hi Hive

I'm making a sort of "motion blur" movement speed ability, and it almost works perfectly.

The trigger gives some movement speed abilities and such to the caster, but it also does a loop every 0.20 seconds which creates a transparent clone of the Hero.
The clone starts with 60% transparency, and steadily becomes more transparent until it reaches 100% and is removed from the game.

This all works perfectly, but I want the blur images to play their walking animation - however, they refuse to do so. Right now they just do idle stand animations
Putting a "Play Unit's walk animation" in the For Every Unit in Group... loop made them stutter awkwardly, because of how fast the looping runs.

Any advice? Is there a way to force units to just permanently play walk animations, regardless of other changes?

P.s. The casting trigger is just here for the full picture. The problem is entirely with the loop trigger
  • Windstalk Activate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ash: Windstalk (Channel)
    • Actions
      • Set WinSta_index = (WinSta_index + 1)
      • Set WinSta_Caster[WinSta_index] = (Triggering unit)
      • Set WinSta_Dur = 9999.00
      • Set WinSta_lvl = (Level of (Ability being cast) for WinSta_Caster[WinSta_index])
      • -------- Adds and levels abilities- then hides the icons --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of WinSta_Abil1 for WinSta_Caster[WinSta_index]) Less than 1
        • Then - Actions
          • Unit - Add WinSta_Abil1 to WinSta_Caster[WinSta_index]
          • Unit - Set level of WinSta_Abil1 for WinSta_Caster[WinSta_index] to WinSta_lvl
          • Unit - For WinSta_Caster[WinSta_index], Ability WinSta_Abil1, Hide ability: True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of WinSta_Abil2 for WinSta_Caster[WinSta_index]) Less than 1
        • Then - Actions
          • Unit - Add WinSta_Abil2 to WinSta_Caster[WinSta_index]
          • Unit - Set level of WinSta_Abil2 for WinSta_Caster[WinSta_index] to WinSta_lvl
          • Unit - For WinSta_Caster[WinSta_index], Ability WinSta_Abil2, Hide ability: True
        • Else - Actions
      • -------- Loop trigger on/off --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WinSta_index Greater than 0
        • Then - Actions
          • Trigger - Turn on Windstalk Loop <gen>
        • Else - Actions
  • Windstalk Loop
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • For each (Integer WinSta_Loopi) from 1 to WinSta_index, do (Actions)
        • Loop - Actions
          • -------- Visual Effect --------
          • Set WinSta_Tempp = (Position of WinSta_Caster[WinSta_Loopi])
          • Unit - Create 1 Ashprowler Image (Dummy) for Neutral Passive at WinSta_Tempp facing (Facing of WinSta_Caster[WinSta_Loopi]) degrees
          • Custom script: call RemoveLocation(udg_WinSta_Tempp)
          • Set WinSta_Tempu = (Last created unit)
          • Animation - Play WinSta_Tempu's walk animation
          • Set WinSta_transparency = 60.00
          • Animation - Change WinSta_Tempu's vertex coloring to (100.00%, 100.00%, 100.00%) with WinSta_transparency% transparency
          • Hashtable - Save WinSta_transparency as 0 of (Key (Last created unit)) in WinSta_hash
          • -------- Increasing transparency and removal --------
          • Set WinSta_r = (((100.00 - WinSta_transparency) / 2.00) / 5.00)
          • Unit Group - Add WinSta_Tempu to WinSta_Ug
          • Unit Group - Pick every unit in WinSta_Ug and do (Actions)
            • Loop - Actions
              • Set WinSta_picked = (Picked unit)
              • Set WinSta_transparency = ((Load 0 of (Key (Picked unit)) from WinSta_hash) + WinSta_r)
              • Animation - Change WinSta_picked's vertex coloring to (100.00%, 100.00%, 100.00%) with WinSta_transparency% transparency
              • Animation - Queue WinSta_picked's walk animation
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WinSta_transparency Greater than or equal to 100.00
                • Then - Actions
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in WinSta_hash
                  • Unit Group - Remove WinSta_picked from WinSta_Ug
                  • Unit - Remove WinSta_picked from the game
                • Else - Actions
                  • Hashtable - Save WinSta_transparency as 0 of (Key (Picked unit)) in WinSta_hash
          • -------- Updates duration --------
          • Set WinSta_Time[WinSta_Loopi] = (WinSta_Time[WinSta_Loopi] + 0.20)
          • -------- Checks if Duration Expired --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WinSta_Time[WinSta_Loopi] Greater than or equal to WinSta_Dur
            • Then - Actions
              • -------- Removes ability bonuses --------
              • Unit - Remove WinSta_Abil1 from WinSta_Caster[WinSta_Loopi]
              • Unit - Remove WinSta_Abil2 from WinSta_Caster[WinSta_Loopi]
              • -------- Updates index --------
              • Set WinSta_Caster[WinSta_Loopi] = WinSta_Caster[WinSta_index]
              • Set WinSta_index = (WinSta_index - 1)
              • Set WinSta_Loopi = (WinSta_Loopi - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WinSta_index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions

P.p.s. The insanely high duration is just for testing purposes...
 
Try using SetUnitAnimationByIndex, like so:
  • Custom script: call SetUnitAnimationByIndex(udg_WinSta_Tempu, 3)
edited: Replace "3" with the animation index for your unit's walk. To find this out, convert your model from MDX to MDL, open it in a text editor, go to the animations portion, and the animations will be listed in order (first animation listed has index 0, second animation has index 1, etc.). Or you can just test your spell with different #'s until you get the right one.

Note: the animation index depends on your model. So if you want this spell to support different models, I would store the walk indices in a hashtable on map init for all the models that may cast that spell, and then look it up for your spell's triggers.

For more reading, see this post:
how to play units walk animation
 
Last edited:
Level 21
Joined
May 29, 2013
Messages
1,567
To find this out, try opening your model in Magos' Model Editor, go to Windows -> Animation Controller, and the animations will be listed in order (first animation listed has index 0, second animation has index 1, etc.).
Animations are always listed alphabetically in War3 Model Editor. I think you need to convert the model to mdl and open it in Notepad to see the correct order.
 
Last edited:
Status
Not open for further replies.
Top