{"name":"addWeapon","operator":null,"title":"addWeapon","type":"command","url":"https://community.bistudio.com/wiki/addWeapon","revid":373145,"updated":"2025-04-04T06:14:28Z","groups":["Unit Inventory","Vehicle Inventory"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"description":"Add a weapon to a unit. For a global version of this command see addWeaponGlobal.\n\nInfantry units can only carry a specific number of weapons, once the weapon slots are filled, any further addWeapon commands are ignored.\n\n> [!NOTE]\n> a **magazine** must be added first for the added weapon to be loaded.\n\n> [!WARNING]\n> In Arma 3 this command can also link items to the inventory slots, the functionality is identical to linkItem command, which it global and thus differ in how it should be used.","syntaxes":[{"syntax":"object addWeapon weapon","since":null,"effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":"unit or vehicle to add the weapon to","types":["Object"],"since":null,"text":"object: Object - unit or vehicle to add the weapon to"},{"name":"weapon","type":"String","optional":false,"default":null,"description":"weapon class name. See the topic Category:Weapons for reference about possible values.","types":["String"],"since":null,"text":"weapon: String - weapon class name. See the topic Category:Weapons for reference about possible values."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"object","types":["Object"]},"right":{"text":"weapon","types":["String"]}},{"syntax":"object addWeapon [weapon, autoselect]","since":"arma3 2.20","effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":"unit or vehicle to add the weapon to","types":["Object"],"since":null,"text":"object: Object - unit or vehicle to add the weapon to"},{"name":"weapon","type":"String","optional":false,"default":null,"description":"weapon class name. See the topic Category:Weapons for reference about possible values.","types":["String"],"since":null,"text":"weapon: String - weapon class name. See the topic Category:Weapons for reference about possible values."},{"name":"autoselect","type":"String","optional":true,"default":"true","description":"false to abort weapon autoselection if no weapon was selected.","types":["String"],"since":null,"text":"autoselect: String - (Optional, default true) false to abort weapon autoselection if no weapon was selected."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"object","types":["Object"]},"right":{"text":"[weapon, autoselect]","types":["Array"]}}],"examples":[{"text":"```sqf\nplayer addMagazine \"30Rnd_556x45_Stanag\";\nplayer addWeapon \"BAF_L85A2_RIS_SUSAT\";\n```","code":["player addMagazine \"30Rnd_556x45_Stanag\";\nplayer addWeapon \"BAF_L85A2_RIS_SUSAT\";"]},{"text":"```sqf\nAn_2 addMagazine \"100Rnd_762x51_M240\";\nAn_2 addWeapon \"M240_veh\";\n```","code":["An_2 addMagazine \"100Rnd_762x51_M240\";\nAn_2 addWeapon \"M240_veh\";"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["addWeaponGlobal","addWeaponTurret","removeWeapon","removeAllWeapons","addMagazine"],"notes":[],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Unit Inventory","Command Group: Vehicle Inventory","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}