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

Slow Animation speed for a duration trigger

Status
Not open for further replies.
Level 6
Joined
May 11, 2010
Messages
236
Hey guys, i'm making a trigger for an ability i've created called Time Flux. Basically, when used it slows all targets on the map, this works fine. What I want is that units with the buff also have their animation speed slowed, meaning when they're standing there playing their stand animation etc, that's all slowed, I can't really work out how to do it. This is what i've attempted

  • Event
  • Unit - Time-Warden starts the effect of an ability
  • Conditions
  • (Ability being cast) equal to Time Flux
  • Actions
  • If (((Matching Unit) has buff Time Flux Equal to True) then do (Animation - Change (Matching Unit)'s animation speed to 20% of it's original speed) Else (Do nothing)
  • Wait 11.00 seconds
  • Animation - Change (Matching Unit)'s animation speed to 100% of it's original speed
Okay, so I know it's pretty off, mainly because it's not doing what I want it to do. And yes once the duration of the buff is gone i'd like them to revert back to their normal animation speed, though I have a feeling the "wait 11 seconds" wont work very well, but I hadn't got up to devising how to do that part properly yet either.

Help will be very appreciated + rep if you do.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
  • Untitled Trigger 005
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Divine Shield
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Equal to False))) and do (Actions)
        • Loop - Actions
          • Animation - Change (Picked unit)'s animation speed to 20.00% of its original speed
          • Hashtable - Save 11 as (Key time) of (Key (Picked unit)) in Hashtable
          • Unit Group - Add (Picked unit) to group
      • Trigger - Turn on Untitled Trigger 003 <gen>
  • Untitled Trigger 003
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Set integer = (Load (Key time) of (Key (Picked unit)) from Hashtable)
          • Game - Display to (All players) the text: (String(integer))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • integer Greater than 0
            • Then - Actions
              • Hashtable - Save (integer - 1) as (Key time) of (Key (Picked unit)) in Hashtable
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
              • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
              • Unit Group - Remove (Picked unit) from group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (group is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions


That works.

When you start the effect of an ability, then units most likely won't have the buff yet. You need to use some kind of delay or pick the units in some other way. I presented one way to pick the units but you can apply a different kind of filter.
 
Level 6
Joined
May 11, 2010
Messages
236
Thanks i'll try that out. Though I'm thinking then, if I set it to

  • Events
  • Unit - Time-Warden finishes casting an ability
Doesn't that mean they'd have the buff before the this is triggered? As when it's set to finishes casting an ability, doesn't it trigger after the spell is casted?

+ rep for your help
 
Level 6
Joined
May 11, 2010
Messages
236
I just set the range of the ability to an amount that covers the entire map :p
Though i'm unsure of any bugs as of yet, but it seems to work. :grin: Then any unit that has the buff has it's animation slowed, but I suppose i'll need to try it out with using 'Finishes casting ability' to make sure that was the problem to begin with

Edit: Nope doesn't seem to work like that, going back to your trigger :p Though i'm unsure of why it doesn't work

It's pretty much the trigger I posted in my first post above, but with "Finishes casting an ability" instead of 'starts the effect'
 
Level 6
Joined
May 11, 2010
Messages
236
Hmm it's saying there's an error in the custom script
  • Custom script: set bj_wantDestroyGroup = true
It's disabling the trigger
 
Status
Not open for further replies.
Top