weaponState: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
m (template:command argument fix)
Line 11: Line 11:
* 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.
* 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].
* 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 given name, the muzzles will be searched. |= Description
* Muzzle name is supported as well as weapon name. Weapon search gets priority, but if there is no weapon with given name, the muzzles will be searched. |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''weaponState''' unit |= Syntax
| '''weaponState''' unit |SYNTAX=


|p1= unit: [[Object]] |= Parameter 1
|p1= unit: [[Object]] |PARAMETER1=


| [[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount], where:
| [[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount], where:
Line 23: Line 23:
* firemode: [[String]]
* firemode: [[String]]
* magazine: [[String]]
* magazine: [[String]]
* ammoCount: [[Number]] |= Return value
* ammoCount: [[Number]] |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________


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


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


Line 38: Line 38:
* firemode: [[String]]
* firemode: [[String]]
* magazine: [[String]]
* magazine: [[String]]
* ammoCount: [[Number]] |= Return value
* ammoCount: [[Number]] |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 14:51, 7 April 2019

Hover & click on the images for description

Description

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

Since Arma 3 v1.69.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 given name, the muzzles will be searched.
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, weapon]: 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; // ["arifle_MXC_ACO_F","arifle_MXC_ACO_F","Single","30Rnd_65x39_caseless_mag",30]
Example 2:
_wsVehicle = weaponState [_apc, [0]]; // ["autocannon_40mm_CTWS","HE","player","60Rnd_40mm_GPR_Tracer_Red_shells",60]
Example 3:
_wsVehicle = weaponState [_apc, [0], "AP"]; // ["autocannon_40mm_CTWS","AP","player","40Rnd_40mm_APFSDS_Tracer_Red_shells",40]

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