Item loadouts - XCOM:EU 2012

From Nexus Mods Wiki
Jump to: navigation, search


[The following is derived from the Nexus XCOM Mod Talk forum threads Loadout questions and R&D Inventory, Items & Weapons Overhaul, primarily from the Long War mod primary programmer Amineri.]

The enumeration of ELocation defines the various Loadout Locations used as attachment points for objects is defined within the mesh object. (Gildor's uModel tool can view various 3D models via an option for displaying attachment points: so pretty sure its set there and not within Unrealscript.) Understanding this is helpful when trying to work out different Loadout arrays in DefaultLoadouts.ini - XCOM:EU 2012.

The general data structure for what I call "primitive inventory" is the TInventory structure. It contains space for:

  • 1 Armor item
  • 1 Pistol item
  • 16 Large Items
  • 16 Small Items
  • 16 Custom Items

These are static arrays, not dynamic. I think these were sized back when the game was a more direct translation of the original, when there was more inventory in general. All units share this inventory structure, both XCOM soldiers and tanks, as well as all varieties of aliens and even civilians.

Until EW, the most large items I saw on any unit was 2. Heavies carry 2 large items (LMG + Rocket Launcher) and Sectopods carry 2 large items (SectopodChestCannon + SectopodCannon). SectopodClusterBomb is classified as a small item.

However, for EW MECs all of the new weapon systems are large items. This means that a fully-equipped Paladin MEC suit (and a rifle) ends up equipped with 4 large items. This is handled behind the scenes and not in the Locker loadout screen.

The saveable XGLoadoutInstances (in XComGame.upk), which records which items are attached to which attachment points for XGInventory, only allows up to 5 backpack items max. The actual Loadout code itself allows for 3 non-backpack small items, which are attached to: eSlot_LeftThigh, eSlot_LeftChest, and then eSlot_LeftBelt. Any additional non-backpack small items aren't loaded out, resulting in no tactical-game functionality. Also, only the eSlot_LeftThigh draws the weapon mesh attached to the soldier pawn.

So even though the TInventory allows for up to 16 large and 16 small items, the Loadout code only allows for 3 non-backpack and 5 backpack small items.

Programs and Tools


In the XGStrategy.BuildTransferSoldier function are the lines :

       class'XGGameData'.static.GetMecArmorAndWeapons(byte(m_kChar.kInventory.iArmor), eBaseArmor, ePrimaryWeapon, eSecondaryWeapon, eTertiaryWeapon);
       kTransfer.kChar.kInventory.iArmor = eBaseArmor;
       if(ePrimaryWeapon != 0)
           class'XGTacticalGameCoreNativeBase'.static.TInventoryLargeItemsAddItem(kTransfer.kChar.kInventory, ePrimaryWeapon);
       if(eSecondaryWeapon != 0)
           class'XGTacticalGameCoreNativeBase'.static.TInventoryLargeItemsAddItem(kTransfer.kChar.kInventory, eSecondaryWeapon);
       if(eTertiaryWeapon != 0)
           class'XGTacticalGameCoreNativeBase'.static.TInventoryLargeItemsAddItem(kTransfer.kChar.kInventory, eTertiaryWeapon);

This translates from the 17 "weapon-specific MEC armor variants" into the specific 6 weapon systems that go into the particular large item slots.

As for the aliens, generally their mesh models are pretty limited in terms of sockets, so they can't have different weapons plugged in very easily. (In contrast with XCOM soldier unit pawns, which are quite flexible in this regard). The only aliens I know of that allow for 2 different weapons to be plugged into their weapon socket is the basic Muton. Even the XCOM SHIV has only 1 weapon socket, and that only accepts the 3 basic SHIV weapon models. I've experimented with giving SHIVs other weapons (like LMGs), and they almost work. They fit and the firing animations work, but the movement animation breaks and the game hangs if a SHIV + LMG tries to move.

I haven't experimented as much yet with trying to swap alien weapons, and what experimenting I've done hasn't been successful.

If you look at the loose Weapon_*_SF.upk files in the CookedPCConsole folder, you'll see that there are actually variant models of various weapons tuned to particular aliens. So:

  • Weapon_PlasmaRifleLight_SF.upk
  • Weapon_PlasmaRifle_ThinMan_SF.upk
  • Weapon_PlasmaRfLtOutsider_SF.upk
  • Weapon_PlasmaRifleLt_Muton_SF.upk

I think the Firaxis 3D modelers/animators "tuned" each of the weapon models to look/work with each particular alien type.

For aliens the mapping from TInventory to XGInventoryItem (XGInventory manages the items as attached to the unit pawns) happens in XGLoadoutMgr.ConvertTInventoryToAlienLoadout.

It appears that :

  • Loadout.Items[11] = class<XGWeapon>(class'XGItemLibrary'.static.GetItem(kInventory.iPistol));
  • Loadout.Items[3] = class<XGWeapon>(class'XGItemLibrary'.static.GetItem(kInventory.arrLargeItems[0]));
  • Loadout.Items[4] = class<XGWeapon>(class'XGItemLibrary'.static.GetItem(kInventory.arrLargeItems[1]));
  • Loadout.Items[7] = class<XGWeapon>(class'XGItemLibrary'.static.GetItem(kInventory.arrSmallItems[0]));

No small items above the 1st small item can be mapped.

Similarly for soldiers only the first 3 non-Backpack small items get mapped into a Loadout index. This can be an issue if using a mod that grants a large number of small items slots and equipping the soldier with many grenades or other non-backpack small items.

enum ELocation

enum ELocation

The default loadout positions for XCOM soldier large weapons is actually in the RightBack and LeftBack slots. Only the equip action makes a soldier move the weapon from the back to their RightHand. However aliens by default load their large weapons into the RightHand slot (so you don't see aliens swap their weapons to their backs when performing another action like soldiers do when using a Medikit, for example).


Referred to by this article:

That refer to this article: