• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Animation getting stuck after negative animation speed

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
I'm playing an animation then after a short while I change the animation speed to a negative value so that it then get played backwards.

However afterwards the unit doesn't play it's stand animations while it's idle.

  • Constants
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- --------------------- --------
      • -------- How many seconds --------
      • Set AnimationTime = 1.37
      • -------- --------------------- --------
      • -------- Converted for integer in periodic event --------
      • Set AnimationTime_Converted = (Integer((AnimationTime / 0.03)))
      • -------- --------------------- --------
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Berserk
    • Actions
      • Set u = (Triggering unit)
      • Animation - Change u's animation speed to 50.00% of its original speed
      • Custom script: call SetUnitTimeScale(udg_u, 0.50)
      • Animation - Play u's death animation
      • Animation - Queue u's stand animation
      • Trigger - Turn on Untitled Trigger 002 <gen>
  • Untitled Trigger 002
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to AnimationTime_Converted
        • Then - Actions
          • Custom script: call SetUnitTimeScale(udg_u, -0.50)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • i Equal to (AnimationTime_Converted x 2)
            • Then - Actions
              • Custom script: call SetUnitTimeScale(udg_u, 1.00)
              • Set i = 0
              • Animation - Play u's stand animation
              • Animation - Reset u's animation
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set i = (i + 1)
I tried a few obvious things and you can see them there (Naturally I didn't always have them all enabled each test every time)

Edit: Initially I were using channel instead of berzerk but I thought that maybe the problem came from playing the animation from the ability and then overriding it but there were no difference between triggering the initial animation or using it from an ability.
 
Level 21
Joined
Aug 13, 2011
Messages
739
This part wasn't firing off:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • i Equal to (AnimationTime_Converted x 2)
    • Then - Actions
      • Custom script: call SetUnitTimeScale(udg_u, 1.00)
      • Set i = 0
      • Animation - Reset u's animation
      • Trigger - Turn off (This trigger)
To fix it, just remove it from the "Else" statement from the If/Then/Else above it. It should look like this and then work properly:
  • Untitled Trigger 002
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to AnimationTime_Converted
        • Then - Actions
          • Custom script: call SetUnitTimeScale(udg_u, -0.5)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to (AnimationTime_Converted x 2)
        • Then - Actions
          • Custom script: call SetUnitTimeScale(udg_u, 1.00)
          • Set i = 0
          • Animation - Reset u's animation
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Set i = (i + 1)
A simple fix :pcon:
 
Level 12
Joined
Nov 3, 2013
Messages
989
Weird, I'm not much for efficency (im lazy enough to use gui after all) but even I wouldn't make my triggers less efficent on purpose.

Usually you don't want to have multiple if else since one rules out the other it's a waste :x
 
Status
Not open for further replies.
Top