unit group question

SyrisX

New Member
Reaction score
3
Say you use the action "Add unit to unit group", And at a later point you remove that unit from the game. Does that unit group still have a unit in it?

Meaning does it leak if you don't also remove the unit group?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, it'll leak one, single unit-group, as you've created one at some time, and it isn't destroyed...
 

SyrisX

New Member
Reaction score
3
Say I have a unit group that will have units added to it and removed constantly throughout the game. But it will never have 0 units and therefor cannot be destroyed without affecting gameplay.

Is this something that will cause a lot of lag over time? Or is a leak such as this acceptable?
 

Joccaren

You can change this now in User CP.
Reaction score
54
I don't think it should be to bad, my maps have a lot of leaks that have never caused any really major lag.
 

Genkora

Frog blast the vent core!
Reaction score
92
as long as you keep using the same unit group, it wont leak. It is when you create a unit group, never use it again, and fail to destroy it that leaks.

Anytime you use "set unit group = units is playable map" or something, you need to destroy that unit group eventually. If you do something like "add unit to unit group" then you don't.

Don't quote me on this though, I haven't mapped in a while.
 

SyrisX

New Member
Reaction score
3
I am attempting to make everything I do leakless.. My problem is I am unsure as how to do it in this one instance. The unit group I am using for this system is helping me keep track of units that play an integral part in the game.
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
Say I have a unit group that will have units added to it and removed constantly throughout the game. But it will never have 0 units and therefor cannot be destroyed without affecting gameplay.

Is this something that will cause a lot of lag over time? Or is a leak such as this acceptable?
It will cause a minor leak and will slow down any operations using that group. If a unit is still in a unit group when it disappears from the game, either by calling RemoveUnit or by dying and then decaying, it will leave a "ghost reference" in the group. It won't show up in a "Pick all units..." operation, nor will it be counted in the number of units in the group, but the reference will be there, slowing things down.

Whenever possible, remove a unit from a unit group before removing the unit.

It's possible to clean out a unit group of "ghost references" even when it still has units in it - Captain Griffin on wc3c.net wrote a function called GroupRefresh to do so.
 
General chit-chat
Help Users

      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