Arma 3 Scripting

Command in Unit Inventory

addWeaponItem

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

Description

Adds a weapon item to the specified weapon. The item can be weapon magazine, in which case the amount of ammo and target muzzle could also be specified. Since Arma 3 2.22 it is possible to add a magazine directly into a 'Throw' muzzle provided it is configured with keepInInventory = 0;. To remove such magazine see removeWeaponItem.

Syntax

Syntax 1

unit addWeaponItem [weaponName, itemName, instant]

Parameters:

Returns: Nothing

Syntax 2

unit addWeaponItem [weaponName, [itemName, ammoCount, muzzleName], instant]

Parameters:

Returns: Nothing

Examples

Example 1

player addWeaponItem ["arifle_MX_GL_ACO_F", "1Rnd_HE_Grenade_shell"];

Example 2

player addWeaponItem ["arifle_MX_GL_ACO_F", ["1Rnd_HE_Grenade_shell", 1, "GL_3GL_F"]];

Example 3

player addWeaponItem ["LaserDesignator", "LaserBatteries"];

See also

removeWeaponItem · addPrimaryWeaponItem · addSecondaryWeaponItem · addHandgunItem · addBinocularItem · weaponsItems · handgunItems · primaryWeaponItems · secondaryWeaponItems · binocularItems · removePrimaryWeaponItem · removeSecondaryWeaponItem · removeHandgunItem · removeBinocularItem