{"name":"BIS_fnc_spawnGroup","operator":null,"title":"BIS fnc spawnGroup","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_spawnGroup","revid":378466,"updated":"2026-04-21T15:38:13Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"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":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Function which handles the spawning of a dynamic group of characters. The composition of the group can be passed to the function.\nAlternatively, a number can be passed and the function will spawn that amount of characters with a random type.\n\n> [!NOTE]\n> **Before Arma 3** a side's Center must have been created before a group may be spawned either by using createCenter or an editor placed (0% Probability of Presence is fine) unit of the appropriate side.","syntaxes":[{"syntax":"[position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call BIS_fnc_spawnGroup","since":null,"effect":null,"exec":null,"params":[{"name":"position","type":"Array format Position","optional":false,"default":null,"description":"group's starting position","types":["Array","Position"],"since":null,"text":"position: Array format Position - group's starting position"},{"name":"side","type":"Side","optional":false,"default":null,"description":"group's side","types":["Side"],"since":null,"text":"side: Side - group's side"},{"name":"toSpawn","type":null,"optional":false,"default":null,"description":"can be one of:\n- Array - list of character types (**only** viable option for the civilian side as no civilian groups are defined in config)\n- Number - amount of characters to spawn\n- Config - CfgGroups entry","types":[],"since":null,"text":"toSpawn - can be one of:\n- Array - list of character types (**only** viable option for the civilian side as no civilian groups are defined in config)\n- Number - amount of characters to spawn\n- Config - CfgGroups entry"},{"name":"relPositions","type":"Array of Positions","optional":true,"default":"`[]`","description":"a list of relative positions","types":["Array","Position"],"since":null,"text":"relPositions: Array of Positions (Optional, default `[]`) a list of relative positions"},{"name":"ranks","type":"Array of Strings/Numbers","optional":true,"default":"`[]`","description":"ranks (see BIS_fnc_setRank) - **must** be same size as *toSpawn*'s array","types":["Array","String","Number"],"since":null,"text":"ranks: Array of Strings/Numbers - (Optional, default `[]`) ranks (see BIS_fnc_setRank) - **must** be same size as *toSpawn*'s array"},{"name":"skillRange","type":"Array of Numbers","optional":true,"default":"`[]`","description":"skill range format [min, max]","types":["Array","Number"],"since":null,"text":"skillRange: Array of Numbers - (Optional, default `[]`) skill range format [min, max]"},{"name":"ammoRange","type":"Array of Numbers","optional":true,"default":"`[]`","description":"ammunition range (0..1) format [min, max]","types":["Array","Number"],"since":null,"text":"ammoRange: Array of Numbers - (Optional, default `[]`) ammunition range (0..1) format [min, max]"},{"name":"randomControls","type":"Array of Numbers","optional":true,"default":"[-1, 1]","description":"to format [minUnits, chance]:\n- minUnits: Number - (Optional, default -1) amount of mandatory units\n- chance: Number - (Optional, default -1) spawn chance for remaining units in range 0..1","types":["Array","Number"],"since":null,"text":"randomControls: Array of Numbers - (Optional, default [-1, 1]) to format [minUnits, chance]:\n- minUnits: Number - (Optional, default -1) amount of mandatory units\n- chance: Number - (Optional, default -1) spawn chance for remaining units in range 0..1"},{"name":"azimuth","type":"Number","optional":true,"default":"0","description":"azimuth/direction","types":["Number"],"since":null,"text":"azimuth: Number - (Optional, default 0) azimuth/direction"},{"name":"precisePos","type":"Boolean","optional":true,"default":"true","description":"forces precise position placement","types":["Boolean"],"since":null,"text":"precisePos: Boolean - (Optional, default true) forces precise position placement"},{"name":"maxVehicles","type":"Number","optional":true,"default":"10e10","description":"vehicle number limit","types":["Number"],"since":null,"text":"maxVehicles: Number - (Optional, default 10e10) vehicle number limit"}],"returns":{"type":"Group","types":["Group"],"description":null,"text":"Group"}}],"examples":[{"text":"Spawn five random EAST units at aPosition:\n\n```sqf\n[getPosATL aPosition, east, 5] call BIS_fnc_spawnGroup;\n```","code":["[getPosATL aPosition, east, 5] call BIS_fnc_spawnGroup;"]},{"text":"Spawn a Stryker MGS Platoon at marker \"tankSpawn\":\n\n```sqf\n[getMarkerPos \"tankSpawn\", side player, (configFile >> \"CfgGroups\" >> \"West\" >> \"BIS_US\" >> \"Armored\" >> \"US_MGSPlatoon\")] call BIS_fnc_spawnGroup;\n```","code":["[getMarkerPos \"tankSpawn\", side player, (configFile >> \"CfgGroups\" >> \"West\" >> \"BIS_US\" >> \"Armored\" >> \"US_MGSPlatoon\")] call BIS_fnc_spawnGroup;"]},{"text":"Spawn a TK Militia Medic and Soldier at aPos facing south:\n\n```sqf\n[getPos aPos, east, [\"TK_INS_Bonesetter_EP1\", \"TK_INS_Soldier_2_EP1\"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;\n```","code":["[getPos aPos, east, [\"TK_INS_Bonesetter_EP1\", \"TK_INS_Soldier_2_EP1\"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["Arma 2: CfgVehicles","Arma 3: Assets"],"notes":[{"user":"Snake Plissken","date":"2016-08-23T02:42:00Z","text":"Sides are as follow:\n- west/blufor = BLUFOR\n- east/opfor = OPFOR\n- resistance/independent = INDEPENDENT\n- civilian = CIVILIAN.\n\nTo spawn one BLUFOR group (\"MARK1\" is the name given to a map marker):\n\n```sqf\nGroup_Name_Here = [getMarkerPos \"MARK1\", WEST, [\"B_G_Soldier_A_F\", \"B_G_Soldier_F\", \"B_G_Soldier_AR_F\", \"B_G_Soldier_LAT_F\"]] call BIS_fnc_spawnGroup;\n```\n\nOr a random group OPFOR of seven units\n\n```sqf\nGroup_Name_Here = [getMarkerPos \"MARK1\", EAST, 7] call BIS_fnc_spawnGroup;\n```\n\nan independent group:\n\n```sqf\nGroup_Name_Here = [getMarkerPos \"MARK1\", INDEPENDENT, [\"I_G_Soldier_A_F\", \"I_G_Soldier_F\", \"I_G_Soldier_AR_F\", \"I_G_Soldier_LAT_F\"]] call BIS_fnc_spawnGroup;\n```"},{"user":"Cheitan","date":"2017-08-02T19:06:00Z","text":"When using this function for making a dynamic AI spawn, pay attention to the fact that none of the created groups will be marked for auto-deletion when the group become empty (all members dead). It means that it can be very easy to hit the 144 (288 for A3) max groups per side limitation, implying that no more AI or group can be created afterwards. To avoid this issue on Arma 3, don't forget to use deleteGroupWhenEmpty command in your script."}],"categories":["Arma 2: Functions","Arma 2: New Functions","Arma 2: Operation Arrowhead: Functions","Arma 3: Functions","Function Group: Object Manipulation","Functions","Introduced with Arma 2 version 1.00","Take On Helicopters: Functions"],"docblock":null,"filled_from_docblock":[]}