weaponState: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 22: Line 22:
|p1= unit: [[Object]]
|p1= unit: [[Object]]


|r1=[[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount, reloadPhase], where:
|r1=[[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount, roundReloadPhase, magazineReloadPhase], where:
* weapon: [[String]]
* weapon: [[String]]
* muzzle: [[String]]
* muzzle: [[String]]
Line 29: Line 29:
* ammoCount: [[Number]]
* ammoCount: [[Number]]
* roundReloadPhase: [[Number]] - current ammo round reload phase (see [[weaponReloadingTime]] Since Arma 3 v2.05.147785)
* roundReloadPhase: [[Number]] - current ammo round reload phase (see [[weaponReloadingTime]] Since Arma 3 v2.05.147785)
* magazineReloadPhase: [[Number]] - current magazine reload phase from 1 to 0, 0 - reload complete. >0 - reload in progress (Since Arma 3 v2.05.147855)


|s2= [[weaponState]] [vehicle, turretPath, weapon]
|s2= [[weaponState]] [vehicle, turretPath, weapon]
Line 40: Line 41:
|p24= weapon (Optional): [[String]] (since Arma 3 v1.70) - weapon or muzzle name
|p24= weapon (Optional): [[String]] (since Arma 3 v1.70) - weapon or muzzle name


|r2= [[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount, reloadPhase], where:
|r2= [[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount, roundReloadPhase, magazineReloadPhase], where:
* weapon: [[String]]
* weapon: [[String]]
* muzzle: [[String]]
* muzzle: [[String]]
Line 47: Line 48:
* ammoCount: [[Number]]
* ammoCount: [[Number]]
* roundReloadPhase: [[Number]] - current ammo round reload phase (see [[weaponReloadingTime]] Since Arma 3 v2.05.147785)
* roundReloadPhase: [[Number]] - current ammo round reload phase (see [[weaponReloadingTime]] Since Arma 3 v2.05.147785)
* magazineReloadPhase: [[Number]] - current magazine reload phase from 1 to 0, 0 - reload complete. >0 - reload in progress (Since Arma 3 v2.05.147855)


|x1= <code>_wsPlayer = [[weaponState]] [[player]]; {{cc|["arifle_MXC_ACO_F","arifle_MXC_ACO_F","Single","30Rnd_65x39_caseless_mag",30]}}</code>
|s3= unit [[weaponState]] weaponOrMuzzle &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;''Since Arma 3 v2.05.147855''
|x2= <code>_wsVehicle = [[weaponState]] [_apc, [0]]; {{cc|["autocannon_40mm_CTWS","HE","player","60Rnd_40mm_GPR_Tracer_Red_shells",60]}}</code>
 
|x3= <code>_wsVehicle = [[weaponState]] [_apc, [0], "AP"]; {{cc|["autocannon_40mm_CTWS","AP","player","40Rnd_40mm_APFSDS_Tracer_Red_shells",40]}}</code>
|p41= unit: [[Object]]
|p42= weaponOrMuzzle: [[String]]
 
|r3=[[Array]] - in format [weapon, muzzle, firemode, magazine, ammoCount, roundReloadPhase, magazineReloadPhase], where:
* weapon: [[String]]
* muzzle: [[String]]
* firemode: [[String]]
* magazine: [[String]]
* ammoCount: [[Number]]
* roundReloadPhase: [[Number]] - current ammo round reload phase (see [[weaponReloadingTime]])
* magazineReloadPhase: [[Number]] - current magazine reload phase from 1 to 0, 0 - reload complete. >0 - reload in progress
 
 
|x1= <code>_wsPlayer = [[weaponState]] [[player]]; {{cc|["arifle_MXC_ACO_F","arifle_MXC_ACO_F","Single","30Rnd_65x39_caseless_mag",30,0,0]}}</code>
|x2= <code>_wsVehicle = [[weaponState]] [_apc, [0]]; {{cc|["autocannon_40mm_CTWS","HE","player","60Rnd_40mm_GPR_Tracer_Red_shells",60,0,0]}}</code>
|x3= <code>_wsVehicle = [[weaponState]] [_apc, [0], "AP"]; {{cc|["autocannon_40mm_CTWS","AP","player","40Rnd_40mm_APFSDS_Tracer_Red_shells",40,0,0]}}</code>
|x4= <code>_wsPlayer = [[player]] [[weaponState]] "GL_3GL_F"; {{cc|["arifle_MX_GL_ACO_F","GL_3GL_F","Single","1Rnd_HE_Grenade_shell",1,0,0]}}</code>


|seealso= [[weapons]], [[selectWeaponTurret]], [[loadMagazine]], [[magazinesTurret]], [[weaponsTurret]], [[weaponReloadingTime]]
|seealso= [[weapons]], [[selectWeaponTurret]], [[loadMagazine]], [[magazinesTurret]], [[weaponsTurret]], [[weaponReloadingTime]]
}}
}}

Revision as of 23:32, 5 July 2021

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.70 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:
Weapons

Syntax 1

Syntax:
weaponState unit
Parameters:
unit: Object
Return Value:
Array - in format [weapon, muzzle, firemode, magazine, ammoCount, roundReloadPhase, magazineReloadPhase], where:
  • weapon: String
  • muzzle: String
  • firemode: String
  • magazine: String
  • ammoCount: Number
  • roundReloadPhase: Number - current ammo round reload phase (see weaponReloadingTime Since Arma 3 v2.05.147785)
  • magazineReloadPhase: Number - current magazine reload phase from 1 to 0, 0 - reload complete. >0 - reload in progress (Since Arma 3 v2.05.147855)

Syntax 2

Syntax:
weaponState [vehicle, turretPath, weapon]
Parameters:
[vehicle, turretPath, weapon]: Array
vehicle: Object
turretPath: Array
weapon (Optional): String (since Arma 3 v1.70) - weapon or muzzle name
Return Value:
Array - in format [weapon, muzzle, firemode, magazine, ammoCount, roundReloadPhase, magazineReloadPhase], where:
  • weapon: String
  • muzzle: String
  • firemode: String
  • magazine: String
  • ammoCount: Number
  • roundReloadPhase: Number - current ammo round reload phase (see weaponReloadingTime Since Arma 3 v2.05.147785)
  • magazineReloadPhase: Number - current magazine reload phase from 1 to 0, 0 - reload complete. >0 - reload in progress (Since Arma 3 v2.05.147855)

Syntax 3

Syntax:
unit weaponState weaponOrMuzzle        Since Arma 3 v2.05.147855
Parameters:
unit: Object
weaponOrMuzzle: String
Return Value:
Array - in format [weapon, muzzle, firemode, magazine, ammoCount, roundReloadPhase, magazineReloadPhase], where:

Examples

Example 1:
_wsPlayer = weaponState player; // ["arifle_MXC_ACO_F","arifle_MXC_ACO_F","Single","30Rnd_65x39_caseless_mag",30,0,0]
Example 2:
_wsVehicle = weaponState [_apc, [0]]; // ["autocannon_40mm_CTWS","HE","player","60Rnd_40mm_GPR_Tracer_Red_shells",60,0,0]
Example 3:
_wsVehicle = weaponState [_apc, [0], "AP"]; // ["autocannon_40mm_CTWS","AP","player","40Rnd_40mm_APFSDS_Tracer_Red_shells",40,0,0]
Example 4:
_wsPlayer = player weaponState "GL_3GL_F"; // ["arifle_MX_GL_ACO_F","GL_3GL_F","Single","1Rnd_HE_Grenade_shell",1,0,0]

Additional Information

See also:
weaponsselectWeaponTurretloadMagazinemagazinesTurretweaponsTurretweaponReloadingTime

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