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

[Solved] Unit Groups

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
I was just wondering if there is any advantage over the two methods for fixing memory leaks in unit groups:

I typed the code up so excuse the errors. I hope it makes sense

1.)

  • Events
    • Time - Elapsed Time 5 seconds
  • Conditions
  • Actions
    • Set Variable - TempUnitGroup all players in (playable map area)
    • Unit Group - Pick every unit in TempUnitGroup and do actions
      • loop actions
      • Unit - Kill Picked Unit
    • Custom Script - call DestroyGroup (udg_TempUnitGroup)
2.)

  • Events
    • Time - Elapsed Time 5 seconds
  • Conditions
  • Actions
    • custom script - set bj = true (or whatever its called, i usually copy paste)
    • Unit Group - Pick every unit (playable map area) and do actions
      • loop actions
      • Unit - Kill Picked Unit
Is there any advantage/disadvantage over one or the other?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Use the second one as it uses less function call, no other extra variable needed.
Both serve as same function - to destroy Unit Group leak.

But when 2 Unit Group is involved in the same function, you would need the variables as if you do the second one, it will destroy the Unit Group, making it destroyed before the group is referenced.
 
Status
Not open for further replies.
Top