createGroup: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *(arg|eff|mp|serverExec|gr[0-9]) *= *(.*) * *\|([^=]{12})" to "|$1=$2 |descr=$3")
m (Text replacement - "\|x([0-9]) *= * <code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>")
 
(33 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| ofpe
|game1= ofpe
| 1.00
|version1= 1.00


|game2= arma1
|game2= arma1
Line 23: Line 23:
|eff= global
|eff= global


|descr= Creates a new [[Group]] for the given [[Side]].
|descr= Creates a new [[Group]] for the given [[Side]]. Using this command if the group limit is reached will return [[grpNull]]. The new [[Group]] exists globally, but it's locality is where this command was executed.
{{{!}} class="wikitable" style="text-align: center"
! Game
{{!}} {{GVI|ofp|1.00}}
{{!}} {{GVI|ofpe|1.00}}
{{!}} {{GVI|arma1|1.00}}
{{!}} {{GVI|arma2|1.00}}
{{!}} {{GVI|arma2oa|1.50}}
{{!}} {{GVI|tkoh|1.00}}
{{!}} {{GVI|arma3|1.00}}
{{!}} {{GVI|arma3|1.68}}
{{!}}-
! Group auto-deletion
{{!}} colspan="6" {{!}} {{Icon|unchecked}}
{{!}} colspan="2" {{!}} {{Icon|checked}}
{{!}}-
! Group limit per side
{{!}} 63
{{!}} colspan="6" {{!}} 144
{{!}} 288
{{!}}}


{{Feature | important |
{{Feature | important |
* Groups can only be created for the [[west]]/[[blufor]], [[opfor]]/[[east]], [[independent]]/[[resistance]], [[civilian]] and [[sideLogic]] sides.
* Groups can only be created for the [[west]]/[[blufor]], [[opfor]]/[[east]], [[independent]]/[[resistance]], [[civilian]] and [[sideLogic]] sides - any other side will return [[grpNull]]
* The default limit of groups per side is 288 since {{arma3}} v1.67 (144 before and in previous titles).
* Before {{arma3}}, a [[Side]] [[createCenter|center]] must exist before group creation (either by having editor-placed units or [[createCenter]] usage)
* Using a wrong side or trying to create a group when the groups limit is reached will fail silently and return [[grpNull]].
* Before {{arma3}} a [[Side]] [[createCenter|center]] must exist before group creation (either by having editor-placed units or [[createCenter]] usage).
}}
}}


{{Feature|arma3 |
{{Feature|arma3|
* [[createCenter]] usage is not needed anymore as all centers are automatically created.
* When the last unit leaves its group, the group usually gets immediately auto-deleted, regardless of its auto-deletion setting.
* When the last unit leaves its group, the group usually gets immediately auto-deleted, regardless of its auto-deletion setting.
* Usage of [[createCenter]] in {{arma3}} is not required anymore as all centers are automatically created.
}}
}}


|s1=   [[createGroup]] side
|s1= [[createGroup]] side


|p1= side: [[Side]]
|p1= side: [[Side]]


|r1= [[Group]]
|r1= [[Group]] - [[grpNull]] if the group limit is reached


|s2= [[createGroup]] [side, deleteWhenEmpty] {{Since|arma3|1.67|y}}
|s2= [[createGroup]] [side, deleteWhenEmpty]


|p21= [side, deleteWhenEmpty]: [[Array]]
|s2since= arma3 1.68


|p22= side: [[Side]]
|p21= side: [[Side]]


|p23= deleteWhenEmpty: [[Boolean]] - (Optional, default [[false]]) [[true]] to [[deleteGroupWhenEmpty|delete the group when empty]].
|p22= deleteWhenEmpty: [[Boolean]] - [[true]] to [[deleteGroupWhenEmpty|delete the group when empty]].
* If set to [[true]], ''deleteWhenEmpty'' forces a group to get deleted when empty - it does '''not''' prevent its deletion by other commands when set to [[false]].
* If set to [[true]], forces a group to get deleted when empty - it does '''not''' prevent its deletion by other commands when set to [[false]].
* Deletion may take up to a minute after the last unit is removed.
* Deletion may take up to a minute after the last unit is removed.


|r2= [[Group]]
|r2= [[Group]] - [[grpNull]] if the group limit is reached


|x1= <code>[[private]] _group = [[createGroup]] [[east]];</code>
|x1= <sqf>private _group = createGroup east;</sqf>


|x2= <code>[[private]] _group = [[createGroup]] [<nowiki/>[[east]], [[true]]];</code>
|x2= <sqf>private _group = createGroup [east, true];</sqf>


|seealso= [[deleteGroup]], [[deleteGroupWhenEmpty]], [[isGroupDeletedWhenEmpty]], [[group]], [[setGroupId]], [[groupID]], [[units]], [[groupFromNetId]], [[netId]], [[leader]], [[selectLeader]], [[join]], [[createCenter]], [[createUnit]], [[createVehicle]], [[Side]]
|seealso= [[deleteGroup]] [[deleteGroupWhenEmpty]] [[isGroupDeletedWhenEmpty]] [[group]] [[setGroupId]] [[groupID]] [[units]] [[groupFromNetId]] [[netId]] [[leader]] [[selectLeader]] [[join]] [[createCenter]] [[createUnit]] [[createVehicle]] [[Side]]
}}
}}


<dl class="command_description">
{{Note
|user= kju
|timestamp= 20110104101900
|text= A group created with [[createGroup]] will get a waypoint at [0,0,0]. When you use [[createUnit]] to fill it with units, it will get an additional waypoint at the position the first unit is created. This new waypoint will also be set as [[currentWaypoint]]. However keep these two waypoints in mind when you do some scripting involving this groups' waypoints.
}}


<dt><dt>
{{Note
<dd class="notedate">Posted on July 10, 2007</dd>
|user= DreadedEntity
<dt class="note">[[User:5133p39|5133p39]]</dt>
|timestamp= 20220504142023
<dd class="note">
|text= New group is local to the machine that executed the command ('''A3 2.08.149102'''):
In '''{{arma1}}''', empty groups are not automatically deleted - if you created 144 groups, you will not be able to create new group even if all units in all those groups died, because all the 144 groups still exists - you will have to delete some groups manually.
<sqf>
</dd>
player addAction ["Group Test (Dedicated Server)", {
 
[[], {
<dt><dt>
_test = createGroup [west, true];
<dd class="notedate">Posted on January 04, 2011</dd>
[str (local _test)] remoteExec ["hint", -2]; //tell all clients group locality; true
<dt class="note">[[User:kju|kju]]</dt>
missionNamespace setVariable ["Group_Reference", _test, true]; //broadcast group reference to all players
<dd class="note">
}] remoteExec ["call", 2]; //create group on dedicated server only
A group created with [[createGroup]] will get a waypoint at [0,0,0]. When you use [[createUnit]] to fill it with units, it will get an additional waypoint at the position the first unit is created. This new waypoint will also be set as [[currentWaypoint]]. However keep these two waypoints in mind when you do some scripting involving this groups' waypoints.
sleep 1;
</dd>
_newGroup = missionNamespace getVariable "Group_Reference"; //receive group reference from server
 
systemChat format ["Group local to player: %1", local _newGroup]; //false
</dl>
}];
 
</sqf>
{{GameCategory|ofpe|Scripting Commands}}
}}
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}

Latest revision as of 11:38, 13 May 2022

Hover & click on the images for description

Description

Description:
Creates a new Group for the given Side. Using this command if the group limit is reached will return grpNull. The new Group exists globally, but it's locality is where this command was executed.
Game Logo A0.png1.00 ofpe logo.png1.00 Logo A1 black.png1.00 Logo A2.png1.00 A2 OA Logo.png1.50 tkoh logo small.png1.00 Arma 3 logo black.png1.00 Arma 3 logo black.png1.68
Group auto-deletion Unchecked Checked
Group limit per side 63 144 288
Arma 3
  • createCenter usage is not needed anymore as all centers are automatically created.
  • When the last unit leaves its group, the group usually gets immediately auto-deleted, regardless of its auto-deletion setting.
Groups:
Groups

Syntax

Syntax:
createGroup side
Parameters:
side: Side
Return Value:
Group - grpNull if the group limit is reached

Alternative Syntax

Syntax:
createGroup [side, deleteWhenEmpty]
Parameters:
side: Side
deleteWhenEmpty: Boolean - true to delete the group when empty.
  • If set to true, forces a group to get deleted when empty - it does not prevent its deletion by other commands when set to false.
  • Deletion may take up to a minute after the last unit is removed.
Return Value:
Group - grpNull if the group limit is reached

Examples

Example 1:
private _group = createGroup east;
Example 2:
private _group = createGroup [east, true];

Additional Information

See also:
deleteGroup deleteGroupWhenEmpty isGroupDeletedWhenEmpty 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
kju - c
Posted on Jan 04, 2011 - 10:19 (UTC)
A group created with createGroup will get a waypoint at [0,0,0]. When you use createUnit to fill it with units, it will get an additional waypoint at the position the first unit is created. This new waypoint will also be set as currentWaypoint. However keep these two waypoints in mind when you do some scripting involving this groups' waypoints.
DreadedEntity - c
Posted on May 04, 2022 - 14:20 (UTC)
New group is local to the machine that executed the command (A3 2.08.149102):
player addAction ["Group Test (Dedicated Server)", { [[], { _test = createGroup [west, true]; [str (local _test)] remoteExec ["hint", -2]; //tell all clients group locality; true missionNamespace setVariable ["Group_Reference", _test, true]; //broadcast group reference to all players }] remoteExec ["call", 2]; //create group on dedicated server only sleep 1; _newGroup = missionNamespace getVariable "Group_Reference"; //receive group reference from server systemChat format ["Group local to player: %1", local _newGroup]; //false }];