• 🏆 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] How to prevent leakage but remain the unit?

Status
Not open for further replies.
Level 5
Joined
Sep 1, 2007
Messages
61
I used a triggered.
  • Time - Every 0.01 seconds of game time.
  • Set Triggering Unit Equal to TempUnit
  • Set TempPoint equal to position of TempUnit offset by 10 towards FacingAngle of TempUnit
  • Unit - Move TempUnit to TempPoint
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Set TempUnit = No Unit
Is this how to prevent unit leakage?
I don't want the unit to be removed, like:
  • Custom script: call RemoveUnit(udg_TempUnit)
so, set TempUnit to No Unit, is it the correct way?
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
I used a triggered.
  • Time - Every 0.01 seconds of game time.
  • Set Triggering Unit Equal to TempUnit
  • Set TempPoint equal to position of TempUnit offset by 10 towards FacingAngle of TempUnit
  • Unit - Move TempUnit to TempPoint
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Set TempUnit = No Unit
Is this how to prevent unit leakage?
I don't want the unit to be removed, like:
  • Custom script: call RemoveUnit(udg_TempUnit)
so, set TempUnit to No Unit, is it the correct way?

Unit leaks are fixed automatically. But you're still leaking a location, namely "Position of TempUnit". So you'll need 2 temporary point variables to get a polar projection.

  • Events
    • Time - Every 0.01 seconds of game time.
  • Actions
    • Set TempPoint = Position of Triggering Unit
    • Set TempPoint2 = TempPoint offset by 10 towards FacingAngle of Triggering Unit
    • Unit - Move Triggering Unit to TempPoint2
    • Custom script: call RemoveLocation(udg_TempPoint)
    • Custom script: call RemoveLocation(udg_TempPoint2)
But the trigger will not work anyway because no unit is triggering the trigger, so there's no "triggering unit".
 
Status
Not open for further replies.
Top