{"name":"addMagazine","operator":null,"title":"addMagazine","type":"command","url":"https://community.bistudio.com/wiki/addMagazine","revid":369393,"updated":"2024-09-03T18:43:18Z","groups":["Unit 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":null,"effect":null,"server_exec":false},"exec":null,"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 Local ArgumentGlobal Effect","since":null,"effect":null,"exec":null,"params":[{"name":"unitName","type":"Object","optional":false,"default":null,"description":"person to add the magazines to","types":["Object"],"since":null,"text":"unitName: Object - person to add the magazines to"},{"name":"magazineName","type":"String","optional":false,"default":null,"description":"magazine name. See the topic Category:Weapons for reference about possible values.","types":["String"],"since":null,"text":"magazineName: String - magazine 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":"unitName","types":["Object"]},"right":{"text":"magazineName Local ArgumentGlobal Effect","types":[]}},{"syntax":"unitName addMagazine [magazineName, ammoCount] Arma 2: Operation Arrowhead v1.62 Local ArgumentGlobal Effect Arma 3 v1.00 Global ArgumentGlobal Effect","since":"arma2oa 1.62","effect":null,"exec":null,"params":[{"name":"unitName","type":"Object","optional":false,"default":null,"description":"person to add the magazines to","types":["Object"],"since":null,"text":"unitName: Object - person to add the magazines to"},{"name":"magazineName","type":"String","optional":false,"default":null,"description":"magazine name. See the topic Category:Weapons for reference about possible values.","types":["String"],"since":null,"text":"magazineName: String - magazine name. See the topic Category:Weapons for reference about possible values."},{"name":"ammoCount","type":"Number","optional":false,"default":null,"description":"ammo quantity to be added to magazine. If it goes beyond maximum magazine capacity, the magazine will be given full and not overloaded.","types":["Number"],"since":null,"text":"ammoCount: Number - ammo quantity to be added to magazine. If it goes beyond maximum magazine capacity, the magazine will be given full and not overloaded."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"unitName","types":["Object"]},"right":{"text":"[magazineName, ammoCount] Arma 2: Operation Arrowhead v1.62 Local ArgumentGlobal Effect Arma 3 v1.00 Global ArgumentGlobal Effect","types":["Array"]}}],"examples":[{"text":"```sqf\nplayer addMagazine \"30Rnd_556x45_STANAG\";\n```","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"]}],"multiplayer":null,"problems":null,"aliases":[],"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)"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Unit Inventory","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}