{"name":"BIS_fnc_spawnEnemy","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","games":{"arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2oa 1.50","arma3_since":"0.50","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","params":[{"name":"aPlayer","type":"Object","description":"a unit that is a player","type_expr":"Object"},{"name":"target","type":"Object","description":"reference object (enemies will be spawned on same direction in respect to the player)","type_expr":"Object"},{"name":"side","type":"Side","description":"side of the spawned enemies","type_expr":"Side"},{"name":"classes","type":"Array of Strings","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.","type_expr":"Array<String>"},{"name":"maxEnemies","type":"Number","optional":true,"default":"10","description":"maximum number of enemies at once","type_expr":"Number","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","type_expr":"Number","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)","type_expr":"Code","text":"code: Code - (Optional, default {}) - code to execute on each unit (referenced by _this)"}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"code":["[player, player, opfor, [\"O_Soldier_F\"]] spawn BIS_fnc_spawnEnemy;"]}],"see_also":["BIS_fnc_spawnGroup","BIS_fnc_stalk"]}