• 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.

Why my flying height trigger isn't working?

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hi! I want to ask why my trigg. isn't working... i want my target to get in the air and then fall. (the Flying rate thing is for more realistic...) +rep for help!

  • The base TW trig
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Throw [SQueen]
    • Actions
      • Set ThrowAirRate = 0.30
      • Set ThrowUnits[0] = (Triggering unit)
      • Set ThrowUnits[1] = (Target unit of ability being cast)
      • Unit - Add Storm Crow Form to ThrowUnits[1]
      • Trigger - Turn on The loop TW trigg <gen>
  • The loop TW trigg
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current flying height of ThrowUnits[1]) Equal to 500.00
        • Then - Actions
          • Set ThrowAirRate = (ThrowAirRate - 0.02)
          • Animation - Change ThrowUnits[1] flying height to (Default flying height of ThrowUnits[1]) at ThrowAirRate
        • Else - Actions
          • Set ThrowAirRate = (ThrowAirRate + 0.02)
          • Animation - Change ThrowUnits[1] flying height to 500.00 at ThrowAirRate
 
Level 8
Joined
Jul 3, 2011
Messages
251
Hi! I want to ask why my trigg. isn't working... i want my target to get in the air and then fall. (the Flying rate thing is for more realistic...) +rep for help!

  • The base TW trig
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Throw [SQueen]
    • Actions
      • Set ThrowAirRate = 0.30
      • Set ThrowUnits[0] = (Triggering unit)
      • Set ThrowUnits[1] = (Target unit of ability being cast)
      • Unit - Add Storm Crow Form to ThrowUnits[1]
      • Trigger - Turn on The loop TW trigg <gen>
  • The loop TW trigg
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current flying height of ThrowUnits[1]) Equal to 500.00
        • Then - Actions
          • Set ThrowAirRate = (ThrowAirRate - 0.02)
          • Animation - Change ThrowUnits[1] flying height to (Default flying height of ThrowUnits[1]) at ThrowAirRate
        • Else - Actions
          • Set ThrowAirRate = (ThrowAirRate + 0.02)
          • Animation - Change ThrowUnits[1] flying height to 500.00 at ThrowAirRate

Do you mean why are the units not lifting in the air or why is the trigger itself not working? If the latter then the reason would be
  • If - Conditions
    • (Current flying height of ThrowUnits[1]) Equal to 500.00
This condition will only work if the flying height is exactly equal to 500, it will then decrease 2 then since its not 500 anymore will increase by 2, due to your other trigger. You should make a either a countdown or a boolean, the concept of the boolean is rather simple, just set it to true if the flying height is equal to or greater than 500, then for the If condition, use the boolean.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
My guess is that your flying rate is so low that you can't notice it.
Make ThrowAirRate a bigger value like 100.

Also, you should change the condition like Zaio mentioned.

  • (Current flying height of ThrowUnits[1]) Equal to 500.00
is the main problem. I think that the game counts the flying height the unit is trying to go to as the current flying height.
 
Level 8
Joined
Jul 3, 2011
Messages
251
  • Unit - Add Storm Crow Form to ThrowUnits[1]
You should also remove Crow Form

  • Trigger - Turn on The loop TW trigg <gen>
You shouldnt turn on a trigger if it is already on, you should create an integer and increase it by 1 each time the spell is cast, then when the effects end decrease it by 1, and at the start of the trigger check if the Integer is equal to 1 (After increasing it) if it is EQUAL to 1, you turn on the trigger else do nothing, and in the loop if the integer is EQUAL to 0, turn it off.

EDIT: Heres a spell made by Skamigo, the triggering unit gets lifted, paused in the air for a bit then forced down, looking like he jumped in the air and slashed down, hopefully it will be of some use to you.
  • Jumping Slash
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Jumping Slash
    • Actions
      • Set JumpingSlash_TriggerUnit = (Triggering unit)
      • Set JumpingSlash_Countdown = 100
      • Set JumpingSlash_TriggerPoint = (Position of JumpingSlash_TriggerUnit)
      • Set NumberPlayer = (Player number of (Owner of (Triggering unit)))
      • Set JumpingSlash_TargetPoint = (Target point of ability being cast)
      • Unit - Create 1 Dummy unit Universal for (Player(NumberPlayer)) at JumpingSlash_TargetPoint facing Default building facing degrees
      • Unit - Hide (Last created unit)
      • Set JumpingSlash_TargetUnitPoint = (Last created unit)
      • Unit - Add a 3.00 second Generic expiration timer to JumpingSlash_TargetUnitPoint
      • Set JumpingSlash_TargetPoint = (Position of JumpingSlash_TargetUnitPoint)
      • Set JumpingSlash_Angle = (Angle from JumpingSlash_TriggerPoint to JumpingSlash_TargetPoint)
      • Set JumpingSlash_DistanceLeap = ((Distance between JumpingSlash_TriggerPoint and JumpingSlash_TargetPoint) / 100.00)
      • Unit - Turn collision for JumpingSlash_TriggerUnit Off
      • Unit - Add Crow Form to (Triggering unit)
      • Unit - Remove Crow Form from (Triggering unit)
      • Unit - Pause JumpingSlash_TriggerUnit
      • Unit - Make JumpingSlash_TriggerUnit Invulnerable
      • Custom script: call RemoveLocation(udg_JumpingSlash_TriggerPoint)
      • Custom script: call RemoveLocation(udg_JumpingSlash_TargetPoint)
      • Trigger - Turn on Jumping Slash Cast Up <gen>
  • Jumping Slash Cast Up
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set JumpingSlash_Countdown = (JumpingSlash_Countdown - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • JumpingSlash_Countdown Less than or equal to 50
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Animation - Play JumpingSlash_TriggerUnit's Attack Slam animation
          • Trigger - Turn on Jumping Slash Cast Down <gen>
        • Else - Actions
          • Set JumpingSlash_TriggerPoint = (Position of JumpingSlash_TriggerUnit)
          • Set JumpingSlash_TargetPoint = (Position of JumpingSlash_TargetUnitPoint)
          • Set JumpingSlash_Angle = (Angle from JumpingSlash_TriggerPoint to JumpingSlash_TargetPoint)
          • Set JumpingSlash_DistanceLeap = ((Distance between JumpingSlash_TriggerPoint and JumpingSlash_TargetPoint) / 100.00)
          • Animation - Change JumpingSlash_TriggerUnit flying height to ((Current flying height of JumpingSlash_TriggerUnit) + 3.00) at 0.00
          • Set JumpingSlash_Point = (JumpingSlash_TriggerPoint offset by (JumpingSlash_DistanceLeap x (100.00 - (Real(JumpingSlash_Countdown)))) towards JumpingSlash_Angle degrees)
          • Unit - Move JumpingSlash_TriggerUnit instantly to JumpingSlash_Point
          • Custom script: call RemoveLocation(udg_JumpingSlash_Point)
          • Custom script: call RemoveLocation(udg_JumpingSlash_TriggerPoint)
          • Custom script: call RemoveLocation(udg_JumpingSlash_TargetPoint)
  • Jumping Slash Cast Down
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set JumpingSlash_Countdown = (JumpingSlash_Countdown - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • JumpingSlash_Countdown Less than or equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Set JumpingSlash_TargetPoint = (Position of JumpingSlash_TargetUnitPoint)
          • Animation - Change JumpingSlash_TriggerUnit flying height to (Default flying height of JumpingSlash_TriggerUnit) at 0.00
          • Animation - Reset JumpingSlash_TriggerUnit's animation
          • Unit - Make JumpingSlash_TriggerUnit Vulnerable
          • Unit - Turn collision for JumpingSlash_TriggerUnit On
          • Unit - Unpause JumpingSlash_TriggerUnit
          • Unit - Create 1 Dummy unit Universal for (Owner of JumpingSlash_TriggerUnit) at JumpingSlash_TargetPoint facing Default building facing degrees
          • Unit - Add Jump Slash (stun) to (Last created unit)
          • Unit - Hide (Last created unit)
          • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Set JumpingSlash_Countdown = 100
          • Set JumpingSlash_UnitGroup = (Units within 410.00 of JumpingSlash_TargetPoint matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of JumpingSlash_TriggerUnit)) Equal to True)))
          • Unit Group - Pick every unit in JumpingSlash_UnitGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause JumpingSlash_TriggerUnit to damage (Picked unit), dealing (((Real((Level of Jumping Slash for JumpingSlash_TriggerUnit))) x 150.00) x ((Real(Weaponcraft[(Player number of (Owner of JumpingSlash_TriggerUnit))])) / 100.00)) damage of attack type Spells and damage type Normal
          • Custom script: call RemoveLocation(udg_JumpingSlash_TargetPoint)
          • Trigger - Turn on Jumping Slash Pulse <gen>
        • Else - Actions
          • Set JumpingSlash_TriggerPoint = (Position of JumpingSlash_TriggerUnit)
          • Set JumpingSlash_TargetPoint = (Position of JumpingSlash_TargetUnitPoint)
          • Set JumpingSlash_Angle = (Angle from JumpingSlash_TriggerPoint to JumpingSlash_TargetPoint)
          • Set JumpingSlash_DistanceLeap = ((Distance between JumpingSlash_TriggerPoint and JumpingSlash_TargetPoint) / 100.00)
          • Animation - Change JumpingSlash_TriggerUnit flying height to ((Current flying height of JumpingSlash_TriggerUnit) - 3.00) at 0.00
          • Set JumpingSlash_Point = (JumpingSlash_TriggerPoint offset by (JumpingSlash_DistanceLeap x (100.00 - (Real(JumpingSlash_Countdown)))) towards JumpingSlash_Angle degrees)
          • Unit - Move JumpingSlash_TriggerUnit instantly to JumpingSlash_Point
          • Custom script: call RemoveLocation(udg_JumpingSlash_Point)
          • Custom script: call RemoveLocation(udg_JumpingSlash_TriggerPoint)
          • Custom script: call RemoveLocation(udg_JumpingSlash_TargetPoint)
  • Jumping Slash Pulse
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set JumpingSlash_Countdown = (JumpingSlash_Countdown - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • JumpingSlash_Countdown Less than or equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Set JumpingSlash_TargetPoint = (Position of JumpingSlash_TargetUnitPoint)
          • Set JumpingSlash_UnitGroup = (Units within 410.00 of JumpingSlash_TargetPoint matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of JumpingSlash_TriggerUnit)) Equal to True)))
          • Unit Group - Pick every unit in JumpingSlash_UnitGroup and do (Actions)
            • Loop - Actions
              • Set JumpingSlash_TargetPoint2 = (Position of (Picked unit))
              • Set JumpingSlash_Angle = (Angle from JumpingSlash_TargetPoint to JumpingSlash_TargetPoint2)
              • Set JumpingSlash_distance2 = (Distance between JumpingSlash_TargetPoint and JumpingSlash_TargetPoint2)
              • Set JumpingSlash_DistanceLeap = (((400.00 - JumpingSlash_distance2) / 100.00) x (100.00 - (Real(JumpingSlash_Countdown))))
              • Set JumpingSlash_Point = (JumpingSlash_TargetPoint offset by (JumpingSlash_distance2 + JumpingSlash_DistanceLeap) towards JumpingSlash_Angle degrees)
              • Unit - Move (Picked unit) instantly to JumpingSlash_Point
              • Custom script: call RemoveLocation(udg_JumpingSlash_Point)
          • Custom script: call DestroyGroup(udg_JumpingSlash_UnitGroup)
          • Custom script: call RemoveLocation(udg_JumpingSlash_TargetPoint)
          • Custom script: call RemoveLocation(udg_JumpingSlash_TargetPoint2)
 
Last edited:
Level 14
Joined
Nov 18, 2007
Messages
1,084
Sorry, I meant that condition itself just fails. It will always return true because getting the current flying height will give you the flying height the unit is ascending to.

Instead of relying on "Current flying height," you should use another variable that actually keeps track of how high the unit has ascended and set the unit's flying height manually.
Something like this:
  • Set ThrowUnitHeight = 0.00 // When the spell is cast
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ThrowUnitHeight Greater than or equal to 500.00
    • Then - Actions
      • -------- Falling actions --------
    • Else - Actions
      • Set ThrowUnitHeight = (ThrowUnitHeight + 5.00)
      • Animation - Change ThrowUnits[1] flying height to ThrowUnitHeight at 0.00 // 0 to make it instant
Note that my example doesn't account for acceleration, which would probably need another variable to keep track of how long it's been ascending.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Thanks guys! I now have smooth jump in the air! :)
  • The base TW trig
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Throw [SQueen]
    • Actions
      • Set ThrowNormalHeight = 0.30
      • Set ThrowUnits[0] = (Triggering unit)
      • Set ThrowUnits[1] = (Target unit of ability being cast)
      • Set ThrowTargetHeight = 0.00
      • Set ThrowAcceleration = 70.00
      • Set ThrowUnitReachedMaxHeight = False
      • Unit - Add Storm Crow Form to ThrowUnits[1]
      • Trigger - Turn on The loop TW trigg <gen>
  • The loop TW trigg
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ThrowUnitReachedMaxHeight Equal to True
        • Then - Actions
          • Set ThrowAcceleration = (ThrowAcceleration + 6.00)
          • Set ThrowTargetHeight = (ThrowTargetHeight - ThrowAcceleration)
          • Animation - Change ThrowUnits[1] flying height to ThrowTargetHeight at 0.00
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ThrowUnitReachedMaxHeight Equal to False
        • Then - Actions
          • Set ThrowAcceleration = (ThrowAcceleration - 4.00)
          • Set ThrowTargetHeight = (ThrowTargetHeight + ThrowAcceleration)
          • Animation - Change ThrowUnits[1] flying height to ThrowTargetHeight at 0.00
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ThrowAcceleration Less than or equal to 1.00
        • Then - Actions
          • Set ThrowUnitReachedMaxHeight = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current flying height of ThrowUnits[1]) Less than or equal to 2.00
        • Then - Actions
          • Unit - Remove Storm Crow Form from ThrowUnits[1]
          • Animation - Change ThrowUnits[1] flying height to (Default flying height of ThrowUnits[1]) at 0.00
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Trigger - Turn on The loop TW trigg <gen>
You shouldnt turn on a trigger if it is already on, you should create an integer and increase it by 1 each time the spell is cast, then when the effects end decrease it by 1, and at the start of the trigger check if the Integer is equal to 1 (After increasing it) if it is EQUAL to 1, you turn on the trigger else do nothing, and in the loop if the integer is EQUAL to 0, turn it off.
In the WE, my trigger is initially OFF, but the hive shows it's ON! :)
 
Last edited by a moderator:
Status
Not open for further replies.
Top