RJ Wattenhofer

Tech writing, 3D model building and game design.

October 03, 2024

ArmA 2 | Loadout Codes for Units

Weapons, ammo, grenades and other items for player gear loadouts
in ArmA 2 and Operation Arrowhead

arma 2 operation arrowhead logo

A loadout is a predefined set of items to be carried into battle that will help a player achieve a specific goal. For example, an ArmA 2 US Army rifleman's standard loadout consists of an Mk16 Holo, eight magazines of ammo, four frag grenades and a pair of nightvision goggles. This article contains all the code you need to customize your own loadouts.

Keep in mind that there is a maximum capacity of twenty items. If you surpass that number everything will still show up in the editor but you will find part of your gear missing in multiplayer.

Place this code in the 'Initialization' field of each unit:

removeAllWeapons this;
this addMagazine ["20Rnd_556x45_Stanag", 20];
this addMagazine "HandGrenade_East";
this addWeapon "m16a4";

This removes all the previous weapons, adds one M16A4, one twenty round magazine and one Eastern style hand grenade. Make sure to add weapons to the tail-end of the loadout and enter magazines first to ensure that the weapon is loaded and ready for use.

removeAllWeapons this;
{this addMagazine "30Rnd_556x45_Stanag"} forEach [1,2,3,4];
{this addMagazine "17Rnd_9x19_glock17"} forEach [1,2];
{this addMagazine "HandGrenade_West"} forEach [1,2];
{this addMagazine "SmokeShellPurple"} forEach [1];
this addWeapon "Binocular";
this addWeapon "NVGoggles";
this addWeapon "ItemGPS";
this addWeapon "m16a4";
this addWeapon "glock17_EP1";

This adds an M16A4 with four magazines, a Glock17 pistol with two magazines, two hand grenades, a purple smokeshell, binoculars, nightvision goggles and a GPS.


Creating a loadout.sqf file

Instead of copying & pasting the same loadout into every single unit, you can create a single loadout instance via a loadout.sqf file. Here is the sample code, which you can modify to your liking:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "30Rnd_556x45_Stanag";
_unit addMagazine "17Rnd_9x19_glock17";
_unit addMagazine "HandGrenade_West";
_unit addMagazine "SmokeShellPurple";
_unit addWeapon "m16a4";
_unit addWeapon "glock17_EP1";
_unit addWeapon "NVGoggles";
_unit addWeapon "Binocular";
_unit addWeapon "ItemGPS";

Copy the above code into a text editor such as MS Notepad and save it as loadout.sqf. Place this file into your mission folder. Launch ArmA 2 and go to your mission in the Editor. Place the following code in the 'Initialization' field of each unit:

null = [this] execVM "loadout.sqf";
this addeventhandler ["respawn","_this execVM 'loadout.sqf'"];

This will both enable the loadout upon spawning and reload the loadout when players respawn.

Caveat One: When using the loadout.sqf file the primary weapon will not be loaded when entering the game, regardless if you entered the magazines before the weapons on the file. The player will need to switch weapons and then switch back at which time it will be loaded.

Caveat Two: I have not found a method to add multiple magazines to the same line of code that properly worked (EX: _unit addMagazines ["17Rnd_9x19_glock17", 5];) when using the loadout.sqf file. You will need to add a new line of code for each magazine, such as:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "30Rnd_556x45_Stanag";
_unit addMagazine "30Rnd_556x45_Stanag";
_unit addMagazine "30Rnd_556x45_Stanag";
_unit addMagazine "30Rnd_556x45_Stanag";
_unit addMagazine "30Rnd_556x45_Stanag";

_unit addMagazine "17Rnd_9x19_glock17";
_unit addMagazine "17Rnd_9x19_glock17";
_unit addMagazine "17Rnd_9x19_glock17";
_unit addMagazine "17Rnd_9x19_glock17";
_unit addMagazine "17Rnd_9x19_glock17";

You can get all the weapon codes from the links below:

ArmA 2:OA and DLC Weapons
ArmA 2: Weapons


Our Favorites

Bizon PP-19 SD Rifle (Silenced)

removeAllWeapons this;
{this addMagazine "64Rnd_9x19_SD_Bizon"} forEach [1,2,3,4];
this addWeapon "Bizon_Silenced";

OR THIS:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "64Rnd_9x19_SD_Bizon";
_unit addWeapon "Bizon_Silenced";

arma 2 bizon pp-19 sd rifle

M1014 Shotgun

removeAllWeapons this;
{this addMagazine "8Rnd_B_Beneli_Pellets"} forEach [1,2,3,4];
this addWeapon "M1014";

OR THIS:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "8Rnd_B_Beneli_Pellets";
_unit addWeapon "M1014";

arma 2 m1014 shotgun

AK-74 Rifle

removeAllWeapons this;
{this addMagazine "30Rnd_545x39_AKSD"} forEach [1,2,3,4];
this addWeapon "AK_74";

OR THIS:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "30Rnd_545x39_AKSD";
_unit addWeapon "AK_74";

arma 2 ak47 rifle

M16A4 Rifle

removeAllWeapons this;
{this addMagazine "30Rnd_556x45_Stanag"} forEach [1,2,3,4];
this addWeapon "m16a4";

OR THIS:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "30Rnd_556x45_Stanag";
_unit addWeapon "m16a4";

arma 2 m16a4 rifle

Glock17 Semi-Automatic Pistol

removeAllWeapons this;
{this addMagazine "17Rnd_9x19_glock17"} forEach [1,2,3,4];
this addWeapon "glock17_EP1";

OR THIS:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "17Rnd_9x19_glock17";
_unit addWeapon "glock17_EP1";

arma 2 glock17 pistol

DMR Sniper Rifle

removeAllWeapons this;
{this addMagazine "20Rnd_762x51_DMR"} forEach [1,2,3,4];
this addWeapon "DMR";

OR THIS:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "20Rnd_762x51_DMR";
_unit addWeapon "DMR";

arma 2 dmr sniper rifle

M249 Machine Gun

removeAllWeapons this;
{this addMagazine "200Rnd_556x45_M249"} forEach [1,2,3,4];
this addWeapon "M249";

OR THIS:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "200Rnd_556x45_M249";
_unit addWeapon "M249";

arma 2 m249 machine gun

M16A4 ACG GL Rifle w/ Grenade Launcher

removeAllWeapons this;
{this addMagazine "100Rnd_556x45_BetaCMag"} forEach [1,2,3,4];
{this addMagazine "1Rnd_HE_M203"} forEach [1,2,3,4];
this addWeapon "M16A4_ACG_GL";

OR THIS:

_unit = _this select 0;
removeAllWeapons _unit;

_unit addMagazine "100Rnd_556x45_BetaCMag";
_unit addMagazine "1Rnd_HE_M203";
_unit addWeapon "M16A4_ACG_GL";

arma 2 m16a4 acg gl rifle

written by

  • xing social button
  • linkedin social button
  • buffer social button
  • reddit social button
  • stumbleupon social button
  • facebook social button
  • google plus button
  • twitter social button
  • renren social button Renren
  • vkontakte social button Share in VK