• 🏆 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] 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