createVehicleCrew: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|s1= +" to "|s1= ")
m (Text replacement - "since= Arma3" to "since= arma3")
 
(32 intermediate revisions by 2 users not shown)
Line 6: Line 6:
|gr1= Object Manipulation
|gr1= Object Manipulation


|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>
|descr= Creates vehicle crew corresponding to the provided vehicle's [[faction]]. If the vehicle is already occupied, the command will only create missing crew in the existing vehicle's group.<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>
To find out which crew will be created, use [[BIS_fnc_vehicleCrewTurrets]].
    
    
{{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.}}
{{Feature|informative|This command:
* {{GVI|arma3|1.26|size= 0.75}} creates a group if one is needed (otherwise uses <sqf inline>group vehicle</sqf>)
* creates a driver (if the vehicle needs one - config {{hl|hasDriver}})
* creates [[allTurrets|all non-FFV turrets]] gunners (if the turret needs one - config {{hl|hasGunner}} without {{hl|dontCreateAI}})
* does not create cargo
* 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]] to spawn a crew-full vehicle with group addition.
}}


{{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> }}
{{Feature|important|While a vehicle with a crew placed in editor will have all crew units of the [[rank]] {{hl|"PRIVATE"}}, this command will create the driver as {{hl|"LIEUTENANT"}} and all turret units as {{hl|"SERGEANT"}}.}}


|s1= [[createVehicleCrew]] vehicle
|s1= [[createVehicleCrew]] vehicle
Line 17: Line 23:
|p1= vehicle: [[Object]] - vehicle to populate with crew
|p1= vehicle: [[Object]] - vehicle to populate with crew


|r1=[[Group]] - the group of the created crew (since Arma 3 v1.94)
|r1= [[Group]] - the group of the created crew (since {{GVI|arma3|1.94}}; before that returned [[Nothing]])
 
 
|s2= group [[createVehicleCrew]] vehicle
|s2since= arma3 2.14


|x1= <code>_veh = [[createVehicle]] ["B_MRAP_01_F", [[getMarkerPos]] "createVeh", [], 0, "NONE"];
|p21= group: [[Group]] - group to put crew in
[[createVehicleCrew]] _veh;</code>
|p22= vehicle: [[Object]] - vehicle to populate with crew


|x2= <code>_veh = [[createVehicle]] ["O_MRAP_02_hmg_F", [[position]] [[player]], [], 0, "NONE"];
|r2= [[Group]] - the group of the created crew or [[grpNull]]
[[createVehicleCrew]] _veh;
 
{
|s3= side [[createVehicleCrew]] vehicle
[[diag_log]] [_x, [[faction]] _x, [[side]] _x, [[side]] [[group]] _x];
|s3since= arma3 2.14
} [[forEach]] [[crew]] _veh;</code>
 
<code>[O Alpha 1-1:1,"OPF_F",EAST,EAST]
|p41= side: [[Side]] - side to create crew on
[O Alpha 1-1:2,"OPF_F",EAST,EAST]</code>
|p42= vehicle: [[Object]] - vehicle to populate with crew
 
|r3= [[Group]] - the group of the created crew or [[grpNull]]


|seealso= [[deleteVehicleCrew]], [[moveInDriver]], [[moveInGunner]], [[moveInCommander]], [[moveInTurret]], [[moveInCargo]], [[BIS_fnc_spawnVehicle]]
|x1= <sqf>_veh = createVehicle ["B_MRAP_01_F", getMarkerPos "createVeh", [], 0, "NONE"];
}}
createVehicleCrew _veh;</sqf>


|x2= <sqf>_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;


<dl class="command_description">
// [O Alpha 1-1:1,"OPF_F",EAST,EAST]
// [O Alpha 1-1:2,"OPF_F",EAST,EAST]</sqf>


<dt></dt>
|seealso= [[deleteVehicleCrew]] [[moveInDriver]] [[moveInGunner]] [[moveInCommander]] [[moveInTurret]] [[moveInCargo]] [[BIS_fnc_spawnVehicle]]
<dd class="notedate">Posted on August 20, 2014 - 14:01 (UTC)</dd>
}}
<dt class="note">[[User:SilentSpike|SilentSpike]]</dt>
<dd class="note">
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>


<dt><dt>
{{Note
<dd class="notedate">Posted on November 8, 2014 - 17:06 (UTC)</dd>
|user= SilentSpike
<dt class="note">[[User:Tankbuster|Tankbuster]]</dt>
|timestamp= 20140820140100
<dd class="note">
|text= As of {{arma3}} v1.26 the command will work on non-empty vehicles. If any of the crew defined in config are missing they will be added.
This command creates drivers/copilots, commanders and gunners where appropriate, but it never creates cargo crew.
|game= arma3
So a gunship Huron will get a pilot and copilot plus 2 door gunners, but nobody in the back.
|version= 1.26
</dd>
}}


<dt><dt>
{{Note
<dd class="notedate">Posted on December 22, 2015 - 14:19 (UTC)</dd>
|user= DrPastah
<dt class="note">[[User:DrPastah|DrPastah]]</dt>
|timestamp= 20151222141900
<dd class="note">
|text= [[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.
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>
{{Note
<dd class="notedate">Posted on July 2, 2017 - 03:26 (UTC)</dd>
|user= AgentRevolution
<dt class="note">[[User:AgentRevolution|AgentRev]]</dt>
|timestamp= 20170602032600
<dd class="note">
|text= The particular seats to which units are added depend on the {{hl|dontCreateAI}} property, the {{hl|hasDriver}} property of the base class, and the {{hl|hasGunner}} propery of turret classes.<br>
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:
For instance, the following snippet calculates how many seats will be occupied by the created crew:
<code>private _vehCfg = configFile >> "CfgVehicles" >> typeOf _vehicle;
<sqf>
private _crewCount = {round getNumber (_x >> "dontCreateAI") < 1 &&  
private _vehCfg = configFile >> "CfgVehicles" >> typeOf _vehicle;
                      ((_x == _vehCfg && {round getNumber (_x >> "hasDriver") > 0}) ||
private _crewCount = {
                      (_x != _vehCfg && {round getNumber (_x >> "hasGunner") > 0}))} count ([_vehicle, configNull] call BIS_fnc_getTurrets);
round getNumber (_x >> "dontCreateAI") < 1 &&  
</code>
((_x == _vehCfg && { round getNumber (_x >> "hasDriver") > 0 }) ||
(_x != _vehCfg && { round getNumber (_x >> "hasGunner") > 0 }))
} count ([_vehicle, configNull] call BIS_fnc_getTurrets);
</sqf>
Also, I've written a function to create a UAV crew for a specific side: https://gist.github.com/AgentRev/cb25d30e464f2239b6cee51fa0110c78
Also, I've written a function to create a UAV crew for a specific side: https://gist.github.com/AgentRev/cb25d30e464f2239b6cee51fa0110c78
</dd>
}}
 
</dl>

Latest revision as of 17:26, 9 February 2024

Hover & click on the images for description

Description

Description:
Creates vehicle crew corresponding to the provided vehicle's faction. If the vehicle is already occupied, the command will only create missing crew in the existing vehicle's group.
To find out which crew will be created, use BIS_fnc_vehicleCrewTurrets.
This command:
  • Arma 3 logo black.png1.26 creates a group if one is needed (otherwise uses group vehicle)
  • creates a driver (if the vehicle needs one - config hasDriver)
  • creates all non-FFV turrets gunners (if the turret needs one - config hasGunner without dontCreateAI)
  • does not create cargo
  • 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 to spawn a crew-full vehicle with 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 1

Syntax:
createVehicleCrew vehicle
Parameters:
vehicle: Object - vehicle to populate with crew
Return Value:
Group - the group of the created crew (since Arma 3 logo black.png1.94; before that returned Nothing)

Syntax 2

Syntax:
group createVehicleCrew vehicle
Parameters:
group: Group - group to put crew in
vehicle: Object - vehicle to populate with crew
Return Value:
Group - the group of the created crew or grpNull

Syntax 3

Syntax:
side createVehicleCrew vehicle
Parameters:
side: Side - side to create crew on
vehicle: Object - vehicle to populate with crew
Return Value:
Group - the group of the created crew or grpNull

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:
deleteVehicleCrew moveInDriver moveInGunner moveInCommander moveInTurret moveInCargo BIS_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
SilentSpike - c
Posted on Aug 20, 2014 - 14:01 (UTC)

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.

DrPastah - c
Posted on Dec 22, 2015 - 14:19 (UTC)
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.
AgentRevolution - c
Posted on Jun 02, 2017 - 03:26 (UTC)
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