The auto-deletion of a group is not automatic. For example, if you place a group in editor, name it (grp1), and kill the units in preview, this group remains not null and is counted as group (checked by count allGroups).
On the other hand, if you write: this deleteGroupWhenEmpty true in composition init (group init), this group will become null sometimes after the units are killed. It takes a little time for dead units to exit the group, then an extra time for the group to be deleted once all units dead. (count allGroups decreases).
Of course, in both cases, grp1 remains a variable ("grp1" is not nil).
Description
Marks given group for auto-deletion when group is empty. true will mark the group for auto-deletion once empty, false will simply unmark the group that was marked previously.
Important
This command does not prevent group deletion (through e.g deleteGroup or any engine group management).
Syntax
group deleteGroupWhenEmpty delete
Parameters:
group: Groupdelete: Boolean - true to mark for auto-deletion on empty group, false to not use this auto-deletion system
Returns: Nothing
Examples
Example 1
_group deleteGroupWhenEmpty true;
Example 2
Executed on the server:
if (local _group) then
{
_group deleteGroupWhenEmpty true;
}
else // group is local to a client
{
[_group, true] remoteExec ["deleteGroupWhenEmpty", groupOwner _group];
};
See also
deleteGroup · isGroupDeletedWhenEmpty · createGroup · group · setGroupId · groupID · units · groupFromNetId · netId · leader · selectLeader · join · createCenter · createUnit · createVehicle · Side