• 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] To Destroy a Units Group or Not To Destroy?

Status
Not open for further replies.
Level 7
Joined
Mar 24, 2008
Messages
184
Hi
I have this trigger:

  • Actions
    • Set TempGroup = Blah
    • Unit Group - Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • Blah
    • Unit Group - Add all units of TempGroup to Group
    • Custom script: call DestroyGroup(udg_TempGroup)
    • Wait 5.00 seconds
    • Unit Group - Pick every unit in Group and do (Actions)
      • Loop - Actions
        • Blah
        • Unit Group - Remove (Picked unit) from Group
    • Custom script: call DestroyGroup(udg_Group)
    • Custom script: set udg_Group = null
The last 2 lines at the moment are disabled
This trigger gets all the units from a unit group and puts them into another. If i Destroy the second group the 2nd time i'll use the spell it won't work (setting it to null after destroying it doesn't help). Now, my question is:
Is it Ok to don't destroy the group and keep the small leak (which in the end is not a true leak since the group is always the same, just stays in memory for the whole map and gets used by this trigger), or there is some way to destroy the group and set it as empty when the trigger is activated again? As i said, setting it to null doesn't help (or maybe i'm doing it wrong) and it seems i can't set it to empty unit group through GUI commands.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Clear unit group will remain a small leak in the memory still (am I right?)

I made this experiment below one time, and it worked :)
Before you add all units of TempGroup to Group you can do
  • Set Group = (Units of type No unit-type)
It allows your destroyed Group to add units to it again and tries to create a unit group with all unit types on the map of no unit-type... Therefore it will be empty

/Regards
 
Status
Not open for further replies.
Top