{"name":"BIS_fnc_spawnEnemy","operator":null,"title":"BIS fnc spawnEnemy","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_spawnEnemy","revid":337523,"updated":"2023-02-03T22:19:23Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"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":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":"spawn","description":"Constantly spawns enemies around a player according to array of enemy classes. The units will try to hunt down the player.","syntaxes":[{"syntax":"[aPlayer, target, side, classes, maxEnemies, delay, code] spawn BIS_fnc_spawnEnemy","since":null,"effect":null,"exec":null,"params":[{"name":"aPlayer","type":"Object","optional":false,"default":null,"description":"a unit that is a player","types":["Object"],"since":null,"text":"aPlayer: Object - a unit that is a player"},{"name":"target","type":"Object","optional":false,"default":null,"description":"reference object (enemies will be spawned on same direction in respect to the player)","types":["Object"],"since":null,"text":"target: Object - reference object (enemies will be spawned on same direction in respect to the player)"},{"name":"side","type":"Side","optional":false,"default":null,"description":"side of the spawned enemies","types":["Side"],"since":null,"text":"side: Side - side of the spawned enemies"},{"name":"classes","type":"Array of Strings","optional":false,"default":null,"description":"list of enemy classes (units will form a group together)\n\n> [!IMPORTANT]\n> Classes must be of the defined *side*, otherwise they will attack each other.","types":["Array","String"],"since":null,"text":"classes: Array of Strings - list of enemy classes (units will form a group together)\n\n> [!IMPORTANT]\n> Classes must be of the defined *side*, otherwise they will attack each other."},{"name":"maxEnemies","type":"Number","optional":true,"default":"10","description":"maximum number of enemies at once","types":["Number"],"since":null,"text":"maxEnemies: Number - (Optional, default 10) maximum number of enemies at once"},{"name":"delay","type":"Number","optional":true,"default":"30","description":"time between spawn waves","types":["Number"],"since":null,"text":"delay: Number - (Optional, default 30) time between spawn waves"},{"name":"code","type":"Code","optional":true,"default":"{}","description":"code to execute on each unit (referenced by _this)","types":["Code"],"since":null,"text":"code: Code - (Optional, default {}) - code to execute on each unit (referenced by _this)"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[player, player, opfor, [\"O_Soldier_F\"]] spawn BIS_fnc_spawnEnemy;\n```","code":["[player, player, opfor, [\"O_Soldier_F\"]] spawn BIS_fnc_spawnEnemy;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_spawnGroup","BIS_fnc_stalk"],"notes":[],"categories":["Arma 2: Operation Arrowhead: Functions","Arma 2: Operation Arrowhead: New Functions","Arma 3: Functions","Function Group: Object Manipulation","Functions","Introduced with Arma 2: Operation Arrowhead version 1.50","Take On Helicopters: Functions"],"docblock":null,"filled_from_docblock":[]}