Arma 3 Scripting

Command in Weapons

weaponsInfo

Also available as Markdown and JSON, or read the original wiki page.

Description

Returns entity's weapons information including weapon index and firemode.

Syntax

unit weaponsInfo [weaponOrMuzzle, onlyLoaded]

Parameters:

Returns: Array of Arrays with [weaponIndex, isSelected, weaponName, muzzleName, firemode, magazineName, ammoCount, isPrimary] (or an empty []):

Examples

Example 1

Find weapon with FullAuto firemode and switch to it:

private _weapons = player weaponsInfo [currentMuzzle player, true];
private _found = _weapons findIf { _x select 4 == "FullAuto" };
if (_found > -1) then { action ["SwitchWeapon", player, player, _weapons select _found select 0] };

See also

weaponState · weaponReloadingTime · action