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

random Info about clearing UnitGroups

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
the difference between
Unit Group - Remove all units from Temp_UnitGroup
and
Custom script: call DestroyGroup (udg_Temp_UnitGroup)

is when you set the temp_unitgroup var to all units in area matching etc.. That is creating a unit group and filling it with units that match the conditions.

So then that unit group is destroyed with that variable at the end and the var is used to reference that unit group after its used.
Does that also make that unit group empty? before it destroys it?

Or is it possible that if units are still alive that were in that group if u go to use that same variable again units could pop up in there.

Also what happens if u set Temp_UnitGroup var to = all units in area matching etc.. and u then use this:
Unit Group - Remove all units from Temp_UnitGroup
will that clear it and not destroy it? and whats the difference exactly if there is no units left to reference in that group anymore
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
Does that also make that unit group empty? before it destroys it?
You use the same group variable, but it's not the same group. It is a new local group g that is returned by the GetUnitsInRangeOfLocMatching function.

Unit Group - Remove all units from Temp_UnitGroup
You can only remove single units or a groups from groups, but you should use Custom script: GroupClear(group) if you want to clear a group.
will that clear it and not destroy it?
Only if the group is empty it is cleared.
It is not destroyed.
and whats the difference exactly if there is no units left to reference in that group anymore
Cleared groups still exist, ergo can be used and consume a certain amount of memory.

Edit: Moved to World Editor Helping Zone
 
Level 13
Joined
Mar 24, 2010
Messages
950
-> It is a new local group g that is returned by the GetUnitsInRangeOfLocMatching function.

so if im using something like event
  • (Unit - A unit comes within 400.00 of (some unit))
And then use a group for
  • Set Temp_UnitGroup = (Units within 440.00 of Temp_Point matching ((etc etc..))
then its also making a local unit group? and not just using my global variable?
So then to make sure it runs well and no leaks should i declare it as a local..?

Also for some debugging triggers i had something that is
  • Set Temp_UnitGroup = (Units currently selected by Player 1 (Red))
but that seemed to have some weird side affects and trouble with selecting units for a min after doing that. Is there some weird error with that?
Is it better to use something like this
  • Set Temp_UnitGroup = (Units in (Playable map area) matching (((Matching unit) is selected by Player 1 (Red)) Equal to True))
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
And then use a group for
  • Set Temp_UnitGroup = (Units within 440.00 of Temp_Point matching ((etc etc..))

then its also making a local unit group? and not just using my global variable?
So then to make sure it runs well and no leaks should i declare it as a local..?

You can convert that into a custom text and check the functions, you see that the jass fuction creates a local group. The local group is then set to the global group variable.
 
Level 13
Joined
Mar 24, 2010
Messages
950
-> You can convert that into a custom text and check the functions, you see that the jass fuction creates a local group. The local group is then set to the global group variable.

Does it auto null that local var it makes or should i do that manually?
 
Last edited:
Status
Not open for further replies.
Top