createVehicleCrew: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - " |r1=[[" to " |r1= [[")
(43 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 0.76


|0.76|= Game version
|gr1= Object Manipulation
____________________________________________________________________________________________


| Creates crew to given empty vehicle. Crew members are default crew defined in config. Crew side will also correspond to vehicle's [[faction]]. |= Description
|descr= Creates vehicle crew corresponding to vehicle's [[faction]]. The command creates driver, if the vehicle has driver position (vehicle config: <tt>hasDriver</tt>) and fills [[allTurrets | all non-FFV turrets]] with gunners, if turrets can have gunners (turret config: <tt>hasGunner</tt>). Any turret that has <tt>dontCreateAI</tt> option set is omitted. If the vehicle is already occupied, the command will only create missing crew.<br><br>
____________________________________________________________________________________________
Since Arma 3 v1.94 this command will return [[Group]] of the created crew which will be vehicle's group. Missing crew will be created in the same group as vehicle. To find out which crew will be created, use [[BIS_fnc_vehicleCrewTurrets]].<br><br>
 
{{Feature | Informative | This command does not [[addVehicle]] to the created crew in the same way this normally happens when crewed vehicle created in the editor. See [[BIS_fnc_spawnVehicle]] for a full vehicle and crew creation and group addition.}}


| '''createVehicleCrew''' vehicle |= Syntax
{{Feature|important| While a vehicle with a crew placed in editor will have all crew units of the [[rank]] <tt>"PRIVATE"</tt>, this command will create the driver as <tt>"LIEUTENANT"</tt> and all turret units as <tt>"SERGEANT"</tt> }}


|p1= vehicle: [[Object]] |= Parameter 1
|s1= [[createVehicleCrew]] vehicle


| [[Nothing]] |= RETURNVALUE
|p1= vehicle: [[Object]] - vehicle to populate with crew


|r1= [[Group]] - the group of the created crew (since Arma 3 v1.94)


|x1= <code>// Spawn a flying UAV with crew. 
|x1= <code>_veh = [[createVehicle]] ["B_MRAP_01_F", [[getMarkerPos]] "createVeh", [], 0, "NONE"];
myUAV = <nowiki>[</nowiki>[[getPos]] [[player]], 0, "B_UAV_02_F", [[west]]] [[call]] [[BIS_fnc_spawnVehicle]];
[[createVehicleCrew]] _veh;</code>
[[createVehicleCrew]] (myUAV [[select]] 0);
</code>|= EXAMPLE1


|x2= <code>_veh = [[createVehicle]] ["O_MRAP_02_hmg_F", [[position]] [[player]], [], 0, "NONE"];
|x2= <code>_veh = [[createVehicle]] ["O_MRAP_02_hmg_F", [[position]] [[player]], [], 0, "NONE"];
Line 27: Line 27:
[[diag_log]] [_x, [[faction]] _x, [[side]] _x, [[side]] [[group]] _x];
[[diag_log]] [_x, [[faction]] _x, [[side]] _x, [[side]] [[group]] _x];
} [[forEach]] [[crew]] _veh;</code>
} [[forEach]] [[crew]] _veh;</code>
<code>[O Alpha 1-1:1,"OPF_F",EAST,EAST]
<code>[O Alpha 1-1:1,"OPF_F",EAST,EAST]
[O Alpha 1-1:2,"OPF_F",EAST,EAST]
[O Alpha 1-1:2,"OPF_F",EAST,EAST]</code>
</code>|= EXAMPLE2


____________________________________________________________________________________________
|seealso= [[deleteVehicleCrew]], [[moveInDriver]], [[moveInGunner]], [[moveInCommander]], [[moveInTurret]], [[moveInCargo]], [[BIS_fnc_spawnVehicle]]
 
| [[moveInDriver]], [[moveInGunner]], [[moveInCommander]], [[moveInTurret]], [[moveInCargo]] |= SEEALSO
 
|  |= MPBEHAVIOUR
____________________________________________________________________________________________
}}
}}


<h3 style='display:none'>Notes</h3>
<dl class='command_description'>
<!-- Note Section BEGIN -->


<!-- Note Section END -->
<dl class="command_description">
</dl>


<h3 style='display:none'>Bottom Section</h3>
<dt></dt>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Vehicle_Assignment|{{uc:{{PAGENAME}}}}]]
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on August 20, 2014 - 14:01 (UTC)</dd>
<dd class="notedate">Posted on August 20, 2014 - 14:01 (UTC)</dd>
<dt class="note">[[User:SilentSpike|SilentSpike]]</dt>
<dt class="note">[[User:SilentSpike|SilentSpike]]</dt>
Line 60: Line 42:
As of ARMA 3 v1.26 the command will work on non-empty vehicles. If any of the crew defined in config are missing they will be added.
As of ARMA 3 v1.26 the command will work on non-empty vehicles. If any of the crew defined in config are missing they will be added.
</dd>
</dd>
<dt><dt>
<dd class="notedate">Posted on November 8, 2014 - 17:06 (UTC)</dd>
<dt class="note">[[User:Tankbuster|Tankbuster]]</dt>
<dd class="note">
This command creates drivers/copilots, commanders and gunners where appropriate, but it never creates cargo crew.
So a gunship Huron will get a pilot and copilot plus 2 door gunners, but nobody in the back.
</dd>
<dt><dt>
<dd class="notedate">Posted on December 22, 2015 - 14:19 (UTC)</dd>
<dt class="note">[[User:DrPastah|DrPastah]]</dt>
<dd class="note">
createVehicleCrew does not work with Transport Unload waypoints for helicopters. You need to spawn the pilots separately and then get them into the helicopter in order to get Transport Unload waypoints to work.
</dd>
<dt><dt>
<dd class="notedate">Posted on July 2, 2017 - 03:26 (UTC)</dd>
<dt class="note">[[User:AgentRevolution|AgentRev]]</dt>
<dd class="note">
The particular seats to which units are added depend on the <tt>dontCreateAI</tt> property, the <tt>hasDriver</tt> property of the base class, and the <tt>hasGunner</tt> propery of turret classes.<br>
For instance, the following snippet calculates how many seats will be occupied by the created crew:
<code>private _vehCfg = configFile >> "CfgVehicles" >> typeOf _vehicle;
private _crewCount = {round getNumber (_x >> "dontCreateAI") < 1 &&
                      ((_x == _vehCfg && {round getNumber (_x >> "hasDriver") > 0}) ||
                      (_x != _vehCfg && {round getNumber (_x >> "hasGunner") > 0}))} count ([_vehicle, configNull] call BIS_fnc_getTurrets);
</code>
Also, I've written a function to create a UAV crew for a specific side: https://gist.github.com/AgentRev/cb25d30e464f2239b6cee51fa0110c78
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 23:34, 7 August 2021

Hover & click on the images for description

Description

Description:
Creates vehicle crew corresponding to vehicle's faction. The command creates driver, if the vehicle has driver position (vehicle config: hasDriver) and fills all non-FFV turrets with gunners, if turrets can have gunners (turret config: hasGunner). Any turret that has dontCreateAI option set is omitted. If the vehicle is already occupied, the command will only create missing crew.

Since Arma 3 v1.94 this command will return Group of the created crew which will be vehicle's group. Missing crew will be created in the same group as vehicle. To find out which crew will be created, use BIS_fnc_vehicleCrewTurrets.

This command does not addVehicle to the created crew in the same way this normally happens when crewed vehicle created in the editor. See BIS_fnc_spawnVehicle for a full vehicle and crew creation and group addition.
While a vehicle with a crew placed in editor will have all crew units of the rank "PRIVATE", this command will create the driver as "LIEUTENANT" and all turret units as "SERGEANT"
Groups:
Object Manipulation

Syntax

Syntax:
createVehicleCrew vehicle
Parameters:
vehicle: Object - vehicle to populate with crew
Return Value:
Group - the group of the created crew (since Arma 3 v1.94)

Examples

Example 1:
_veh = createVehicle ["B_MRAP_01_F", getMarkerPos "createVeh", [], 0, "NONE"]; createVehicleCrew _veh;
Example 2:
_veh = createVehicle ["O_MRAP_02_hmg_F", position player, [], 0, "NONE"]; createVehicleCrew _veh; { diag_log [_x, faction _x, side _x, side group _x]; } forEach crew _veh; [O Alpha 1-1:1,"OPF_F",EAST,EAST] [O Alpha 1-1:2,"OPF_F",EAST,EAST]

Additional Information

See also:
deleteVehicleCrewmoveInDrivermoveInGunnermoveInCommandermoveInTurretmoveInCargoBIS_fnc_spawnVehicle

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 August 20, 2014 - 14:01 (UTC)
SilentSpike
As of ARMA 3 v1.26 the command will work on non-empty vehicles. If any of the crew defined in config are missing they will be added.
Posted on November 8, 2014 - 17:06 (UTC)
Tankbuster
This command creates drivers/copilots, commanders and gunners where appropriate, but it never creates cargo crew. So a gunship Huron will get a pilot and copilot plus 2 door gunners, but nobody in the back.
Posted on December 22, 2015 - 14:19 (UTC)
DrPastah
createVehicleCrew does not work with Transport Unload waypoints for helicopters. You need to spawn the pilots separately and then get them into the helicopter in order to get Transport Unload waypoints to work.
Posted on July 2, 2017 - 03:26 (UTC)
AgentRev
The particular seats to which units are added depend on the dontCreateAI property, the hasDriver property of the base class, and the hasGunner propery of turret classes.
For instance, the following snippet calculates how many seats will be occupied by the created crew: private _vehCfg = configFile >> "CfgVehicles" >> typeOf _vehicle; private _crewCount = {round getNumber (_x >> "dontCreateAI") < 1 && ((_x == _vehCfg && {round getNumber (_x >> "hasDriver") > 0}) || (_x != _vehCfg && {round getNumber (_x >> "hasGunner") > 0}))} count ([_vehicle, configNull] call BIS_fnc_getTurrets); Also, I've written a function to create a UAV crew for a specific side: https://gist.github.com/AgentRev/cb25d30e464f2239b6cee51fa0110c78