BIS fnc spawnGroup: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Lou Montana (talk | contribs) m (Text replacement - "[[Arma 3 " to "[[Arma 3: ") |
||
(34 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=function | ||
| arma2 | | |game1= arma2 | ||
|version1= 1.00 | |||
| | |game2= arma2oa | ||
|version2= 1.50 | |||
| | |game3= tkoh | ||
|version3= 1.00 | |||
| | |game4= arma3 | ||
|version4= 0.50 | |||
| | |gr1= Object Manipulation | ||
| | |arg= | ||
| | |eff= | ||
|descr= 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. | |||
| | {{Feature|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.}} | ||
| | |s1= [position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call [[BIS_fnc_spawnGroup]] | ||
| | |p1= position: [[Array]] format [[Position]] - group's starting position | ||
|p3= toSpawn - | |p2= side: [[Side]] - group's side | ||
|p3= toSpawn - can be one of: | |||
* [[Array]] - list of character types | * [[Array]] - list of character types | ||
* [[Number]] - amount of characters to spawn | * [[Number]] - amount of characters to spawn | ||
* [[Config]] - [[CfgGroups]] entry | * [[Config]] - [[CfgGroups]] entry | ||
|p4= relPositions: [[Array]] of [[Position]]s (Optional, default []) a list of relative positions | |p4= relPositions: [[Array]] of [[Position]]s (Optional, default <sqf inline>[]</sqf>) a list of relative positions | ||
|p5= ranks: [[Array]] of [[String]]s/[[Number]]s - (Optional, default []) ranks (see [[BIS_fnc_setRank]]) - '''must''' be same size as ''toSpawn''<nowiki/>'s array | |p5= ranks: [[Array]] of [[String]]s/[[Number]]s - (Optional, default <sqf inline>[]</sqf>) ranks (see [[BIS_fnc_setRank]]) - '''must''' be same size as ''toSpawn''<nowiki/>'s array | ||
|p6= skillRange: [[Array]] of [[Number]]s - (Optional, default []) skill range format [min, max] | |p6= skillRange: [[Array]] of [[Number]]s - (Optional, default <sqf inline>[]</sqf>) skill range format [min, max] | ||
|p7= ammoRange: [[Array]] of [[Number]]s - (Optional, default []) ammunition range (0..1) format [min, max] | |p7= ammoRange: [[Array]] of [[Number]]s - (Optional, default <sqf inline>[]</sqf>) ammunition range (0..1) format [min, max] | ||
|p8= randomControls: [[Array]] of [[Number]]s - (Optional, default [-1, 1]) to format [minUnits, chance]: | |p8= randomControls: [[Array]] of [[Number]]s - (Optional, default [-1, 1]) to format [minUnits, chance]: | ||
* minUnits: [[Number]] - (Optional, default -1) amount of mandatory units | * minUnits: [[Number]] - (Optional, default -1) amount of mandatory units | ||
* chance: [[Number]] - (Optional, default -1) spawn chance for remaining units | * chance: [[Number]] - (Optional, default -1) spawn chance for remaining units in range 0..1 | ||
|p9= azimuth: [[Number]] - (Optional, default 0) azimuth/[[direction]] | |p9= azimuth: [[Number]] - (Optional, default 0) azimuth/[[direction]] | ||
|p10= precisePos: [[Boolean]] - (Optional, default [[true]]) forces precise position placement | |p10= precisePos: [[Boolean]] - (Optional, default [[true]]) forces precise position placement | ||
|p11= maxVehicles: [[Number]] - (Optional, default 10e10) vehicle number limit | |p11= maxVehicles: [[Number]] - (Optional, default 10e10) vehicle number limit | ||
| [[Group]] | |r1= [[Group]] | ||
|x1= Spawn five random EAST units at aPosition: | |x1= Spawn five random EAST units at aPosition: | ||
< | <sqf>[getPosATL aPosition, east, 5] call BIS_fnc_spawnGroup;</sqf> | ||
|x2= Spawn a Stryker MGS Platoon at marker "tankSpawn": | |x2= Spawn a Stryker MGS Platoon at marker "tankSpawn": | ||
< | <sqf>[getMarkerPos "tankSpawn", side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Armored" >> "US_MGSPlatoon")] call BIS_fnc_spawnGroup;</sqf> | ||
|x3= Spawn a TK Militia Medic and Soldier at aPos facing south: | |x3= Spawn a TK Militia Medic and Soldier at aPos facing south: | ||
< | <sqf>[getPos aPos, east, ["TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;</sqf> | ||
| [[:Category:CfgVehicles]] [[Arma 2: CfgVehicles]] [[Arma 3 Assets]] | |seealso= [[:Category:CfgVehicles]] [[Arma 2: CfgVehicles]] [[Arma 3: Assets]] | ||
}} | }} | ||
{{Note | |||
|user= Snake Plissken | |||
|timestamp= 20160823024200 | |||
|text= Sides are as follow: | |||
Sides are as follow: | |||
* [[west]]/[[blufor]] = BLUFOR | * [[west]]/[[blufor]] = BLUFOR | ||
* [[east]]/[[opfor]] = OPFOR | * [[east]]/[[opfor]] = OPFOR | ||
Line 86: | Line 76: | ||
To spawn one BLUFOR group ("MARK1" is the name given to a map marker): | To spawn one BLUFOR group ("MARK1" is the name given to a map marker): | ||
< | <sqf>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;</sqf> | ||
Or a random group OPFOR of seven units | Or a random group OPFOR of seven units | ||
< | <sqf>Group_Name_Here = [getMarkerPos "MARK1", EAST, 7] call BIS_fnc_spawnGroup;</sqf> | ||
an independent group: | an independent group: | ||
< | <sqf>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;</sqf> | ||
}} | |||
{{Note | |||
|user= Cheitan | |||
|timestamp= 20170802190600 | |||
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. | |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. | ||
}} | |||
Latest revision as of 10:38, 6 May 2024
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.
- Execution:
- call
- Groups:
- Object Manipulation
Syntax
- Syntax:
- [position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call BIS_fnc_spawnGroup
- Parameters:
- position: Array format 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]:
- 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:
- 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:
Additional Information
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
- Posted on Aug 23, 2016 - 02:42 (UTC)
-
Sides are as follow:
- west/blufor = BLUFOR
- east/opfor = OPFOR
- resistance/independent = INDEPENDENT
- civilian = CIVILIAN.
Or a random group OPFOR of seven unitsGroup_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;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 Aug 02, 2017 - 19:06 (UTC)
- 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.