{"name":"createGroup","operator":null,"title":"createGroup","type":"command","url":"https://community.bistudio.com/wiki/createGroup","revid":364085,"updated":"2024-05-03T19:33:29Z","groups":["Groups"],"status":"ok","replaced_by":[],"games":[{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":"global","server_exec":false},"exec":null,"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.\n\n|  |  |  |  |  |  |  |  |  |\n|---|---|---|---|---|---|---|---|---|\n| Game | Operation Flashpoint v1.00 | Operation Flashpoint: Elite v1.00 | Armed Assault v1.00 | Arma 2 v1.00 | Arma 2: Operation Arrowhead v1.50 | Take On Helicopters v1.00 | Arma 3 v1.00 | Arma 3 v1.68 |\n| Group auto-deletion | ✗ | ✓ |  |  |  |  |  |  |\n| Group limit per side | 63 | 144 | 288 |  |  |  |  |  |\n\n> [!IMPORTANT]\n> - Groups can only be created for the west/blufor, opfor/east, independent/resistance, civilian and sideLogic sides - any other side will return grpNull\n> - Before Arma 3, a Side center must exist before group creation (either by having editor-placed units or createCenter usage)\n\n> [!NOTE]\n> **Arma 3:** - createCenter usage is not needed anymore as all centers are automatically created.\n> - When the last unit leaves its group, the group usually gets immediately auto-deleted, regardless of its auto-deletion setting.","syntaxes":[{"syntax":"createGroup side","since":null,"effect":null,"exec":null,"params":[{"name":"side","type":"Side","optional":false,"default":null,"description":null,"types":["Side"],"since":null,"text":"side: Side"}],"returns":{"type":"Group","types":["Group"],"description":"grpNull if the group limit is reached","text":"Group - grpNull if the group limit is reached"},"form":"unary","operator":null,"left":null,"right":{"text":"side","types":["Side"]}},{"syntax":"createGroup [side, deleteWhenEmpty]","since":"arma3 1.68","effect":null,"exec":null,"params":[{"name":"side","type":"Side","optional":false,"default":null,"description":null,"types":["Side"],"since":null,"text":"side: Side"},{"name":"deleteWhenEmpty","type":"Boolean","optional":false,"default":null,"description":"true to delete the group when empty.\n- 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.\n- Deletion may take up to a minute after the last unit is removed.","types":["Boolean"],"since":null,"text":"deleteWhenEmpty: Boolean - true to delete the group when empty.\n- 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.\n- Deletion may take up to a minute after the last unit is removed."}],"returns":{"type":"Group","types":["Group"],"description":"grpNull if the group limit is reached","text":"Group - grpNull if the group limit is reached"},"form":"unary","operator":null,"left":null,"right":{"text":"[side, deleteWhenEmpty]","types":["Array"]}}],"examples":[{"text":"```sqf\nprivate _group = createGroup east;\n```","code":["private _group = createGroup east;"]},{"text":"```sqf\nprivate _group = createGroup [east, true];\n```","code":["private _group = createGroup [east, true];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["deleteGroup","deleteGroupWhenEmpty","isGroupDeletedWhenEmpty","group","setGroupId","groupID","units","groupFromNetId","netId","leader","selectLeader","join","createCenter","createUnit","createVehicle","Side"],"notes":[{"user":".kju","date":"2011-01-04T10:19:00Z","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."},{"user":"DreadedEntity","date":"2022-05-04T14:20:23Z","text":"New group is local to the machine that executed the command (**A3 2.08.149102**):\n\n```sqf\nplayer addAction [\"Group Test (Dedicated Server)\", {\n    [[], {\n        _test = createGroup [west, true];\n        [str (local _test)] remoteExec [\"hint\", -2]; //tell all clients group locality; true\n        missionNamespace setVariable [\"Group_Reference\", _test, true]; //broadcast group reference to all players\n    }] remoteExec [\"call\", 2]; //create group on dedicated server only\n    sleep 1;\n    _newGroup = missionNamespace getVariable \"Group_Reference\"; //receive group reference from server\n    systemChat format [\"Group local to player: %1\", local _newGroup]; //false\n}];\n```"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Groups","Introduced with Operation Flashpoint: Elite version 1.00","Operation Flashpoint: Elite: New Scripting Commands","Operation Flashpoint: Elite: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}