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

[Trigger] Knockback not stopping!

Status
Not open for further replies.
Level 17
Joined
Jul 15, 2009
Messages
632
Hello,

I'm working on a item that knocks the caster back (or forward in this case).
Now, the unit starts moving but it never stops, what am I doing wrong?

(I made it so that every player can use it at once, no need to make multiple units use it since it's only for heroes, of which players only have 1)


  • Warp
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Warping Stick
    • Actions
      • Set KnockbackAngle[(Player number of (Owner of (Triggering unit)))] = (Facing of (Triggering unit))
      • Set KnockbackDistance[(Player number of (Owner of (Triggering unit)))] = 300.00
      • Set KnockbackEffect[(Player number of (Owner of (Triggering unit)))] = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
      • Set KnockbackUnit[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Unit Group - Add (Triggering unit) to KnockbackGroup
  • KnockbackLoops
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (KnockbackUnit[(Integer A)] is in KnockbackGroup) Equal to True
            • Then - Actions
              • Set TempPoint = ((Position of KnockbackUnit[(Integer A)]) offset by 25.00 towards KnockbackAngle[(Integer A)] degrees)
              • Special Effect - Create a special effect at TempPoint using KnockbackEffect[(Integer A)]
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move KnockbackUnit[(Integer A)] instantly to TempPoint
              • Set KnockbackDistance[(Integer A)] = (KnockbackDistance[(Integer A)] - 25.00)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KnockbackDistance[(Integer A)] Equal to 0.00
                • Then - Actions
                  • Unit Group - Remove KnockbackUnit[(Integer A)] from KnockbackGroup
                  • Set KnockbackUnit[(Integer A)] = No unit
                  • Set KnockbackAngle[(Integer A)] = 0.00
                  • Set KnockbackEffect[(Integer A)] = <Empty String>
                • Else - Actions
            • Else - Actions
          • Custom script: call RemoveLocation( udg_TempPoint )
 
First off, you can use hashtables.

Secondly, you can use Unit - Pick Units in Group action, instead of looping with Integer A:
  • KnockbackLoops
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (KnockbackGroup is empty) Equal to True
      • Then - Actions
        • Trigger - Turn off (This trigger)
      • Else - Actions
        • Unit Group - Pick every unit in KnockbackGroup and do (Actions)
          • Loop - Actions
            • Set Point = (Position of (Picked unit))
            • Set Point1 = (Point offset by 25.00 towards KnockbackAngle[(Player number of (Owner of (Picked unit)))]
            • Unit - Move (Picked unit) instantly to Point1
            • Special Effect - Create a special effect at Point1 using KnockbackEffect[(Player number of (Owner of (Picked unit)))]
            • Special Effect - Destroy (Last created special effect)
            • Set KnockbackDistance[(Player number of (Owner of (Picked unit)))] = (KnockbackDistance[(Player number of (Owner of (Picked unit)))] - 25.00)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • KnockbackDistance[(Player number of (Owner of (Picked unit)))] Less than or Equal to 0.00
              • Then - Actions
                • Unit Group - Remove (Picked unit) from KnockbackGroup
              • Else - Actions
            • Custom script: call RemoveLocation (udg_Point)
            • Custom script: call RemoveLocation (udg_Point1)
 
Level 9
Joined
Dec 12, 2007
Messages
489
try to change the last check,
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • KnockbackDistance[(Integer A)] Equal to 0.00
change from "Equal to" into "Less than or equal to" for safety...

and for additional info, your trigger leaks lots of locations... on the polar projection.
 
Level 17
Joined
Jul 15, 2009
Messages
632
How about in the Warp section, add a trigger that turns on KnockbackLoops
Then at the end of KnockbackLoops, add an If-Then statement:

If(KnockbackGroup is empty) equal to True, then Turn off this trigger.

http://war3.incgamers.com/forums/showthread.php?t=40995
" Moving multiple units different distances and directions with the same loop" section

Leak!

If you like, you can help testing TA in a bit, on Northrend though so make a account..
 
Status
Not open for further replies.
Top