[Trigger] Variable in the loop, or outside?

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,267
  • Unit Move
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Move and do (Actions)
        • Loop - Actions
          • Set TempPoint1 = (Position of (Picked unit))
          • Set TempPoint2 = (TempPoint1 offset by 50.00 towards (Facing of (Picked unit)) degrees)
          • Unit - Move (Picked unit) instantly to TempPoint2
          • Custom script: call RemoveLocation (udg_TempPoint1)
          • Custom script: call RemoveLocation (udg_TempPoint2)
OR

  • Unit Move
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set TempPoint1 = (Position of (Picked unit))
      • Set TempPoint2 = (TempPoint1 offset by 50.00 towards (Facing of (Picked unit)) degrees)
      • Unit Group - Pick every unit in Move and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to TempPoint2
      • Custom script: call RemoveLocation (udg_TempPoint1)
      • Custom script: call RemoveLocation (udg_TempPoint2)
Is it smartest to make the tempoint in the loop, or outside?
 
Level 23
Joined
Nov 29, 2006
Messages
2,483
You have to do it the first way. You see, if you try to use the second one it wont work, thus the TempPoint1 is referring to "position of picked unit". If you use it before the loop, the point will be set to " " (useless by other words), since "picked unit" isnt existing yet.
The same goes for TempPoint2 since its trying to create a location with the help of the first one, but since this is not declared, it will happend nothing here as well.

Conclusion: First one is the one to use, second one is useless.

Hm the event is perhaps not needed to be set to 0.05 seconds; Is it a "debug antistuck thingy"?

Edit: thats funny... graystuff was a little faster than me... yet, both is rounded up to same time :>
 
  • Like
Reactions: TKF
Top