BIS fnc spawnVehicle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
mNo edit summary
(24 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{Function


{{Function|= Comments
|game1= arma2
____________________________________________________________________________________________
|version1= 1.00


| arma2 |= Game name
|game2= TKOH
|version2= 1.00


|1.00|= Game version
|arg=
____________________________________________________________________________________________


| <pre>/*
|eff=
File: spawnVehicle.sqf


Description:
|gr1 = Vehicles |GROUP1=
Function to spawn a certain vehicle type with all crew (including turrets).
The vehicle can either become part of an existing group or create a new group.


Parameter(s):
_this select 0: desired position (Array).
_this select 1: desired azimuth (Number).
_this select 2: type of the vehicle (String).
_this select 3: side or existing group (Side or Group).
_this select 4: (optional) force precise position (Bool, default: true).


Returns:
|descr= Function to spawn a certain vehicle type with all crew (including turrets). The vehicle can either become part of an existing [[group]] or create a new [[group]].
Array:
0: new vehicle (Object).
1: all crew (Array of Objects).
2: vehicle's group (Group).
*/


//Validate parameter count
{{Important | Before '''{{arma3}}''' ({{arma2}}, {{tkoh}}):
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
* a [[Functions Library|Functions Module]] '''must''' be placed in order to use this function
____________________________________________________________________________________________
* a side's [[createCenter|center]] has to exist (by already having a unit of said side on the map)/be created ''via'' [[createCenter]] or the vehicle will spawn empty.
}}


| <!-- [] call [[BIS_fnc_spawnVehicle]]; --> |= Syntax


|p1= |= Parameter 1
|s1= [position, direction, type, sideOrGroup] call [[BIS_fnc_spawnVehicle]]


| |= Return value
|p1= position: [[Array]] format [[Position]] - desired [[position]]
____________________________________________________________________________________________


|x1= <code></code> |=
|p2= direction: [[Number]] - desired azimuth/[[direction]]
____________________________________________________________________________________________


| |= See also
|p3= type: [[String]] - [[typeOf|type]] of the vehicle


|p4= sideOrGroup: [[Side]] or [[Group]] - side or existing group
|r1= [[Array]] format [createdVehicle, crew, group]:
* createdVehicle: [[Object]] - the created vehicle
* crew: [[Array]] of [[Object]]s - the vehicle's crew members
* group: [[Group]] - created or passed group |RETURNVALUE=
|x1= <code>[<nowiki/>[[getPos]] [[player]], 180, "BMP3", [[east]]] [[call]] [[BIS_fnc_spawnVehicle]];</code>
|x2= <code>[[private]] _result = [<nowiki/>[[getPos]] [[player]], 180, "BMP3", [[east]]] [[call]] [[BIS_fnc_spawnVehicle]];
[[private]] _vehicle = _result [[select]] 0;
{{cc|alternatively, {{arma3}} only}}
_result [[params]] ["_vehicle", "_crew", "_group"];</code>
|seealso= [[:Category:CfgVehicles]], [[createVehicle]], [[createUnit]], [[crew]]
}}
}}


Line 54: Line 57:
</dl>
</dl>


<h3 style="display:none">Bottom Section</h3>
 
[[Category:Function Group: Spawning|{{uc:spawnVehicle}}]]
[[Category:Functions|{{uc:spawnVehicle}}]]
[[Category:Functions|{{uc:spawnVehicle}}]]
[[Category:{{Name|arma2}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{arma2}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{arma2oa}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{arma3}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{tkoh}}: Functions|{{uc:spawnVehicle}}]]

Revision as of 10:40, 12 October 2020

Hover & click on the images for description

Description

Description:
Function to spawn a certain vehicle type with all crew (including turrets). The vehicle can either become part of an existing group or create a new group.
Before Arma 3 (Arma 2, Take On Helicopters):
  • a Functions Module must be placed in order to use this function
  • a side's center has to exist (by already having a unit of said side on the map)/be created via createCenter or the vehicle will spawn empty.
Execution:
call
Groups:
Vehicles

Syntax

Syntax:
[position, direction, type, sideOrGroup] call BIS_fnc_spawnVehicle
Parameters:
position: Array format Position - desired position
direction: Number - desired azimuth/direction
type: String - type of the vehicle
sideOrGroup: Side or Group - side or existing group
Return Value:
Array format [createdVehicle, crew, group]:
  • createdVehicle: Object - the created vehicle
  • crew: Array of Objects - the vehicle's crew members
  • group: Group - created or passed group

Examples

Example 1:
[getPos player, 180, "BMP3", east] call BIS_fnc_spawnVehicle;
Example 2:
private _result = [getPos player, 180, "BMP3", east] call BIS_fnc_spawnVehicle; private _vehicle = _result select 0; // alternatively, Arma 3 only _result params ["_vehicle", "_crew", "_group"];

Additional Information

See also:
Category:CfgVehiclescreateVehiclecreateUnitcrew

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

Notes