Arma 3 Scripting

Command in Unit Inventory, Vehicle Inventory

weaponsItems

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

Description

Returns an array with subarrays contains class names and also names of connected items of all the vehicle's weapons.

Note

This command can return weapon magazine(s) if any are present. Or an empty array if weapon is stored without a magazine in it.

Syntax

Syntax 1

weaponsItems vehicle

Parameters:

Returns: Array of Arrays of weapon items, format [weapon, muzzle, flashlight, optics, [magazine, ammo], [magazine, ammo], bipod]:

Important

The weapons are listed in the order they were taken by the unit, with the most recent at the bottom of the array, e.g do not assume the first item is always the primary weapon.

Syntax 2

since arma3 2.14

weaponsItems [vehicle, extended]

Parameters:

Returns: Array of Arrays (see above) in format [weapon, muzzle, flashlight, optics, [magazine, ammo, muzzle, maxammo], [magazine, ammo, muzzle, maxammo], bipod]

Examples

Example 1

hint str weaponsItems player;
// returns e.g
/*
[
    ["arifle_MX_ACO_pointer_F", "muzzle_snds_H", "acc_pointer_IR", "optic_Aco", ["30Rnd_65x39_caseless_mag", 30], [], "bipod_01_F_blk"],
    ["launch_NLAW_F", "", "", "", ["NLAW_F", 1], [], ""],
    ["hgun_P07_F", "muzzle_snds_L", "", "", ["16Rnd_9x21_Mag", 11], [], ""]
]
// a loaded underbarrel grenade launcher can look like this:
[
    ["arifle_MX_GL_F", "muzzle_snds_H", "acc_pointer_IR", "optic_Aco", ["30Rnd_65x39_caseless_mag", 30], ["1Rnd_HE_Grenade_shell", 1], ""]
]
*/

Example 2

hint str weaponsItems vehicle player;
// returns e.g
/*
[
    ["gatling_30mm", "", "", "", ["250Rnd_30mm_HE_shells", 250], [], ""],
    ["missiles_SCALPEL", "", "", "", ["8Rnd_LG_scalpel", 8], [], ""],
    ["rockets_Skyfire", "", "", "", ["38Rnd_80mm_rockets", 38], [], ""]
]
*/

See also

weaponsItemsCargo · primaryWeaponItems · secondaryWeaponItems · handgunItems · addPrimaryWeaponItem · addSecondaryWeaponItem · addHandgunItem · primaryWeapon · secondaryWeapon · handgunWeapon · binocular · weaponAccessories · addWeaponWithAttachmentsCargoGlobal · BIS_fnc_weaponComponents · weaponState