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

[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