{"name":"weaponsItems","operator":null,"title":"weaponsItems","type":"command","url":"https://community.bistudio.com/wiki/weaponsItems","revid":369242,"updated":"2024-09-03T10:35:40Z","groups":["Unit Inventory","Vehicle Inventory"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"0.76"}],"since":{"game":"arma3","name":"Arma 3","version":"0.76"},"arma3_since":"0.76","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns an array with subarrays contains class names and also names of connected items of all the vehicle's weapons.\n\n> [!NOTE]\n> This command can return weapon magazine(s) if any are present. Or an empty array if weapon is stored without a magazine in it.\n\n- Arma 3 v1.22 it is possible to query weapon holders and ammo crates with this command.\nIf the argument is a vehicle, the command will return vehicle's weapons.\nIf the argument is a container, the command will act identical to weaponsItemsCargo.\n- Arma 3 v1.96 the returned array always contains secondary muzzle magazine info and consistent with getUnitLoadout format for weapon items.\n- Arma 3 v2.02 the returned array can contains binocular weapon items.","syntaxes":[{"syntax":"weaponsItems vehicle","since":null,"effect":null,"exec":null,"params":[{"name":"vehicle","type":"Object","optional":false,"default":null,"description":"unit or vehicle","types":["Object"],"since":null,"text":"vehicle: Object - unit or vehicle"}],"returns":{"type":"Array of Arrays of weapon items, format [weapon, muzzle, flashlight, optics, [magazine, ammo], [magazine, ammo], bipod]:","types":["Array"],"description":"weapon: String - muzzle: String - flashlight: String - optics: String - [primaryMagazine, primaryAmmo]: Array - could be empty - [secondaryMagazine, secondaryAmmo]: Array - could be empty - bipod: String > [!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.","text":"Array of Arrays of weapon items, format [weapon, muzzle, flashlight, optics, [magazine, ammo], [magazine, ammo], bipod]:\n- weapon: String\n- muzzle: String\n- flashlight: String\n- optics: String\n- [primaryMagazine, primaryAmmo]: Array - could be empty\n- [secondaryMagazine, secondaryAmmo]: Array - could be empty\n- bipod: String\n\n> [!IMPORTANT]\n> 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."},"form":"unary","operator":null,"left":null,"right":{"text":"vehicle","types":["Object"]}},{"syntax":"weaponsItems [vehicle, extended]","since":"arma3 2.14","effect":null,"exec":null,"params":[{"name":"vehicle","type":"Object","optional":false,"default":null,"description":"unit or vehicle","types":["Object"],"since":null,"text":"vehicle: Object - unit or vehicle"},{"name":"extended","type":"Boolean","optional":false,"default":null,"description":"true to include muzzle information","types":["Boolean"],"since":null,"text":"extended: Boolean - true to include muzzle information"}],"returns":{"type":null,"types":["Array"],"description":null,"text":"Array of Arrays (see above) in format [weapon, muzzle, flashlight, optics, [magazine, ammo, muzzle, maxammo], [magazine, ammo, muzzle, maxammo], bipod]"},"form":"unary","operator":null,"left":null,"right":{"text":"[vehicle, extended]","types":["Array"]}}],"examples":[{"text":"```sqf\nhint str weaponsItems player;\n// returns e.g\n/*\n[\n    [\"arifle_MX_ACO_pointer_F\", \"muzzle_snds_H\", \"acc_pointer_IR\", \"optic_Aco\", [\"30Rnd_65x39_caseless_mag\", 30], [], \"bipod_01_F_blk\"],\n    [\"launch_NLAW_F\", \"\", \"\", \"\", [\"NLAW_F\", 1], [], \"\"],\n    [\"hgun_P07_F\", \"muzzle_snds_L\", \"\", \"\", [\"16Rnd_9x21_Mag\", 11], [], \"\"]\n]\n// a loaded underbarrel grenade launcher can look like this:\n[\n    [\"arifle_MX_GL_F\", \"muzzle_snds_H\", \"acc_pointer_IR\", \"optic_Aco\", [\"30Rnd_65x39_caseless_mag\", 30], [\"1Rnd_HE_Grenade_shell\", 1], \"\"]\n]\n*/\n```","code":["hint str weaponsItems player;\n// returns e.g\n/*\n[\n\t[\"arifle_MX_ACO_pointer_F\", \"muzzle_snds_H\", \"acc_pointer_IR\", \"optic_Aco\", [\"30Rnd_65x39_caseless_mag\", 30], [], \"bipod_01_F_blk\"],\n\t[\"launch_NLAW_F\", \"\", \"\", \"\", [\"NLAW_F\", 1], [], \"\"],\n\t[\"hgun_P07_F\", \"muzzle_snds_L\", \"\", \"\", [\"16Rnd_9x21_Mag\", 11], [], \"\"]\n]\n// a loaded underbarrel grenade launcher can look like this:\n[\n\t[\"arifle_MX_GL_F\", \"muzzle_snds_H\", \"acc_pointer_IR\", \"optic_Aco\", [\"30Rnd_65x39_caseless_mag\", 30], [\"1Rnd_HE_Grenade_shell\", 1], \"\"]\n]\n*/"]},{"text":"```sqf\nhint str weaponsItems vehicle player;\n// returns e.g\n/*\n[\n    [\"gatling_30mm\", \"\", \"\", \"\", [\"250Rnd_30mm_HE_shells\", 250], [], \"\"],\n    [\"missiles_SCALPEL\", \"\", \"\", \"\", [\"8Rnd_LG_scalpel\", 8], [], \"\"],\n    [\"rockets_Skyfire\", \"\", \"\", \"\", [\"38Rnd_80mm_rockets\", 38], [], \"\"]\n]\n*/\n```","code":["hint str weaponsItems vehicle player;\n// returns e.g\n/*\n[\n\t[\"gatling_30mm\", \"\", \"\", \"\", [\"250Rnd_30mm_HE_shells\", 250], [], \"\"],\n\t[\"missiles_SCALPEL\", \"\", \"\", \"\", [\"8Rnd_LG_scalpel\", 8], [], \"\"],\n\t[\"rockets_Skyfire\", \"\", \"\", \"\", [\"38Rnd_80mm_rockets\", 38], [], \"\"]\n]\n*/"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["weaponsItemsCargo","primaryWeaponItems","secondaryWeaponItems","handgunItems","addPrimaryWeaponItem","addSecondaryWeaponItem","addHandgunItem","primaryWeapon","secondaryWeapon","handgunWeapon","binocular","weaponAccessories","addWeaponWithAttachmentsCargoGlobal","BIS_fnc_weaponComponents","weaponState"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Unit Inventory","Command Group: Vehicle Inventory","Introduced with Arma 3 version 0.76","Scripting Commands"]}