addWeaponItem

From Bohemia Interactive Community
Jump to navigation Jump to search
Hover & click on the images for description

Description

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.
Groups:
Unit Inventory

Syntax

Syntax:
unit addWeaponItem [weaponName, itemName, instant]
Parameters:
unit: Object
weaponName: String - name of the weapon to add magazine to
itemName: String - class name of the item to add (if magazine, muzzle will be autodetected)
since Arma 3 logo black.png1.96
instant: Boolean - (Optional, default false) true to skip animation
Return Value:
Nothing

Alternative Syntax

Syntax:
unit addWeaponItem [weaponName, [itemName, ammoCount, muzzleName], instant]
Parameters:
unit: Object
weaponName: String - name of the weapon to add magazine to
itemName: String - class name of the item to add (if magazine, muzzle will be autodetected unless specified)
ammoCount: Number - (Optional) optional amount of ammo in magazine
muzzleName: String - (Optional) optional target muzzle to add magazine to
since Arma 3 logo black.png1.96
instant: Boolean - (Optional, default false) true to skip animation
Return Value:
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"];

Additional Information

See also:
addPrimaryWeaponItem addSecondaryWeaponItem addHandgunItem addBinocularItem weaponsItems handgunItems primaryWeaponItems secondaryWeaponItems binocularItems removePrimaryWeaponItem removeSecondaryWeaponItem removeHandgunItem removeBinocularItem

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note