createVehicleCrew: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(76 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


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


|0.76|= Game version
|arg= global
____________________________________________________________________________________________
|eff= global


| Creates crew to given empty vehicle. Crew members are default crew defined in config. Crew side will also correspond to vehicle's [[faction]]. |= Description
|gr1= Object Manipulation
____________________________________________________________________________________________


| '''createVehicleCrew''' vehicle |= Syntax
|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>
To find out which crew will be created, use [[BIS_fnc_vehicleCrewTurrets]].


|p1= vehicle: [[Object]] |= Parameter 1
{{{!}} class="wikitable valign-top"
{{!}}+ This command:
! Does
! Does not
{{!}}-
{{!}}
* {{GVI|arma3|1.26|size= 0.75}} create a group if one is needed (otherwise uses <sqf inline>group _vehicle</sqf>)
* create a driver if the vehicle needs one (<syntaxhighlight lang="cpp" inline>hasDriver = 1;</syntaxhighlight> in config)
* create [[allTurrets|all non-FFV turrets]] gunners (if the turret needs one - config {<syntaxhighlight lang="cpp" inline>hasGunner</syntaxhighlight> without <syntaxhighlight lang="cpp" inline>dontCreateAI</syntaxhighlight>)
* create crew with '''[[rank]]s''' - with the driver as {{hl|"LIEUTENANT"}} and all turret units as {{hl|"SERGEANT"}}, unlike a crewed vehicle placed in [[:Category:Eden Editor|Eden Editor]] where all units are {{hl|"PRIVATE"}}.
{{!}}
* [[addVehicle|add vehicle]] to the group, unlike a crewed vehicle placed in [[:Category:Eden Editor|Eden Editor]]. See [[BIS_fnc_spawnVehicle]] to spawn a crew-full vehicle with group addition
* create cargo units.
{{!}}}


| [[Nothing]] |= RETURNVALUE
|mp= This command seems to be {{Icon|localArgument|32}} with UAVs.


|s1= [[createVehicleCrew]] vehicle


|x1= <code>// Spawn a flying UAV with crew. 
|p1= vehicle: [[Object]] - vehicle to populate with crew
myUAV = <nowiki>[</nowiki>[[getPos]] [[player]], 0, "B_UAV_02_F", [[west]]] [[call]] [[BIS_fnc_spawnVehicle]];
[[createVehicleCrew]] (myUAV [[select]] 0);
</code>|= EXAMPLE1


|x2= <code>_veh = [[createVehicle]] ["O_MRAP_02_hmg_F", [[position]] [[player]], [], 0, "NONE"];
|r1= [[Group]] - the group of the created crew (since {{GVI|arma3|1.94}}; before that returned [[Nothing]])
[[createVehicleCrew]] _veh;
 
{
|s2= group [[createVehicleCrew]] vehicle
[[diag_log]] [_x, [[faction]] _x, [[side]] _x, [[side]] [[group]] _x];
|s2since= arma3 2.14
} [[forEach]] [[crew]] _veh;</code>
 
|p21= group: [[Group]] - group to put crew in


<code>[O Alpha 1-1:1,"OPF_F",EAST,EAST]
|p22= vehicle: [[Object]] - vehicle to populate with crew
[O Alpha 1-1:2,"OPF_F",EAST,EAST]
</code>|= EXAMPLE2


____________________________________________________________________________________________
|r2= [[Group]] - the group of the created crew or [[grpNull]]


| [[deleteVehicleCrew]], [[moveInDriver]], [[moveInGunner]], [[moveInCommander]], [[moveInTurret]], [[moveInCargo]] |= SEEALSO
|s3= side [[createVehicleCrew]] vehicle
|s3since= arma3 2.14


| |= MPBEHAVIOUR
|p41= side: [[Side]] - side to create crew on
____________________________________________________________________________________________
}}


<h3 style='display:none'>Notes</h3>
|p42= vehicle: [[Object]] - vehicle to populate with crew
<dl class='command_description'>
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|r3= [[Group]] - the group of the created crew or [[grpNull]]
</dl>


<h3 style='display:none'>Bottom Section</h3>
|x1= <sqf>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
_veh = createVehicle ["B_MRAP_01_F", getMarkerPos "createVeh", [], 0, "NONE"];
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
createVehicleCrew _veh;
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
</sqf>
[[Category:Command_Group:_Vehicle_Assignment|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
|x2= <sqf>
<dl class="command_description">
_veh = createVehicle ["O_MRAP_02_hmg_F", position player, [], 0, "NONE"];
<dd class="notedate">Posted on August 20, 2014 - 14:01 (UTC)</dd>
createVehicleCrew _veh;
<dt class="note">[[User:SilentSpike|SilentSpike]]</dt>
{
<dd class="note">
diag_log [_x, faction _x, side _x, side group _x];
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.
} forEach crew _veh;
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
// [O Alpha 1-1:1,"OPF_F",EAST,EAST]
<dl class="command_description">
// [O Alpha 1-1:2,"OPF_F",EAST,EAST]
<dd class="notedate">Posted on November 8, 2014 - 17:06 (UTC)</dd>
</sqf>
<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.
|seealso= [[deleteVehicleCrew]] [[moveInDriver]] [[moveInGunner]] [[moveInCommander]] [[moveInTurret]] [[moveInCargo]] [[BIS_fnc_spawnVehicle]]
}}


</dd>
{{Note
</dl>
|user= SilentSpike
<!-- DISCONTINUE Notes -->
|timestamp= 20140820140100
|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.
|game= arma3
|version= 1.26
}}
 
{{Note
|user= DrPastah
|timestamp= 20151222141900
|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.
}}
 
{{Note
|user= AgentRev
|timestamp= 20170602032600
|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>
For instance, the following snippet calculates how many seats will be occupied by the created crew:
<sqf>
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);
</sqf>
Also, I've written a function to create a UAV crew for a specific side: https://gist.github.com/AgentRev/cb25d30e464f2239b6cee51fa0110c78
}}

Latest revision as of 11:35, 3 September 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:
Does Does not
  • Arma 3 logo black.png1.26 create a group if one is needed (otherwise uses group _vehicle)
  • create a driver if the vehicle needs one (hasDriver = 1; in config)
  • create all non-FFV turrets gunners (if the turret needs one - config {hasGunner without dontCreateAI)
  • create crew with ranks - with the driver as "LIEUTENANT" and all turret units as "SERGEANT", unlike a crewed vehicle placed in Eden Editor where all units are "PRIVATE".
Multiplayer:
This command seems to be LALocal with UAVs.
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.
AgentRev - 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