createGroup: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:Scripting Commands ArmA|" to "[[Category:Scripting Commands Armed Assault|")
m (Text replacement - "user= kju" to "user= .kju")
 
(71 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma |Game name=
|game1= ofpe
|version1= 1.00


|1.00|Game version=
|game2= arma1
|version2= 1.00


|eff= global |Multiplayer Effects=
|game3= arma2
____________________________________________________________________________________________
|version3= 1.00


| Creates a new [[Group]] for the given [[Side]]. An HQ (center) for that side must already be in the Mission.sqm or have been initialized with [[createCenter]]. For the available sides see [[Side]].
|game4= arma2oa
<br><br>
|version4= 1.50
'''NOTES'''
* The default limit of groups created per side was 144. Since Arma 3 v1.67 it is increased to 288.
* Since Arma 3 v 1.67 it is possible to mark created group for automatic deletion [[deleteGroupWhenEmpty|when the group becomes empty]] (see Alt Syntax). When group is set to be automatically deleted when empty, when group becomes empty it may take up to a minute for it to get deleted.<br><br>


{{Feature arma3|In Arma 3 when last unit leaves its group, the group usually gets immediately auto deleted, regardless of whether or not if it was set for auto deletion manually}}|DESCRIPTION=
|game5= tkoh
____________________________________________________________________________________________
|version5= 1.00


| [[createGroup]] side |SYNTAX=
|game6= arma3
|version6= 0.50


|p1= side: [[Side]] |PARAMETER1=
|gr1= Groups


| [[Group]] |RETURNVALUE=
|eff= global


|s2= [[createGroup]] [side, deleteWhenEmpty] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(''since Arma 3 v1.67'') |SYNTAX2=
|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
{{!}}}


|p21=  [side, deleteWhenEmpty]: [[Array]] |PARAMETER21=
{{Feature | important |
* Groups can only be created for the [[west]]/[[blufor]], [[opfor]]/[[east]], [[independent]]/[[resistance]], [[civilian]] and [[sideLogic]] sides - any other side will return [[grpNull]]
* Before {{arma3}}, a [[Side]] [[createCenter|center]] must exist before group creation (either by having editor-placed units or [[createCenter]] usage)
}}


|p22= side: [[Side]] |PARAMETER22=
{{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.
}}


|p23= deleteWhenEmpty: [[Boolean]] - [[true]] if delete this group [[deleteGroupWhenEmpty|when empty]]. Default: [[false]] (Note that it may take up to a minute for the group to get deleted) |PARAMETER23=
|s1= [[createGroup]] side


|r2= [[Group]] |RETURNVALUE2=
|p1= side: [[Side]]
____________________________________________________________________________________________
 
|x1= <code>_group = [[createGroup]] [[east]]</code> |EXAMPLE1=


|x2= <code>_group = [[createGroup]] [<nowiki/>[[east]], [[true]]];</code> |EXAMPLE2=
|r1= [[Group]] - [[grpNull]] if the group limit is reached
____________________________________________________________________________________________


| [[deleteGroup]], [[deleteGroupWhenEmpty]], [[isGroupDeletedWhenEmpty]], [[group]], [[setGroupId]], [[groupID]], [[units]], [[groupFromNetId]], [[netId]], [[leader]], [[selectLeader]], [[join]], [[createCenter]], [[createUnit]], [[createVehicle]], [[Side]] |SEEALSO=
|s2= [[createGroup]] [side, deleteWhenEmpty]
}}


<h3 style="display:none">Notes</h3>
|s2since= arma3 1.68
<dl class="command_description">
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on December 15, 2006 - 21:30
|p21= side: [[Side]]
<dt class="note">[[User:ColonelSandersLite|ColonelSandersLite]]
<dd class="note">
<br>The group limit is 144 groups groups per side.  If you attempt to create a group, and there is no room for another, it simply doesn't create, and it doesn't error.<br>


|p22= deleteWhenEmpty: [[Boolean]] - [[true]] to [[deleteGroupWhenEmpty|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.


<dd class="notedate">Posted on July 10,2007
|r2= [[Group]] - [[grpNull]] if the group limit is reached
<dt class="note">[[User:5133p39|5133p39]]
<dd class="note">
In '''{{arma}}''', 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.


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


<dd class="notedate">Posted on January 04, 2011
|x2= <sqf>private _group = createGroup [east, true];</sqf>
<dt class="note">[[User:kju|kju]]
<dd class="note">
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.


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


<!-- Note Section END -->
{{Note
</dl>
|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.
}}


<h3 style="display:none">Bottom Section</h3>
{{Note
 
|user= DreadedEntity
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
|timestamp= 20220504142023
[[Category:Scripting Commands OFP Elite|{{uc:{{PAGENAME}}}}]]
|text= New group is local to the machine that executed the command ('''A3 2.08.149102'''):
[[Category:Scripting Commands Armed Assault|{{uc:{{PAGENAME}}}}]]
<sqf>
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
player addAction ["Group Test (Dedicated Server)", {
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[], {
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
_test = createGroup [west, true];
[[Category:Command_Group:_Groups|{{uc:{{PAGENAME}}}}]]
[str (local _test)] remoteExec ["hint", -2]; //tell all clients group locality; true
[[Category:Command_Group:_Object_Manipulation|{{uc:{{PAGENAME}}}}]]
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
}];
</sqf>
}}

Latest revision as of 20:33, 3 May 2024

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 }];