BIS fnc spawnVehicle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(31 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Function|=
{{RV|type=function
____________________________________________________________________________________________


| arma2 |=
|game1= arma2
|1.00|=
|version1= 1.00


|game2= TKOH |=
|game2= arma2oa
|version2= 1.00 |=
|version2= 1.50


|arg= |= MPARGUMENTS
|game3= tkoh
|version3= 1.00


|eff= |= MPEFFECTS
|game4= arma3
____________________________________________________________________________________________
|version4= 0.50


| 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]].
|gr1= Vehicles


|=
|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]].
____________________________________________________________________________________________


| [position,direction,type,side or group] call '''BIS_fnc_spawnVehicle''' |=
{{Feature|important|Before '''{{arma3}}''' ({{arma2}}, {{tkoh}}):
 
* a [[Functions Library|Functions Module]] '''must''' be placed in order to use this function
|p1= position - desired [[position]] ([[Array]]) |=
* 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.
}}


|p2= direction - desired azimuth/[[direction]] ([[Number]]) |=
|s1= [position, direction, type, sideOrGroup] call [[BIS_fnc_spawnVehicle]]


|p3= type - [[typeOf|type]] of the vehicle ([[String]]) |=
|p1= position: [[Array]] format [[Position]] - desired [[position]]


|p4= side or group - side or existing group ([[Side]] or [[Group]]) |=
|p2= direction: [[Number]] - desired azimuth/[[direction]]


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


| [[Array]] - 0: created vehicle ([[Object]]), 1: all crew ([[Array]] of [[Object|Objects]]), 2: vehicle's group ([[Group]])  |= Return value
|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


|x1= <code>[getPos mySpawnPos, 180, "BMP3", EAST] call bis_fnc_spawnvehicle</code>|= EXAMPLE1
|x1= <sqf>[getPos player, 180, "BMP3", east] call BIS_fnc_spawnVehicle;</sqf>


__________
|x2= <sqf>
private _result = [getPos player, 180, "BMP3", east] call BIS_fnc_spawnVehicle;


| [[ArmA_2:_CfgVehicles | Arma 2 CfgVehicles]] |= SEEALSO
private _vehicle = _result select 0;
_result params ["_vehicle", "_crew", "_group"];
</sqf>


| |= MPBEHAVIOUR
|seealso= [[:Category:CfgVehicles]] [[respawnVehicle]] [[createVehicle]] [[createUnit]] [[crew]]
____________________________________________________________________________________________
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on January 2, 2011
<dt class="note">'''[[User:Lucky44|Lucky44]]'''
<dd class="note">EDITED: You no longer need to put a Functions Module on the map for this function to work. (As of Arma 3)
<dd class="notedate">Posted on January 23, 2011
<dt class="note">'''[[User:nte|nte]]'''
<dd class="note">If there is no enemy on the map, it will spawn as empty.
<dd class="notedate">Posted on December 24, 2011
<dt class="note">'''[[User:Homer Johnston|Homer Johnston]]'''
<dd class="note">Clarifying the above, you either need to use createCenter to create a side, or place a unit of the desired side on the map, otherwise the vehicle spawns empty.
<!-- Note Section END -->
</dl>
[[Category:Function Group: Spawning|{{uc:spawnVehicle}}]]
[[Category:Functions|{{uc:spawnVehicle}}]]
[[Category:{{Name|arma2}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:spawnVehicle}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:spawnVehicle}}]]

Latest revision as of 01:21, 5 March 2024

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; _result params ["_vehicle", "_crew", "_group"];

Additional Information

See also:
Category:CfgVehicles respawnVehicle createVehicle createUnit crew

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