weaponState: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(see also)
(optional param, command improvement)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Returns the current unit's or vehicle's weapon state |= Description
| Returns the currently selected weapon state for unit or vehicle.
<br><br>Since Arma 3 v1.67.140397 this command has been improved and extended:
* It is now possible to query any weapon of a vehicle without the need to place a weapon operator first, provided the weapon or muzzle is specified in optional param. By default a vehicle has no weapons selected, so querying currently selected weapon returns no weapon, unless weapon is specified.
* Driver turret can now be accessed as well with turret path [-1].
* Muzzle name is supported as well as weapon name. Weapon search gets priority, but if there is no weapon with such name, the muzzle will be selected. |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 22: Line 26:
____________________________________________________________________________________________
____________________________________________________________________________________________


|s2= '''weaponState''' [vehicle, turretPath] |= Syntax
|s2= '''weaponState''' [vehicle, turretPath, weapon] |= Syntax


|p21 =  [vehicle, turretPath]: [[Array]] |=
|p21 =  [vehicle, turretPath]: [[Array]] |=
|p22= vehicle: [[Object]] |= Parameter 1
|p22= vehicle: [[Object]] |= Parameter 1
|p23= turretPath: [[Array]] |= Parameter 2
|p23= turretPath: [[Array]] |= Parameter 2
|p24= weapon (Optional): [[String]] (since Arma 3 v1.69.140397) - weapon or muzzle name |=


|r2= [[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount], where:
|r2= [[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount], where:
Line 52: Line 56:
<h3 style='display:none'>Notes</h3>
<h3 style='display:none'>Notes</h3>
<dl class='command_description'>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on February 17, 2012
<dt class="note">'''[[User:kju|kju]]'''
<dd class="note">The command does not work for a vehicle driver - even if he has weapons.<br>
The command only works for vehicle positions, if there was an unit on the position '''before'''. When a position has been occupied once, the command even works when there is no unit currently at the given vehicle position.
<!-- Note Section END -->
</dl>
</dl>



Revision as of 18:44, 13 February 2017

Hover & click on the images for description

Description

Description:
Returns the currently selected weapon state for unit or vehicle.

Since Arma 3 v1.67.140397 this command has been improved and extended:
  • It is now possible to query any weapon of a vehicle without the need to place a weapon operator first, provided the weapon or muzzle is specified in optional param. By default a vehicle has no weapons selected, so querying currently selected weapon returns no weapon, unless weapon is specified.
  • Driver turret can now be accessed as well with turret path [-1].
  • Muzzle name is supported as well as weapon name. Weapon search gets priority, but if there is no weapon with such name, the muzzle will be selected.
Groups:
Uncategorised

Syntax

Syntax:
weaponState unit
Parameters:
unit: Object
Return Value:
Array - in format [weapon, muzzle, firemode, magazine, ammoCount], where:

Alternative Syntax

Syntax:
weaponState [vehicle, turretPath, weapon]
Parameters:
[vehicle, turretPath]: Array
vehicle: Object
turretPath: Array
weapon (Optional): String (since Arma 3 v1.69.140397) - weapon or muzzle name
Return Value:
Array - in format [weapon, muzzle, firemode, magazine, ammoCount], where:

Examples

Example 1:
_wsPlayer = weaponState player;// ["m16a4","m16a4","Single","30Rnd_556x45_Stanag",29]
Example 2:
_wsVehiclePlayer = weaponState [vehicle player,[0]]; //["M256","M256","M256","20Rnd_120mmSABOT_M1A2",20]
Example 3:
_SecondPositionOfThefirstTurret = weaponState [vehicle player,[0,0,1]];

Additional Information

See also:
weaponsselectWeaponTurretloadMagazinemagazinesTurretweaponsTurret

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

Notes

Bottom Section