BIS fnc spawnGroup: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Killzone Kid (talk | contribs) (function header) |
||
Line 50: | Line 50: | ||
|x3= Spawn a TK Militia Medic and Soldier at aPos facing south: | |x3= Spawn a TK Militia Medic and Soldier at aPos facing south: | ||
<code>[getPos aPos, EAST, ["TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup</code>|= EXAMPLE3 | <code>[getPos aPos, EAST, ["TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup</code>|= EXAMPLE3 | ||
__________ | __________ | ||
Line 77: | Line 76: | ||
Also the last optional argument is azimuth, but doesn't display in the text above. :) There's an example for it though. | Also the last optional argument is azimuth, but doesn't display in the text above. :) There's an example for it though. | ||
<br><br>[[User:Killzone_Kid | Killzone_Kid]]<br> | |||
Function header:<br> | |||
<syntaxhighlight lang=javascript> | |||
/* | |||
File: spawnGroup.sqf | |||
Author: Joris-Jan van 't Land, modified by Thomas Ryan | |||
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. | |||
Parameter(s): | |||
_this select 0: the group's starting position (Array) | |||
_this select 1: the group's side (Side) | |||
_this select 2: can be three different types: | |||
- list of character types (Array) | |||
- amount of characters (Number) | |||
- CfgGroups entry (Config) | |||
_this select 3: (optional) list of relative positions (Array) | |||
_this select 4: (optional) list of ranks (Array) | |||
_this select 5: (optional) skill range (Array) | |||
_this select 6: (optional) ammunition count range (Array) | |||
_this select 7: (optional) randomization controls (Array) | |||
0: amount of mandatory units (Number) | |||
1: spawn chance for the remaining units (Number) | |||
_this select 8: (optional) azimuth (Number) | |||
Returns: | |||
The group (Group) | |||
*/ | |||
</syntaxhighlight> | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 11:48, 13 April 2014
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. 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, character details, relative positions, list of ranks, skill range, ammo count range, randomization controls, azimuth] call BIS_fnc_spawnGroup
- Parameters:
- position - group's starting position (Array)
- side - group's Side (Side)
- 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)
- (optional) a list of relative positions (Array)
- (optional) a list of ranks (Array)
- (optional) skill range (Array)
- (optional) ammunition count range (Array)
- (optional) randomization controls (Array) 0: amount of mandatory units (Number) 1: spawn chance for remaining units (Number)
- (optional) azimuth/Direction (Number)
- Return Value:
- (Group)
Examples
- Example 1:
- Spawn five random EAST units at aPos:
[getPos aPos, 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:
- Arma 2 CfgVehicles
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
-
kylania 2011-8-15
Use the following for the Type string in the configFile entry: Infantry Air Mechanized Motorized Armored The randomization controls is an array: [2, .5] Would be 2 units spawned with a 50% chance the other units would be spawned. The chance is a number from 0 to 1. Also the last optional argument is azimuth, but doesn't display in the text above. :) There's an example for it though.
Killzone_Kid
Function header:
/*
File: spawnGroup.sqf
Author: Joris-Jan van 't Land, modified by Thomas Ryan
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.
Parameter(s):
_this select 0: the group's starting position (Array)
_this select 1: the group's side (Side)
_this select 2: can be three different types:
- list of character types (Array)
- amount of characters (Number)
- CfgGroups entry (Config)
_this select 3: (optional) list of relative positions (Array)
_this select 4: (optional) list of ranks (Array)
_this select 5: (optional) skill range (Array)
_this select 6: (optional) ammunition count range (Array)
_this select 7: (optional) randomization controls (Array)
0: amount of mandatory units (Number)
1: spawn chance for the remaining units (Number)
_this select 8: (optional) azimuth (Number)
Returns:
The group (Group)
*/