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

Clearing Leaks

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hey guys :) Can somebody tell me how I clear leaks in following trigger:
upload_2020-5-3_21-26-35.png


I have no idea what to remove here, but Iam certain this trigger leaks.

Maybe someone could help out :)!
 
Level 20
Joined
Feb 23, 2014
Messages
1,265
I'd say there's also a unit group leak in the condition.

@Mechcash read the guides above and try to figure it out by yourself, it will give you a lot more than anyone posting a solution for you. If you fail or have questions, come back and I'll help you out.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
You're leaking a unit group and a point and a region. They're not referenced hence they leak.
What you should do is to refer them first via variables, so open the variable creator (Ctrl + B)
And create a unit group variable, then a point variable, and lastly a region variable.

After this, set their appropriate values via GUI action 'Set Variable'.
Now you can use them as a reference and remove them after use.

You must set the region variable on initialization so we can reference it dynamically.
You must also put the condition below the actions so that you can use the newly created group variable.

Should be something like this:
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Setup Your Region Variable --------
      • Set MyRegion = (Entire map)
  • Periodic
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • -------- Setup Your Group Variable --------
      • Set MyGroup = (Units of type Footman)
      • -------- Use it as a reference in this condition --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in MyGroup) Less than or equal to 50
        • Then - Actions
          • -------- Setup Your Point Variable --------
          • Set MyPoint = (Random point in MyRegion)
          • -------- Use it as a reference in this function --------
          • Unit - Create 1 Footman for Player 1 (Red) at MyPoint facing Default building facing degrees
          • -------- Point Leak Removal --------
          • Custom script: call RemoveLocation(udg_MyPoint)
          • -------- - --------
          • -------- Setup Your Point Variable to a New Point --------
          • Set MyPoint = (Random point in MyRegion)
          • -------- Use it as a reference in this function --------
          • Unit - Order (Last created unit) to Patrol To MyPoint
          • -------- New Point Leak Removal --------
          • Custom script: call RemoveLocation(udg_MyPoint)
          • -------- - --------
        • Else - Actions
      • -------- - --------
      • -------- Group Leak Removal --------
      • Custom script: call DestroyGroup(udg_MyGroup)
      • -------- - --------
      • -------- If you're curious why I didn't destroyed entire rect then you shouldn't worry. --------
      • -------- We only leak that region once in the map initialization and using it dynamically. --------
      • -------- - --------
 
It can be tested if "(Entire map)" creates a new region each call, or always returns the same one by calling "GetHandleId()" function.
  • Set Region = (Entire map)
  • Custom script: call BJDebugMsg(I2S(GetHandleId(udg_Region)))
  • Set Region = (Entire map)
  • Custom script: call BJDebugMsg(I2S(GetHandleId(udg_Region)))
If it prints 2 different numbers it leaks
 
Status
Not open for further replies.
Top