{"name":"addMagazine","title":"addMagazine","type":"command","url":"https://community.bistudio.com/wiki/addMagazine","revid":369393,"updated":"2024-09-03T18:43:18Z","groups":["Unit Inventory"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","description":"Adds a magazine to a person. Infantry units can only carry a specific number of magazines, once the magazine slots are filled (or uniform/vest/bagpack are full in Arma 3), any further addMagazine commands are ignored.\nIf class of magazine does not exist, an error message is printed in .rpt:\n\n```sqf\nplayer addMagazine \"dasdsa\"; // .rpt: Given magazine[dasdsa] not found\n```\n\n> [!NOTE]\n> Use addMagazine *before* addWeapon for the weapon to be loaded with the magazine automatically.","syntaxes":[{"syntax":"unitName addMagazine magazineName","note":"Local argument Global effect","params":[{"name":"unitName","type":"Object","description":"person to add the magazines to","type_expr":"Object"},{"name":"magazineName","type":"String","description":"magazine name. See the topic Category:Weapons for reference about possible values.","type_expr":"String"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"unitName"},"right":{"text":"magazineName"}},{"syntax":"unitName addMagazine [magazineName, ammoCount]","note":"Arma 2: Operation Arrowhead v1.62 Local argument Global effect\nArma 3 v1.00 Global argument Global effect","since":"arma2oa 1.62","params":[{"name":"unitName","type":"Object","description":"person to add the magazines to","type_expr":"Object"},{"name":"magazineName","type":"String","description":"magazine name. See the topic Category:Weapons for reference about possible values.","type_expr":"String"},{"name":"ammoCount","type":"Number","description":"ammo quantity to be added to magazine. If it goes beyond maximum magazine capacity, the magazine will be given full and not overloaded.","type_expr":"Number"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"unitName"},"right":{"text":"[magazineName, ammoCount]"}}],"examples":[{"code":["player addMagazine \"30Rnd_556x45_STANAG\";"]},{"text":"```sqf\nplayer addMagazine [\"30Rnd_556x45_STANAG\", 15];            // since Arma 2:OA 1.62\n```","code":["player addMagazine [\"30Rnd_556x45_STANAG\", 15];\t\t\t// since Arma 2:OA 1.62"]},{"text":"```sqf\nnonLocalUnit addMagazine [\"30Rnd_556x45_STANAG\", 15];    // global argument since Arma 3\n```","code":["nonLocalUnit addMagazine [\"30Rnd_556x45_STANAG\", 15];\t// global argument since Arma 3"]},{"text":"```sqf\nplayer addMagazine [\"30Rnd_556x45_STANAG\", 9999];        // will give a 30 rounds magazine anyway\n```","code":["player addMagazine [\"30Rnd_556x45_STANAG\", 9999];\t\t// will give a 30 rounds magazine anyway"]}],"see_also":["addMagazineGlobal","addMagazines","addMagazineCargo","addMagazineCargoGlobal","addMagazinePool","addMagazineTurret","removeMagazine","removeMagazines","addWeapon","loadMagazine"],"notes":[{"user":"Hoz","date":"2006-08-02T06:59:00Z","text":"If the unit has magazines already, you may need to use the commands removeMagazine or removeMagazines to make space for the mags you want to add."},{"user":"PhilippRauch","date":"2010-02-21T20:13:00Z","text":"In turreted vehicles the magazine is added to the first turret with >> primaryGunner = 1; << set in the Vehicles turret config part (and the magazine is ONLY added to the very first turret if more than one is configged with >> primaryGunner = 1; << )."},{"user":"Inkompetent","date":"2010-05-12T20:09:00Z","text":"When wanting to add many magazines to an object's init-line it can be easier to use loops than to just repeat the addMagazine command.\n\nIf you want to add N magazines to an object either of the two below ways are handy, the first for fewer magazines, and the latter when you want to add many since it then is the easiest of the two to read.\n\n```sqf\n{ this addMagazine \"magazineClassName\" } forEach [1,2,3, /*..., */ N];\nfor \"_i\" from 1 to N do { this addMagazine \"magazineClassName\" };\n```"},{"user":"Pisces_72","date":"2017-11-28T13:10:00Z","text":"If adding a magazine to an empty artillery support with this command in Arma 3, use reload. If you do not reload, Artillery calls will not fire rounds, because the AI won't reload automatically (tested with 82mm mortar)"}]}