Does "Unit Group - Remove" leaks?

asipo

New Member
Reaction score
15
I have been wandering some people use
Trigger:
  • Custom Script - call DestroyGroup( udg_myUnitGroup )

instead of
Trigger:
  • Unit Group - Remove all units from myUnitGroup

That have been made by world editor in GUI

  1. Does the Unit Group - Remove leaks?
  2. What the difference between them?
  3. What is leaks by the way?
  4. How to make Custom Script like Custom Script - call DestroyGroup( udg_myUnitGroup )
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Unit Group - Remove does not leak by itself.

A leak is short for "memory leak", which is what happens if something is stored in memory but never cleared. This happens in Warcraft if you set a variable to a new value without destroying the old value (only for some kinds of variables; you can read more here).

A unit group won't leak if you only add and remove units from it, but if you ever use Set Variable to create a group of units, you will need to destroy that group when you're done using it, before setting it to a value again.
 

asipo

New Member
Reaction score
15
Emm.. from the last sentence, what is Set Variable?
Issit a global variable in Trigger Editor -> Variables (Ctrl+B) -> New Variable (Ctrl+N)
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
It depends

If you always use the same group and full/clean it won't leak.

If you make many array groups, then it will leak.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Emm.. from the last sentence, what is Set Variable?
It's when you set a value to a variable. For example:
Trigger:
  • Actions
    • Set TempGroup = (Units within 500.00 of TempPoint)
    • -------- do things with the unit group here --------
    • Custom script: call DestroyGroup(udg_TempGroup)


However, you don't need to destroy the group if you only add and remove units from it:
Trigger:
  • Actions
    • Unit Group - Add (Last created unit) to TempGroup
    • -------- do things with the unit group here --------
    • Unit Group - Remove all units from TempGroup
 

Sui-cookie

You can change this now in User CP.
Reaction score
49
and "set variable" is an action....in fact, its one of the first. when you make a new action just look down the default list a few lines ;]

and btw i think its amazing that you know about custom scripts in removing leaks from triggers before you know about setting a variable :thup:
 

Karawasa

Element Tower Defense
Reaction score
38
however, you don't need to destroy the group if you only add and remove units from it:
Trigger:
  • actions
    • unit group - add (last created unit) to tempgroup
    • -------- do things with the unit group here --------
    • unit group - remove all units from tempgroup

This is the last thing you want to do, just so you know OP.
 

asipo

New Member
Reaction score
15
Ok, now i understand better
But how to make custom script? like
Trigger:
  • Custom Script - call DestroyGroup( udg_myUnitGroup )
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top