BIS fnc spawnEnemy: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
m (Remove 'broken' warning)
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|Comments=
{{RV|type=function


| arma2oa |Game name=
|game1= arma2oa
|version1= 1.50


|1.51|= Game version
|game2= tkoh
|version2= 1.00


|gr1= Object Manipulation |GROUP1=
|game3= arma3
|version3= 0.50


| Constantly spawns enemies around a player according to array of enemy classes. The units will try to hunt down the player. |DESCRIPTION=
|gr1= Object Manipulation


| [aPlayer, target, side, classes, maxEnemies, delay, code] spawn [[BIS_fnc_spawnEnemy]] |SYNTAX=
|descr= Constantly spawns enemies around a player according to array of enemy classes. The units will try to hunt down the player.


|pr= This function displays an error every time (at least in {{arma3}}) as it uses an undefined variable (typo '''line 30''', {{Inline code|_players}} )
|exec= spawn


|p1= aPlayer: [[Object]] - player |PARAMETER1=
|s1= [aPlayer, target, side, classes, maxEnemies, delay, code] spawn [[BIS_fnc_spawnEnemy]]


|p2= target: [[Object]] - refence object (enemies will be spawned on same direction in respect to the player) |PARAMETER2=
|p1= aPlayer: [[Object]] - a unit that [[isPlayer|is a player]]


|p3= side: [[Side]] - side of the spawned enemies |PARAMETER3=
|p2= target: [[Object]] - reference object (enemies will be spawned on same direction in respect to the player)


|p4= classes: [[Array]] of [[String]] - list of enemy classes (units will form a group together) |PARAMETER4=
|p3= side: [[Side]] - side of the spawned enemies


|p5= maxEnemies: [[Number]] - (Optional, default 10) maximum number of enemies at once |PARAMETER5=
|p4= classes: [[Array]] of [[String]]s - list of enemy classes (units will form a group together)
{{Feature|important|Classes must be of the defined ''side'', otherwise they will attack each other.}}


|p6= delay: [[Number]] - (Optional, default 30) time between spawn waves |PARAMETER6=
|p5= maxEnemies: [[Number]] - (Optional, default 10) maximum number of enemies at once


|p7= code: [[Code]] - (Optional, default {}) - code to execute on each unit (referenced by [[_this]]) |PARAMETER7=
|p6= delay: [[Number]] - (Optional, default 30) time between spawn waves


| [[Nothing]] |RETURNVALUE=
|p7= code: [[Code]] - (Optional, default {}) - code to execute on each unit (referenced by [[Magic Variables#this|_this]])


|exec= spawn |Execution=
|r1= [[Nothing]]


|x1= <code>[<nowiki/>[[player]], [[player]], [[opfor]], ["O_Soldier_F"]] [[spawn]] [[BIS_fnc_spawnEnemy]];</code> |EXAMPLE1=
|x1= <sqf>[player, player, opfor, ["O_Soldier_F"]] spawn BIS_fnc_spawnEnemy;</sqf>


| [[BIS_fnc_spawnGroup]], [[BIS_fnc_stalk]] |SEEALSO=
|seealso= [[BIS_fnc_spawnGroup]] [[BIS_fnc_stalk]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:{{Name|tkoh}}: Functions|{{uc:spawnEnemy}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:spawnEnemy}}]]

Latest revision as of 23:19, 3 February 2023

Hover & click on the images for description

Description

Description:
Constantly spawns enemies around a player according to array of enemy classes. The units will try to hunt down the player.
Execution:
spawn
Groups:
Object Manipulation

Syntax

Syntax:
[aPlayer, target, side, classes, maxEnemies, delay, code] spawn BIS_fnc_spawnEnemy
Parameters:
aPlayer: Object - a unit that is a player
target: Object - reference object (enemies will be spawned on same direction in respect to the player)
side: Side - side of the spawned enemies
classes: Array of Strings - list of enemy classes (units will form a group together)
Classes must be of the defined side, otherwise they will attack each other.
maxEnemies: Number - (Optional, default 10) maximum number of enemies at once
delay: Number - (Optional, default 30) time between spawn waves
code: Code - (Optional, default {}) - code to execute on each unit (referenced by _this)
Return Value:
Nothing

Examples

Example 1:
[player, player, opfor, ["O_Soldier_F"]] spawn BIS_fnc_spawnEnemy;

Additional Information

See also:
BIS_fnc_spawnGroup BIS_fnc_stalk

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