Animation during unit movement

Tawnttoo

New Member
Reaction score
36
Why is the animation not work on this? It sort of starts the animation all over again each time the trigger runs. The result is bizarre skittering, not what I'm looking for.

Trigger:
  • ChargeLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Charge_Chargers and do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Position of (Picked unit)) as (Key chargerloc) of (Key (Picked unit)) in Charge_Hash
          • Hashtable - Save Handle Of(Position of (Load (Key target) of (Key (Picked unit)) in Charge_Hash)) as (Key targetloc) of (Key (Picked unit)) in Charge_Hash
          • Hashtable - Save Handle Of((Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash) offset by (Load (Key speed) of (Key (Picked unit)) from Charge_Hash) towards (Angle from (Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash) to (Load (Key targetloc) of (Key (Picked unit as (Key TempPoint) of (Key (Picked unit)) in Charge_Hash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between (Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash) and (Load (Key targetloc) of (Key (Picked unit)) in Charge_Hash)) Less than or equal to 90.00
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of (Picked unit)) at (Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash) facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Firebolt (Neutral Hostile) to (Last created unit)
              • Unit - Order (Last created unit) to Neutral - Firebolt (Load (Key target) of (Key (Picked unit)) in Charge_Hash)
              • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
              • Unit - Turn collision for (Picked unit) On
              • Animation - Reset (Picked unit)'s animation
              • Unit Group - Remove (Picked unit) from Charge_Chargers
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Charge_Hash
            • Else - Actions
              • Hashtable - Save (X of (Load (Key TempPoint) of (Key (Picked unit)) in Charge_Hash)) as (Key X) of (Key (Picked unit)) in Charge_Hash
              • Hashtable - Save (Y of (Load (Key TempPoint) of (Key (Picked unit)) in Charge_Hash)) as (Key Y) of (Key (Picked unit)) in Charge_Hash
              • Special Effect - Create a special effect at (Load (Key TempPoint) of (Key (Picked unit)) in Charge_Hash) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call SetUnitAnimationByIndex( GetEnumUnit(), 1)
              • Custom script: call SetUnitX( GetEnumUnit(), LoadRealBJ(StringHashBJ("X"), GetHandleIdBJ(GetEnumUnit()), udg_Charge_Hash) )
              • Custom script: call SetUnitY( GetEnumUnit(), LoadRealBJ(StringHashBJ("Y"), GetHandleIdBJ(GetEnumUnit()), udg_Charge_Hash) )


Everything else works just fine, so that it can't be about not setting the variables right.
 

TomTTT

New Member
Reaction score
44
You do know you reset the unit's animation? Because I didn't see any action of an animation except changing the animation speed back to 100% and resetting the unit's animation...
 

Tawnttoo

New Member
Reaction score
36
Its only to reset the unit after it has reached its destination. I even tried disabling it, but it still wiggles with the animation
 

Tawnttoo

New Member
Reaction score
36
If you insist:
Trigger:
  • Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Unit Group - Add (Triggering unit) to Charge_Chargers
      • Hashtable - Save 40.00 as (Key speed) of (Key (Triggering unit)) in Charge_Hash
      • Hashtable - Save Handle Of(Position of (Triggering unit)) as (Key chargerloc) of (Key (Triggering unit)) in Charge_Hash
      • Hashtable - Save Handle Of(Target unit of ability being cast) as (Key target) of (Key (Triggering unit)) in Charge_Hash
      • Hashtable - Save Handle Of(Position of (Target unit of ability being cast)) as (Key targetloc) of (Key (Triggering unit)) in Charge_Hash
      • Animation - Change (Triggering unit)'s animation speed to 200.00% of its original speed
      • Unit - Turn collision for (Triggering unit) Off
      • Custom script: call SetUnitAnimationByIndex( GetTriggerUnit(), 1)
 

Tawnttoo

New Member
Reaction score
36
That is just for playing certain animations (in this case, walking) while moving the unit. The skill is based off Channel.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Doesn't work? Pause, play animation, animation over, unpause doesn't work? Post your latest triggers please :p
 

Jedi

New Member
Reaction score
63
What model are you using?Units' indexed animations can be different for all models.Your model's 1 animation can be stand :O
 

Tawnttoo

New Member
Reaction score
36
I'm using Tauren Chieftain because he has the 'Run Fast' which is perfect for a charge spell. I have tried every animation from 1-12 and none of them work (3 is walk, it sorta works)
 

Tawnttoo

New Member
Reaction score
36
images
 

Tawnttoo

New Member
Reaction score
36
Those are my latest triggers. Here's the map.
 

Attachments

  • Chargemedoktor.w3x
    19.9 KB · Views: 90

Weep

Godspeed to the sound of the pounding
Reaction score
400
OK, a few things...

1. You can't set a unit's animation in the same event as Starts the effect, I believe, since the casting animation will override (even if the casting animation is "none"). You'll need to do it after a delay, whether after a 0s wait (which is OK since Triggering Unit is MUI), or after a 0 second timer, or in the first iteration of the periodic.
2. It's jerky since you're setting the animation every time the periodic trigger runs, which starts the animation over anew. You should use that function just once, when the animation needs to be set.
3. Animation index 8 is the Chieftain's death animation, which looks really funny but is probably not what you want. :D Index 3 is walking. FYI, people report that the Chieftain's Walk Fast animation has been removed in a patch. :(

This functions:
Trigger:
  • Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Unit Group - Add (Triggering unit) to Charge_Chargers
      • Hashtable - Save 40.00 as (Key speed) of (Key (Triggering unit)) in Charge_Hash
      • Hashtable - Save Handle Of(Position of (Triggering unit)) as (Key chargerloc) of (Key (Triggering unit)) in Charge_Hash
      • Hashtable - Save Handle Of(Target unit of ability being cast) as (Key target) of (Key (Triggering unit)) in Charge_Hash
      • Hashtable - Save Handle Of(Position of (Target unit of ability being cast)) as (Key targetloc) of (Key (Triggering unit)) in Charge_Hash
      • Animation - Change (Triggering unit)'s animation speed to 200.00% of its original speed
      • Unit - Turn collision for (Triggering unit) Off
      • Wait 0.00 seconds
      • Custom script: call SetUnitAnimationByIndex( GetTriggerUnit(), 3)
Trigger:
  • ChargeLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Charge_Chargers and do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Position of (Picked unit)) as (Key chargerloc) of (Key (Picked unit)) in Charge_Hash
          • Hashtable - Save Handle Of(Position of (Load (Key target) of (Key (Picked unit)) in Charge_Hash)) as (Key targetloc) of (Key (Picked unit)) in Charge_Hash
          • Hashtable - Save Handle Of((Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash) offset by (Load (Key speed) of (Key (Picked unit)) from Charge_Hash) towards (Angle from (Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash) to (Load (Key targetloc) of (Key (Picked unit as (Key TempPoint) of (Key (Picked unit)) in Charge_Hash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between (Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash) and (Load (Key targetloc) of (Key (Picked unit)) in Charge_Hash)) Less than or equal to 90.00
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of (Picked unit)) at (Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash) facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Firebolt (Neutral Hostile) to (Last created unit)
              • Unit - Order (Last created unit) to Neutral - Firebolt (Load (Key target) of (Key (Picked unit)) in Charge_Hash)
              • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
              • Unit - Turn collision for (Picked unit) On
              • Animation - Reset (Picked unit)'s animation
              • Unit Group - Remove (Picked unit) from Charge_Chargers
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Charge_Hash
            • Else - Actions
              • Hashtable - Save (X of (Load (Key TempPoint) of (Key (Picked unit)) in Charge_Hash)) as (Key X) of (Key (Picked unit)) in Charge_Hash
              • Hashtable - Save (Y of (Load (Key TempPoint) of (Key (Picked unit)) in Charge_Hash)) as (Key Y) of (Key (Picked unit)) in Charge_Hash
              • Special Effect - Create a special effect at (Load (Key TempPoint) of (Key (Picked unit)) in Charge_Hash) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call SetUnitX( GetEnumUnit(), LoadRealBJ(StringHashBJ("X"), GetHandleIdBJ(GetEnumUnit()), udg_Charge_Hash) )
              • Custom script: call SetUnitY( GetEnumUnit(), LoadRealBJ(StringHashBJ("Y"), GetHandleIdBJ(GetEnumUnit()), udg_Charge_Hash) )


4. If the player orders the Chieftain to move while sliding, it will change the animation since it's trying to walk to the point but can't, and you can't override the unit's animation while it's walking...so you might want to disable control of the unit while it's sliding. How you accomplish that is up to you, but I might suggest stunning it, then removing the stun when it stops sliding...
5. I think you're leaking all those points you're saving in the hashtable.
 

Tawnttoo

New Member
Reaction score
36
1. That did it, I had no idea that could happen. Thanks.
2. I just remembered reading somewhere that with walking animation it should work. I see this is not the point.
3. I just used it to try if it works, not make him slide lying down :D
4. Will do.
5. Should I save the location to a TempPoint variable and then refer to it in the hashtables?

Thanks for your help.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
5. Should I save the location to a TempPoint variable and then refer to it in the hashtables?
How you do it is up to you. Just remember that hashtables are an alternate way to refer to an object in memory, like a variable - you could either do something like:
Trigger:
  • ...
    • Set TempPoint = Load (Key chargerloc) of (Key (Picked unit)) in Charge_Hash //This is OK because you're just making the variable refer to the existing location object
    • Custom script: call RemoveLocation(udg_TempPoint)

or directly:
Trigger:
  • ...
    • Custom script: call RemoveLocation(LoadLocationHande(udg_Charge_Hash, GetHandleId(GetEnumUnit()), StringHash("chargerloc")))

...but it needs doing, just like if you were done using a point variable. Hashtables aren't magical; they're just another (useful!) way to refer to the same, classic data.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top