BIS fnc spawnGroup: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "ArmA 3" to "Arma 3")
(Update to wiki standards)
Line 6: Line 6:


|game2= TKOH |Game2=
|game2= TKOH |Game2=
|version2= 1.00 |Version2=
|version2= 1.00 |Version2=


Line 15: Line 16:
| Function which handles the spawning of a dynamic group of characters.  The composition of the [[group]] can be passed to the function.  Alternatively a number can be passed and the function will spawn that amount of characters with a random type.
| Function which handles the spawning of a dynamic group of characters.  The composition of the [[group]] can be passed to the function.  Alternatively a number can be passed and the function will spawn that amount of characters with a random type.


{{Informative | '''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.}} |Description=
{{Informative | '''Before {{arma3}}''' 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.}} |Description=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [position, side, character details, ''relative positions, list of ranks, skill range, ammo count range, randomization controls, azimuth''] call [[BIS_fnc_spawnGroup]] |Syntax=
| [position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call [[BIS_fnc_spawnGroup]] |Syntax=
 
|p1= position: [[Position]] - group's starting position |Parameter 1=
 
|p2= side: [[Side]] - group's side |Parameter 2=


|p1= position - group's starting [[position]] ([[Array]]) |Parameter 1=
|p3= toSpawn - Can be one of:
* [[Array]] - list of character types
* [[Number]] - amount of characters to spawn
* [[Config]] - [[CfgGroups]] entry |Parameter 3=


|p2= side - group's [[Side]] ([[Side]]) |Parameter 2=
|p4= relPositions: [[Array]] of [[Position]]s (Optional, default []) a list of relative positions |Parameter 4=


|p3= character details - Can be three different types: a list of character types ([[Array]]), an amount of characters to spawn ([[Number]]) or a [[CfgGroups]] entry ([[Config]]) |Parameter 3=
|p5= ranks: [[Array]] of [[String]]s/[[Number]]s - (Optional, default []) ranks (see [[BIS_fnc_setRank]]) - '''must''' be same size as ''toSpawn''<nowiki/>'s array |Parameter 5=


|p4= (optional) a list of relative positions ([[Array]]) |Parameter 4=
|p6= skillRange: [[Array]] of [[Number]]s - (Optional, default []) skill range format [min, max] |Parameter 6=


|p5= (optional) a list of ranks ([[Array]]) |Parameter 5=
|p7= ammoRange: [[Array]] of [[Number]]s - (Optional, default []) ammunition range (0..1) format [min, max] |Parameter 7=


|p6= (optional) skill range ([[Array]]) |Parameter 6=
|p8= randomControls: [[Array]] of [[Number]]s - (Optional, default [-1, 1]) to format [minUnits, chance]:
* minUnits: [[Number]] - (Optional, default -1) amount of mandatory units
* chance: [[Number]] - (Optional, default -1) spawn chance for remaining units (0..1) |Parameter 8=


|p7= (optional) ammunition count range ([[Array]]) |Parameter 7=
|p9= azimuth: [[Number]] - (Optional, default 0) azimuth/[[direction]] |Parameter 9=


|p8= (optional) randomization controls ([[Array]]) 0: amount of mandatory units ([[Number]]) 1: spawn chance for remaining units ([[Number]]) |Parameter 8=
|p10= precisePos: [[Boolean]] - (Optional, default [[true]]) forces precise position placement |Parameter 10=


|p9= (optional) azimuth/[[getDir|Direction]] ([[Number]]) |Parameter 9=
|p11= maxVehicles: [[Number]] - (Optional, default 10e10) vehicle number limit|Parameter 11=


| [[Group]] |RETURNVALUE=
| [[Group]] |RETURNVALUE=
Line 51: Line 61:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[ArmA_2:_CfgVehicles | Arma 2 CfgVehicles]] |SEEALSO=
| [[:Category:CfgVehicles]] [[Arma 2: CfgVehicles]] [[Arma 3 Assets]] |SEEALSO=
}}
}}


Line 59: Line 69:
<dl class="command_description">
<dl class="command_description">
</dl>
</dl>
[[Category:Function Group: Spawning|{{uc:spawnGroup}}]]
[[Category:Functions|{{uc:spawnGroup}}]]
[[Category:{{Name|arma2}}: Functions|{{uc:spawnGroup}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:spawnGroup}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:spawnGroup}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:spawnGroup}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:spawnGroup}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:spawnGroup}}]]
[[Category:Function Group: Spawning|{{uc:spawnGroup}}]]


<!-- CONTINUE Notes -->
<!-- CONTINUE Notes -->
Line 71: Line 78:
<dt class="note">[[User:Snake Plissken|Snake Plissken]]</dt>
<dt class="note">[[User:Snake Plissken|Snake Plissken]]</dt>
<dd class="note">
<dd class="note">
Factions are represented by the letters<br>
Sides are as follow:
<br>WEST = BLUFOR
* [[west]]/[[blufor]] = BLUFOR
<br>EAST = OPFOR
* [[east]]/[[opfor]] = OPFOR
<br>GUER = INDEPENDENT
* [[resistance]]/[[independent]] = INDEPENDENT
<br>CIV = CIVIL.<br>
* [[civilian]] = CIVILIAN.


<br>To spawn one BLUFOR group, the command be
To spawn one BLUFOR group ("MARK1" is the name given to a map marker):
<br>"MARK1" is the name given to the marking placed on the map, where the group will appear.
<code>Group_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;</code>
<code>Group_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; </code>


<br>Or a random group OPFOR of seven units
Or a random group OPFOR of seven units
<code>Group_Name_Here= [getMarkerPos "MARK1", EAST, 7 ] call BIS_fnc_spawnGroup; </code>
<code>Group_Name_Here= [getMarkerPos "MARK1", EAST, 7] call BIS_fnc_spawnGroup; </code>


<br>But to spawn an independent group, is not using "GUER" but the name "INDEPENDENT"
an independent group:
<code>Group_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;</code>
<code>Group_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;</code>
<br>I can not say that the correct would be to put the name "GUER" as in other factions, or is this an error for a correction future.
</dd>
</dd>


Line 93: Line 98:
<dd class="note">
<dd class="note">
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.
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.
</dd>
<dd class="notedate">Posted on October 15, 2018 - 21:59 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">
There are two more parameters:
<code>_this select 9: (optional) force precise position (Bool, default: true).  {{cc|important: for spawning vehicles without collision, set it to false}}
_this select 10: (optional) max. number of vehicles (Number, default: 10e10).</code>
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->

Revision as of 18:13, 19 August 2020

Hover & click on the images for description

Description

Description:
Function which handles the spawning of a dynamic group of characters. The composition of the group can be passed to the function. Alternatively a number can be passed and the function will spawn that amount of characters with a random type.
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.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call BIS_fnc_spawnGroup
Parameters:
position: Position - group's starting position
side: Side - group's side
toSpawn - Can be one of:
relPositions: Array of Positions (Optional, default []) a list of relative positions
ranks: Array of Strings/Numbers - (Optional, default []) ranks (see BIS_fnc_setRank) - must be same size as toSpawn's array
skillRange: Array of Numbers - (Optional, default []) skill range format [min, max]
ammoRange: Array of Numbers - (Optional, default []) ammunition range (0..1) format [min, max]
randomControls: Array of Numbers - (Optional, default [-1, 1]) to format [minUnits, chance]:
  • minUnits: Number - (Optional, default -1) amount of mandatory units
  • chance: Number - (Optional, default -1) spawn chance for remaining units (0..1)
azimuth: Number - (Optional, default 0) azimuth/direction
precisePos: Boolean - (Optional, default true) forces precise position placement
maxVehicles: Number - (Optional, default 10e10) vehicle number limit
Return Value:
Group

Examples

Example 1:
Spawn five random EAST units at aPosition: [getPos aPosition, east, 5] call BIS_fnc_spawnGroup;
Example 2:
Spawn a Stryker MGS Platoon at marker "tankSpawn": [getMarkerPos "tankSpawn", side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Armored" >> "US_MGSPlatoon")] call BIS_fnc_spawnGroup;
Example 3:
Spawn a TK Militia Medic and Soldier at aPos facing south: [getPos aPos, east, ["TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup

Additional Information

See also:
Category:CfgVehicles Arma 2: CfgVehicles Arma 3 Assets

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


Bottom Section

Posted on August 23, 2016 - 02:42 (UTC)
Snake Plissken
Sides are as follow: To spawn one BLUFOR group ("MARK1" is the name given to a map marker): Group_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; Or a random group OPFOR of seven units Group_Name_Here= [getMarkerPos "MARK1", EAST, 7] call BIS_fnc_spawnGroup; an independent group: Group_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;
Posted on August 2, 2017 - 19:06 (UTC)
Cheitan
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.