{"name":"assignedVehicleRole","operator":null,"title":"assignedVehicleRole","type":"command","url":"https://community.bistudio.com/wiki/assignedVehicleRole","revid":338904,"updated":"2023-04-17T14:28:10Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"arma1","name":"Armed Assault","version":"1.05"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma1","name":"Armed Assault","version":"1.05"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"unitName","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unitName: Object"}],"returns":{"type":"Array","types":["Array"],"description":"the array which is returned contains: - [] - 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","operator":null,"left":null,"right":{"text":"unitName","types":["Object"]}}],"examples":[{"text":"```sqf\n_RoleArray = assignedVehicleRole player;\n```","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.","problems":null,"aliases":[],"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."}],"categories":["ArmA: Armed Assault: New Scripting Commands","ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Armed Assault version 1.05","Scripting Commands","Take On Helicopters: Scripting Commands"]}