weaponState: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:ArmA 2 OA: New Scripting Commands List" to "[[Category:Arma 2: Operation Arrowhead: New Scripting Commands List")
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Returns the currently selected weapon state for unit or vehicle.  
| Returns the currently selected weapon state for unit or vehicle.<br><br>
<br><br>Since Arma 3 v1.69.140397 this command has been improved and extended:
{{Feature arma3 |
* 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.
Since {{arma3}} v1.69.140397 this command has been improved and extended:
* A vehicle's weapon query doesn't need a weapon operator provided the weapon or muzzle is specified in optional param.<br>(keep in mind that by default a vehicle has no weapons selected)
* 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. The command searches for weapon first, then if not found, muzzle is searched for. }}|DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''weaponState''' unit |SYNTAX=
| [[weaponState]] unit |SYNTAX=


|p1= unit: [[Object]] |PARAMETER1=
|p1= unit: [[Object]] |PARAMETER1=
Line 26: Line 27:
____________________________________________________________________________________________
____________________________________________________________________________________________


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


|p21 =  [vehicle, turretPath, weapon]: [[Array]] |PARAMETER21=
|p21=  [vehicle, turretPath, weapon]: [[Array]] |PARAMETER21=


|p22= vehicle: [[Object]] |PARAMETER1=
|p22= vehicle: [[Object]] |PARAMETER22=
|p23= turretPath: [[Array]] |PARAMETER2=
 
|p24= weapon (Optional): [[String]] (since Arma 3 v1.69.140397) - weapon or muzzle name |=
|p23= turretPath: [[Array]] |PARAMETER23=
 
|p24= weapon (Optional): [[String]] (since Arma 3 v1.69.140397) - weapon or muzzle name |PARAMETER24=


|r2= [[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount], where:
|r2= [[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount], where:
Line 39: Line 42:
* firemode: [[String]]
* firemode: [[String]]
* magazine: [[String]]
* magazine: [[String]]
* ammoCount: [[Number]] |RETURNVALUE=
* ammoCount: [[Number]] |RETURNVALUE2=
____________________________________________________________________________________________
 
|x1= <code>_wsPlayer = [[weaponState]] [[player]]; // ["arifle_MXC_ACO_F","arifle_MXC_ACO_F","Single","30Rnd_65x39_caseless_mag",30]</code>|EXAMPLE1=
|x2= <code>_wsVehicle = [[weaponState]] [_apc, [0]]; // ["autocannon_40mm_CTWS","HE","player","60Rnd_40mm_GPR_Tracer_Red_shells",60]</code>|EXAMPLE2=
|x3= <code>_wsVehicle = [[weaponState]] [_apc, [0], "AP"]; // ["autocannon_40mm_CTWS","AP","player","40Rnd_40mm_APFSDS_Tracer_Red_shells",40]</code>|EXAMPLE3=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[weapons]], [[selectWeaponTurret]], [[loadMagazine]], [[magazinesTurret]], [[weaponsTurret]] |SEEALSO=
|x1= <code>_wsPlayer = [[weaponState]] [[player]]; {{cc|["arifle_MXC_ACO_F","arifle_MXC_ACO_F","Single","30Rnd_65x39_caseless_mag",30]}}</code> |EXAMPLE1=
 
|x2= <code>_wsVehicle = [[weaponState]] [_apc, [0]]; {{cc|["autocannon_40mm_CTWS","HE","player","60Rnd_40mm_GPR_Tracer_Red_shells",60]}}</code> |EXAMPLE2=
|MPBEHAVIOUR=  
|x3= <code>_wsVehicle = [[weaponState]] [_apc, [0], "AP"]; {{cc|["autocannon_40mm_CTWS","AP","player","40Rnd_40mm_APFSDS_Tracer_Red_shells",40]}}</code> |EXAMPLE3=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[weapons]], [[selectWeaponTurret]], [[loadMagazine]], [[magazinesTurret]], [[weaponsTurret]] |SEEALSO=
}}
}}


Line 64: Line 63:
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Arma 2: Operation Arrowhead: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]

Revision as of 10:57, 1 October 2019

Hover & click on the images for description

Description

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

Arma 3
Since Arma 3 v1.69.140397 this command has been improved and extended:
  • A vehicle's weapon query doesn't need a weapon operator provided the weapon or muzzle is specified in optional param.
    (keep in mind that by default a vehicle has no weapons selected)
  • Driver turret can now be accessed as well with turret path [-1].
  • Muzzle name is supported as well as weapon name. The command searches for weapon first, then if not found, muzzle is searched for.
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