weaponsInfo: Difference between revisions
Killzone Kid (talk | contribs) No edit summary |
BrettMayson (talk | contribs) mNo edit summary |
||
| Line 16: | Line 16: | ||
|p3= onlyLoaded: [[Boolean]] - (Optional, default [[false]]) [[true]] to return loaded weapons only | |p3= onlyLoaded: [[Boolean]] - (Optional, default [[false]]) [[true]] to return loaded weapons only | ||
|r1= [[Array]] of [[Array]]s | |r1= [[Array]] of [[Array]]s with [weaponIndex, isSelected, weaponName, muzzleName, firemode, magazineName, ammoCount, isPrimary] (or an empty []): | ||
* weaponIndex: [[Number]] - internal weapon index (changes frequently) used with "SwitchWeapon" and "UseWeapon" [[action]]s | * weaponIndex: [[Number]] - internal weapon index (changes frequently) used with "SwitchWeapon" and "UseWeapon" [[action]]s | ||
* isSelected: [[Boolean]] - [[true]] if this weapon is currently selected | * isSelected: [[Boolean]] - [[true]] if this weapon is currently selected | ||
Latest revision as of 10:09, 1 January 2026
Description
- Description:
- Returns entity's weapons information including weapon index and firemode.
- Groups:
- Weapons
Syntax
- Syntax:
- unit weaponsInfo [weaponOrMuzzle, onlyLoaded]
- Parameters:
- unit: Object - person
- weaponOrMuzzle: String - name of the weapon or muzzle (returns whichever matches first) or "" to return all weapons
- onlyLoaded: Boolean - (Optional, default false) true to return loaded weapons only
- Return Value:
- Array of Arrays with [weaponIndex, isSelected, weaponName, muzzleName, firemode, magazineName, ammoCount, isPrimary] (or an empty []):
- weaponIndex: Number - internal weapon index (changes frequently) used with "SwitchWeapon" and "UseWeapon" actions
- isSelected: Boolean - true if this weapon is currently selected
- weaponName: String - weapon name
- muzzleName: String - muzzle name
- firemode: String - firemode that is set for this 'weaponIndex'
- magazineName: String - name of the loaded magazine or ""
- ammoCount: Number - magazine ammo count or -1
- isPrimary: Boolean - true if this muzzle is considered primary by the engine (Since Arma 3 2.14)
Examples
- Example 1:
- Find weapon with FullAuto firemode and switch to it:
Additional Information
- See also:
- weaponState weaponReloadingTime action
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note