weaponState: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame( +[0-9])?|Game [Vv]ersion( +[0-9])?|Game Version \(number surrounded by NO SPACES\)|Arguments in MP|MP[Aa]rg|Multiplayer Arguments( \("local" or "global"\))?|Effects|Execution|Effects...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| arma2oa | | arma2oa | ||
|1.60 | |1.60 | ||
|gr1= Weapons | |gr1= Weapons | ||
| Returns the currently selected weapon state for unit or vehicle.<br><br> | | Returns the currently selected weapon state for unit or vehicle.<br><br> | ||
Line 12: | Line 12: | ||
* 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) | * 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. The command searches for weapon first, then if not found, muzzle is searched for. }} | * Muzzle name is supported as well as weapon name. The command searches for weapon first, then if not found, muzzle is searched for. }} | ||
| [[weaponState]] unit | | [[weaponState]] unit | ||
|p1= unit: [[Object]] | |p1= unit: [[Object]] | ||
| [[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]] | * ammoCount: [[Number]] | ||
|s2= [[weaponState]] [vehicle, turretPath, weapon] | |s2= [[weaponState]] [vehicle, turretPath, weapon] | ||
|p21= [vehicle, turretPath, weapon]: [[Array]] |PARAMETER21= | |p21= [vehicle, turretPath, weapon]: [[Array]] |PARAMETER21= | ||
Line 40: | Line 40: | ||
* firemode: [[String]] | * firemode: [[String]] | ||
* magazine: [[String]] | * magazine: [[String]] | ||
* ammoCount: [[Number]] | * ammoCount: [[Number]] | ||
|x1= <code>_wsPlayer = [[weaponState]] [[player]]; {{cc|["arifle_MXC_ACO_F","arifle_MXC_ACO_F","Single","30Rnd_65x39_caseless_mag",30]}}</code> | |x1= <code>_wsPlayer = [[weaponState]] [[player]]; {{cc|["arifle_MXC_ACO_F","arifle_MXC_ACO_F","Single","30Rnd_65x39_caseless_mag",30]}}</code> | ||
|x2= <code>_wsVehicle = [[weaponState]] [_apc, [0]]; {{cc|["autocannon_40mm_CTWS","HE","player","60Rnd_40mm_GPR_Tracer_Red_shells",60]}}</code> | |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> | |x3= <code>_wsVehicle = [[weaponState]] [_apc, [0], "AP"]; {{cc|["autocannon_40mm_CTWS","AP","player","40Rnd_40mm_APFSDS_Tracer_Red_shells",40]}}</code> | ||
| [[weapons]], [[selectWeaponTurret]], [[loadMagazine]], [[magazinesTurret]], [[weaponsTurret]] | | [[weapons]], [[selectWeaponTurret]], [[loadMagazine]], [[magazinesTurret]], [[weaponsTurret]] | ||
}} | }} | ||
Revision as of 11:43, 18 January 2021
Description
- Description:
- Returns the currently selected weapon state for unit or vehicle.
- Groups:
- Weapons
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
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