Arma 3 Scripting

Command in Vehicle Inventory

addWeaponWithAttachmentsCargo

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

Description

Adds a weapon into the cargo space of a vehicle / box with given attachments / magazines. Ignores available cargo space. If the weapon class has any pre-attached items (LinkedItems), they are removed and new items, supplied via command arguments, are added.

Syntax

container addWeaponWithAttachmentsCargo [weaponConfiguration, weaponsCount]

Parameters:

Returns: Nothing

Examples

Example 1

cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_GL_F", "muzzle_snds_H", "", "optic_aco", ["30Rnd_65x39_caseless_mag", 15], ["3Rnd_HE_Grenade_shell", 2], ""], 2];

Example 2

Add five MX GL rifles, each with flashlight side attachment, a full 30 rounds magazine loaded into the gun and a full 3Rnd HE grenade magazine loaded into the grenade launcher:

cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_GL_F", "", "acc_flashlight", "", ["30Rnd_65x39_caseless_mag", 30], ["3Rnd_HE_Grenade_shell", 2], ""], 5];

Example 3

Add one MX rifle without any attachments or magazines event though the class has linked items:

cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_Holo_pointer_F", "", "", "", [], [], ""], 1];

Example 4

Add all weapons on player with attachments:

{ cursorObject addWeaponWithAttachmentsCargo [_x, 1] } forEach weaponsItems player;

See also

addWeaponWithAttachmentsCargoGlobal · weaponsItems · addWeaponCargo · addWeaponCargoGlobal · clearWeaponCargo · getWeaponCargo

Community notes

Andrew_S90

This command also allows you to add a weapon with attachments directly to the players backpack.

(backpackContainer player) addWeaponWithAttachmentsCargo [["arifle_MX_F","muzzle_snds_H","acc_pointer_IR","optic_Hamr",["30Rnd_65x39_caseless_mag",30],[],"bipod_03_F_blk"], 1];
DreadedEntity

This command will let you add millions of weapons across multiple vehicles, but be warned, weird things start happening in-game:

(vehicle player) addWeaponWithAttachmentsCargoGlobal [["arifle_MX_F","","","",[],[],""],1000000];

I don't recommend running the above too many times in the console