• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Variable in the loop, or outside?

Status
Not open for further replies.

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
  • 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,482
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
Status
Not open for further replies.
Top