assignedVehicleRole: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:Scripting Commands ArmA|" to "[[Category:Scripting Commands Armed Assault|")
(improved description)
Line 18: Line 18:


If no vehicle role is assigned, an empty array is returned.
If no vehicle role is assigned, an empty array is returned.
 
<br><br>
Notes:
* When an unit enters a vehicle crew position, it gets assigned the vehicle role automatically for the given crew position.
* The unit does not have to be in the vehicle when getting the role assignment (ie via assignAsXXX or human/AI GL getIn radio commands).
* GL getIn radio commands result in instant assignment - the unit does not yet have to occupy the crew position.
* Dying units will let go of the assigned role after a few seconds - seems the delay is independent of being in the vehicle or not.
* An unit will hold on to its assigned role after exiting the vehicle.
* One has to use [[unassignVehicle]] (and stop an AI GL to assign vehicle positions again) or [[leaveVehicle]] to remove the assignment - or assigned to another vehicle.
* A vehicle position/role can only be assigned to one unit at a time. So even when not (visually) occupied, the "seat" may be blocked/reserved by another unit.
* A player can still get into the vehicle position already assigned if not already taken, or switch seats with AI (if [[leader]] or [[effectiveCommander]] for those AI).
|DESCRIPTION=
|DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________
Line 31: Line 40:
|x1= <code>_RoleArray = [[assignedVehicleRole]] [[player]];</code> |EXAMPLE1=
|x1= <code>_RoleArray = [[assignedVehicleRole]] [[player]];</code> |EXAMPLE1=
|x2= Get weapons available to player at player occupied turret:<code>_weaponsTurret = [[vehicle]] [[player]] [[weaponsTurret]] ([[assignedVehicleRole]] [[player]] [[select]] 1);</code> |EXAMPLE2=
|x2= Get weapons available to player at player occupied turret:<code>_weaponsTurret = [[vehicle]] [[player]] [[weaponsTurret]] ([[assignedVehicleRole]] [[player]] [[select]] 1);</code> |EXAMPLE2=
| mp= On a client the command will return empty arrays for every unit that is not local. On the server the command correctly returns the role, regardless of the units locality.
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[addVehicle]], [[assignedVehicle]], [[unassignVehicle]], [[weaponsTurret]], [[assignAsCargo]], [[assignAsCommander]], [[assignAsDriver]], [[assignAsGunner]], [[assignAsTurret]], [[crew]], [[fullCrew]] |SEEALSO=
| [[addVehicle]], [[assignedVehicle]], [[unassignVehicle]], [[leaveVehicle]], [[assignAsCargo]], [[assignAsCommander]], [[assignAsDriver]], [[assignAsGunner]], [[assignAsTurret]], [[crew]], [[fullCrew]] |SEEALSO=


}}
}}
Line 41: Line 52:


<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on August 31, 2013
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]
<dd class="note">When unit with unassigned vehicle role enters a vehicle, it gets assigned vehicle role automatically. The unit then will hold on to its assigned role after exiting the vehicle.<br><br>To add, when player is in the group of AIs and is not the leader, [[assignedVehicleRole]] of the player could be unpredictable and absolutely not related to the position player occupies. In short, forget about this command, it is unreliable and has been broken too many times in the past.


<dd class="notedate">Posted on August 31, 2013</dd>
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt>
<dd class="note">When player is in a group of AIs and is not the leader, [[assignedVehicleRole]] of the player could be unpredictable and absolutely not related to the position player occupies. In short, forget about this command for the player, it is unreliable and has been broken too many times in the past.
</dd>


<!-- Note Section END -->
<!-- Note Section END -->
Line 58: Line 70:
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on November 15, 2014 - 23:31 (UTC)</dd>
<dt class="note">[[User:Tajin|Tajin]]</dt>
<dd class="note">
In multiplayer (tested in v1.34), this only works reliably on the server.<br>
<br>
'''Behaviour is as follows:'''<br>
On a client, the command will return empty arrays for every unit that is not local.<br>
On the server, the command correctly returns the position, regardless of the units locality.<br>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 07:08, 9 August 2020

-wrong parameter ("Arma") defined!-1.05
Hover & click on the images for description

Description

Description:
Return the role a unit is assigned to within its assigned vehicle. The array which is returned contains:
  • [] - Not assigned to any vehicle
  • ["Driver"] - Assigned as driver
  • ["Cargo"] (or ["Cargo", [turret path]] since Arma 3 1.31.127272) - Assigned as cargo
  • ["Turret", [turret path]] - Assigned to a turret
If no vehicle role is assigned, an empty array is returned.

Notes:
  • When an unit enters a vehicle crew position, it gets assigned the vehicle role automatically for the given crew position.
  • The unit does not have to be in the vehicle when getting the role assignment (ie via assignAsXXX or human/AI GL getIn radio commands).
  • GL getIn radio commands result in instant assignment - the unit does not yet have to occupy the crew position.
  • Dying units will let go of the assigned role after a few seconds - seems the delay is independent of being in the vehicle or not.
  • An unit will hold on to its assigned role after exiting the vehicle.
  • One has to use unassignVehicle (and stop an AI GL to assign vehicle positions again) or leaveVehicle to remove the assignment - or assigned to another vehicle.
  • A vehicle position/role can only be assigned to one unit at a time. So even when not (visually) occupied, the "seat" may be blocked/reserved by another unit.
  • A player can still get into the vehicle position already assigned if not already taken, or switch seats with AI (if leader or effectiveCommander for those AI).
Multiplayer:
On a client the command will return empty arrays for every unit that is not local. On the server the command correctly returns the role, regardless of the units locality. ____________________________________________________________________________________________
Groups:
Uncategorised

Syntax

Syntax:
assignedVehicleRole unitName
Parameters:
unitName: Object
Return Value:
Array - array in one of the formats described in description

Examples

Example 1:
_RoleArray = assignedVehicleRole player;
Example 2:
Get weapons available to player at player occupied turret:_weaponsTurret = vehicle player weaponsTurret (assignedVehicleRole player select 1);

Additional Information

See also:
addVehicleassignedVehicleunassignVehicleleaveVehicleassignAsCargoassignAsCommanderassignAsDriverassignAsGunnerassignAsTurretcrewfullCrew

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

Posted on August 31, 2013
Killzone_Kid
When player is in a group of AIs and is not the leader, assignedVehicleRole of the player could be unpredictable and absolutely not related to the position player occupies. In short, forget about this command for the player, it is unreliable and has been broken too many times in the past.

Bottom Section