assignedVehicleRole: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(see also)
m (Some wiki formatting)
 
(73 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= arma1
|version1= 1.05


|1.05|= Game version
|game2= arma2
|version2= 1.00


|arg= global |= Arguments in MP
|game3= arma2oa
____________________________________________________________________________________________
|version3= 1.50


| Return the role a unit is assigned to within its assigned vehicle.
|game4= tkoh
|version4= 1.00


The array which is returned contains:
|game5= arma3
* [] - Not assigned to any vehicle
|version5= 0.50
* ["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.
|arg= global


|= Description
|gr1= Object Manipulation
____________________________________________________________________________________________


| [[Array]] <nowiki>=</nowiki> '''assignedVehicleRole''' unitName |= Syntax
|descr= Returns the role a unit is assigned to within its assigned vehicle.
{{Feature|informative|See [[AI Group Vehicle Management]] for more information.}}


|p1= unitName: [[Object]] |= Parameter 1
|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.


| [[Array]] |= Return value
|s1= [[assignedVehicleRole]] unitName
____________________________________________________________________________________________
 
|x1= <code>_RoleArray = [[assignedVehicleRole]] [[player]];</code> |= Example 1
|x2= Get weapons available to player at player occupied turret:<code>_weaponsTurret = [[vehicle]] [[player]] [[weaponsTurret]] ([[assignedVehicleRole]] [[player]] [[select]] 1);</code> |= Example 2
____________________________________________________________________________________________


| [[addVehicle]], [[assignedVehicle]], [[unassignVehicle]], [[weaponsTurret]], [[assignAsCargo]], [[assignAsCommander]], [[assignAsDriver]], [[assignAsGunner]], [[assignAsTurret]], [[crew]], [[fullCrew]] |= See also
|p1= unitName: [[Object]]


}}
|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]])


<h3 style="display:none">Notes</h3>
|x1= <sqf>_RoleArray = assignedVehicleRole player;</sqf>
<dl class="command_description">


<!-- Note Section BEGIN -->
|x2= Get weapons available to player at player occupied turret:
<dd class="notedate">Posted on August 31, 2013
<sqf>_weaponsTurret = vehicle player weaponsTurret (assignedVehicleRole player select 1);</sqf>
<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.


|seealso= [[addVehicle]] [[assignedVehicle]] [[unassignVehicle]] [[leaveVehicle]] [[assignAsCargo]] [[assignAsCommander]] [[assignAsDriver]] [[assignAsGunner]] [[assignAsTurret]] [[crew]] [[assignedVehicles]] [[assignedGroup]] [[fullCrew]]
}}


<!-- Note Section END -->
{{Note
</dl>
|user= Killzone_Kid
 
|timestamp= 20130831161800
<h3 style="display:none">Bottom Section</h3>
|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.
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting Commands ArmA|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Vehicle_Assignment|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{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 -->

Latest revision as of 16: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.