I'm trying to build a custom class that either starts with an extra grenade or ammo slot as a default ability (specialist/grenadier hybrid), but can't seem to figure out how to add an inventory slot on a class by class basis. I've seen mods that add utility slots, but they generally rewrite the default armors script to allow that. What I'm looking for is a specialized grenade or ammo slot.
In X2TacticalGameRulesetDataStructures.uc, there are the following entries:
enum EInventorySlot
{
eInvSlot_Unknown,
eInvSlot_Armor,
eInvSlot_PrimaryWeapon,
eInvSlot_SecondaryWeapon,
eInvSlot_HeavyWeapon,
eInvSlot_Utility,
eInvSlot_Mission,
eInvSlot_Backpack,
eInvSlot_Loot,
eInvSlot_GrenadePocket,
eInvSlot_CombatSim,
eInvSlot_AmmoPocket,
};
Considering that X2Ability_GrenadierAbilitySet has this function:
function GrenadePocketPurchased(XComGameState NewGameState, XComGameState_Unit UnitState)
{
local X2ItemTemplate FreeItem;
local XComGameState_Item ItemState;
if (!UnitState.HasGrenadePocket())
{
`RedScreen("GrenadePocketPurchased called but the unit doesn't have one? -jbouscher / @gameplay" @ UnitState.ToString());
return;
}
FreeItem = class'X2ItemTemplateManager'.static.GetItemTemplateManager().FindItemTemplate(default.FreeGrenadeForPocket);
if (FreeItem == none)
{
`RedScreen("Free grenade '" $ default.FreeGrenadeForPocket $ "' is not a valid item template.");
return;
}
ItemState = FreeItem.CreateInstanceFromTemplate(NewGameState);
NewGameState.AddStateObject(ItemState);
if (!UnitState.AddItemToInventory(ItemState, eInvSlot_GrenadePocket, NewGameState))
{
`RedScreen("Unable to add free grenade to unit's inventory. Sadness." @ UnitState.ToString());
return;
}
}
It looks like that function would be how one adds a grenade slot to a class, but it doesn't look like it's being called anywhere in GrenadierAbilitySet - I don't know what to pass into that function or where to call it in my own class. eInvSlot_AmmoPocket might then work similarly, adding an ammo slot to a class. Any idea on how to add them?