deleteGroupWhenEmpty: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\{\{Note([^}]*)<code>([^<]*)<\/code>" to "{{Note$1<sqf>$2</sqf>")
(Fix locality + deleteWhenEmpty description)
Line 4: Line 4:
|version1= 1.68
|version1= 1.68


|arg= global
|arg= local


|eff= global
|eff= global
Line 10: Line 10:
|gr1= Groups
|gr1= Groups


|descr= Marks given group for auto-deletion when group is empty. [[true]] will mark the group for auto-deletion, however [[false]] will only unmark the group that was marked previously. Other engine group auto-deletion mechanisms in place are not affected by this.
|descr= 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.
{{Feature | Informative | It might take up to a minute for the groups marked for auto-deletion when empty to get deleted when they become empty.}}
{{Feature|important|This command does '''not''' prevent group deletion (through e.g [[deleteGroup]] or any engine group management.}}
{{Feature | Important | This command sets the group deletion flag, similar to the flag being set during group creation. [[true|True]] does not mean that the group will be deleted but that it was suggested to the engine that it should be deleted. It is up to the engine how it manages groups. [[false|False]] does not mean that the group will not be deleted '''at all'''. It has no influence on the engine functionality whatsoever. }}


|s1= group [[deleteGroupWhenEmpty]] delete
|s1= group [[deleteGroupWhenEmpty]] delete
Line 19: Line 18:
|p1= group: [[Group]]
|p1= group: [[Group]]


|p2= delete: [[Boolean]] - [[true]] to mark for auto-deletion
|p2= delete: [[Boolean]] - [[true]] to mark for auto-deletion on empty group, [[false]] to not use this auto-deletion system


|r1= [[Nothing]]
|r1= [[Nothing]]
Line 25: Line 24:
|x1= <sqf>_group deleteGroupWhenEmpty true;</sqf>
|x1= <sqf>_group deleteGroupWhenEmpty true;</sqf>


|seealso= [[deleteGroup]] [[isGroupDeletedWhenEmpty]] [[createGroup]] [[group]] [[setGroupId]] [[groupID]] [[units]] [[groupFromNetId]] [[netId]] [[leader]] [[selectLeader]] [[join]] [[createCenter]] [[createUnit]] [[createVehicle]] [[Side]]
|x2= Executed on the server:
}}
<sqf>
 
if (local _group) then
{{Note
|user= Wyqer
|timestamp= 20180208220100
|text= It seems, that the argument has to be local (like for deleteGroup).
So if you run it on a server and the group isn't local to the server this wouldn't work:
<sqf>_group deleteGroupWhenEmpty true;</sqf>
But this would work:
<sqf>if (local _group) then
{
{
_group deleteGroupWhenEmpty true;
_group deleteGroupWhenEmpty true;
}
}
else
else // group is local to a client
{
{
[_group, true] remoteExec ["deleteGroupWhenEmpty", groupOwner _group];
[_group, true] remoteExec ["deleteGroupWhenEmpty", groupOwner _group];
};</sqf>
};
</sqf>
 
|seealso= [[deleteGroup]] [[isGroupDeletedWhenEmpty]] [[createGroup]] [[group]] [[setGroupId]] [[groupID]] [[units]] [[groupFromNetId]] [[netId]] [[leader]] [[selectLeader]] [[join]] [[createCenter]] [[createUnit]] [[createVehicle]] [[Side]]
}}
}}

Revision as of 16:32, 9 December 2022

Hover & click on the images for description

Description

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.
This command does not prevent group deletion (through e.g deleteGroup or any engine group management.
Groups:
Groups

Syntax

Syntax:
group deleteGroupWhenEmpty delete
Parameters:
group: Group
delete: Boolean - true to mark for auto-deletion on empty group, false to not use this auto-deletion system
Return Value:
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]; };

Additional Information

See also:
deleteGroup isGroupDeletedWhenEmpty createGroup group setGroupId groupID units groupFromNetId netId leader selectLeader join createCenter createUnit createVehicle Side

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note