{"name":"assignedVehicleRole","title":"assignedVehicleRole","type":"command","url":"https://community.bistudio.com/wiki/assignedVehicleRole","revid":338904,"updated":"2023-04-17T14:28:10Z","groups":["Object Manipulation"],"status":"ok","games":{"arma1":"1.05","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.05","arma3_since":"0.50","locality":{"argument":"global"},"description":"Returns the role a unit is assigned to within its assigned vehicle.\n\n> [!NOTE]\n> See AI Group Vehicle Management for more information.","syntaxes":[{"syntax":"assignedVehicleRole unitName","params":[{"name":"unitName","type":"Object","type_expr":"Object"}],"returns":{"type":"Array","type_expr":"Array","description":"the array which is returned contains:\n- [] - not assigned to any vehicle - [\"driver\"] - Assigned as driver - [\"cargo\"] or Arma 3 v1.32 [\"cargo\", [turret path]] - assigned as cargo - [\"turret\", turretPath] - assigned to a turret (turretPath format Turret Path)","text":"Array - the array which is returned contains:\n\n- [] - not assigned to any vehicle\n- [\"driver\"] - Assigned as driver\n- [\"cargo\"] or Arma 3 v1.32 [\"cargo\", [turret path]] - assigned as cargo\n- [\"turret\", turretPath] - assigned to a turret (turretPath format Turret Path)"},"form":"unary","right":{"text":"unitName"}}],"examples":[{"code":["_RoleArray = assignedVehicleRole player;"]},{"text":"Get weapons available to player at player occupied turret:\n\n```sqf\n_weaponsTurret = vehicle player weaponsTurret (assignedVehicleRole player select 1);\n```","code":["_weaponsTurret = vehicle player weaponsTurret (assignedVehicleRole player select 1);"]}],"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.","see_also":["addVehicle","assignedVehicle","unassignVehicle","leaveVehicle","assignAsCargo","assignAsCommander","assignAsDriver","assignAsGunner","assignAsTurret","crew","assignedVehicles","assignedGroup","fullCrew"],"notes":[{"user":"Killzone_Kid","date":"2013-08-31T16:18:00Z","text":"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.\nIn short, forget about this command for the player, it is unreliable and has been broken too many times in the past."}]}