assignedVehicleRole: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ")
m (Text replacement - "\|s([0-9])\= '''([^' ]+)'''([^ ]+) " to "|s$1= $2$3 ")
Line 35: Line 35:
* 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).
* 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).


|s1= '''assignedVehicleRole''' unitName
|s1= [[assignedVehicleRole]] unitName


|p1= unitName: [[Object]]
|p1= unitName: [[Object]]

Revision as of 18:06, 20 June 2021

Hover & click on the images for description

Description

Description:
Returns the role a unit is assigned to within its assigned vehicle.

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:
Object Manipulation

Syntax

Syntax:
assignedVehicleRole unitName
Parameters:
unitName: Object
Return Value:
Array - 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

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
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.