assignedVehicleRole: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " +" to " ")
m (Some wiki formatting)
 
(33 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| arma1
|game1= arma1
|version1= 1.05


|1.05
|game2= arma2
|version2= 1.00
 
|game3= arma2oa
|version3= 1.50
 
|game4= tkoh
|version4= 1.00
 
|game5= arma3
|version5= 0.50


|arg= global
|arg= global


|gr1= Object Manipulation
|gr1= Object Manipulation
|descr= Returns the role a unit is assigned to within its assigned vehicle.
{{Feature|informative|See [[AI Group Vehicle Management]] for more information.}}


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


|Returns the role a unit is assigned to within its assigned vehicle.
|s1= [[assignedVehicleRole]] unitName


<br><br>
|p1= unitName: [[Object]]
'''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).


| '''assignedVehicleRole''' unitName
|r1= [[Array]] - the array which is returned contains:<br>
* [] - not assigned to any vehicle
* ["driver"] - Assigned as driver
* ["cargo"] or {{GVI|arma3|1.32|size= 0.75}} ["cargo", [turret path]] - assigned as cargo
* ["turret", turretPath] - assigned to a turret (turretPath format [[Turret Path]])


|p1= unitName: [[Object]]
|x1= <sqf>_RoleArray = assignedVehicleRole player;</sqf>


| [[Array]] - The array which is returned contains:<br>
|x2= Get weapons available to player at player occupied turret:
* [] - Not assigned to any vehicle
<sqf>_weaponsTurret = vehicle player weaponsTurret (assignedVehicleRole player select 1);</sqf>
* ["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


|x1= <code>_RoleArray = [[assignedVehicleRole]] [[player]];</code>
|seealso= [[addVehicle]] [[assignedVehicle]] [[unassignVehicle]] [[leaveVehicle]] [[assignAsCargo]] [[assignAsCommander]] [[assignAsDriver]] [[assignAsGunner]] [[assignAsTurret]] [[crew]] [[assignedVehicles]] [[assignedGroup]] [[fullCrew]]
|x2= Get weapons available to player at player occupied turret:<code>_weaponsTurret = [[vehicle]] [[player]] [[weaponsTurret]] ([[assignedVehicleRole]] [[player]] [[select]] 1);</code>
}}


|seealso= [[addVehicle]], [[assignedVehicle]], [[unassignVehicle]], [[leaveVehicle]], [[assignAsCargo]], [[assignAsCommander]], [[assignAsDriver]], [[assignAsGunner]], [[assignAsTurret]], [[crew]], [[fullCrew]]
{{Note
|user= Killzone_Kid
|timestamp= 20130831161800
|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.
In short, forget about this command for the player, it is unreliable and has been broken too many times in the past.
}}
}}
<dl class="command_description">
<dt><dt>
<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>
</dl>
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}

Latest revision as of 15:28, 17 April 2023

Hover & click on the images for description

Description

Description:
Returns the role a unit is assigned to within its assigned vehicle.
See AI Group Vehicle Management for more information.
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 Arma 3 logo black.png1.32 ["cargo", [turret path]] - assigned as cargo
  • ["turret", turretPath] - assigned to a turret (turretPath format Turret Path)

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:
addVehicle assignedVehicle unassignVehicle leaveVehicle assignAsCargo assignAsCommander assignAsDriver assignAsGunner assignAsTurret crew assignedVehicles assignedGroup fullCrew

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
Killzone_Kid - c
Posted on Aug 31, 2013 - 16:18 (UTC)
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.