deleteGroupWhenEmpty: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(29 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
|version1= 1.68 | |version1= 1.68 | ||
|arg= | |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, | |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|important|This command does '''not''' prevent group deletion (through e.g [[deleteGroup]] or any engine group management).}} | |||
{{Feature | | |||
|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]] | ||
|x1= < | |x1= <sqf>_group deleteGroupWhenEmpty true;</sqf> | ||
|x2= Executed on the server: | |||
<sqf> | |||
if (local _group) then | |||
{ | |||
_group deleteGroupWhenEmpty true; | |||
} | |||
else // group is local to a client | |||
{ | |||
[_group, true] remoteExec ["deleteGroupWhenEmpty", groupOwner _group]; | |||
}; | |||
</sqf> | |||
|seealso= [[deleteGroup]] [[isGroupDeletedWhenEmpty]] [[createGroup]] [[group]] [[setGroupId]] [[groupID]] [[units]] | |seealso= [[deleteGroup]] [[isGroupDeletedWhenEmpty]] [[createGroup]] [[group]] [[setGroupId]] [[groupID]] [[units]] [[groupFromNetId]] [[netId]] [[leader]] [[selectLeader]] [[join]] [[createCenter]] [[createUnit]] [[createVehicle]] [[Side]] | ||
}} | }} | ||
{{Note | {{Note | ||
|user= | |user= PierreMGI | ||
|timestamp= | |timestamp= 20231201050428 | ||
|text= | |text= 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: <sqf inline>this deleteGroupWhenEmpty true</sqf> 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). | ||
}} | }} |
Latest revision as of 12:37, 12 March 2024
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.
- 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:
- 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
- Posted on Dec 01, 2023 - 05:04 (UTC)
- 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).