Utility Items and Backpack Size

For technical discussions and help
Post Reply
FractalFrost
Posts: 4
Joined: Sun Feb 07, 2016 5:14 am

Utility Items and Backpack Size

Post by FractalFrost »

In the CharacterStats.ini what do eStat_BackpackSize and eStat_UtilityItems do exactly? I have been attempting to increase the amount of utility items one can equip on a soldier, but it does not seem to impact anything when I change either of those for the soldier template. Is there somewhere else I have to make changes to increase the amount of utility items a soldier can bring with them on a mission.
Amineri

Re: Utility Items and Backpack Size

Post by Amineri »

FractalFrost wrote:In the CharacterStats.ini what do eStat_BackpackSize and eStat_UtilityItems do exactly? I have been attempting to increase the amount of utility items one can equip on a soldier, but it does not seem to impact anything when I change either of those for the soldier template. Is there somewhere else I have to make changes to increase the amount of utility items a soldier can bring with them on a mission.
I'm pretty sure the template gets instanced into an XComGameState_Unit when the soldier is created, so changing the template configuration won't have any impact on existing soldiers. New recruits, or starting with a new campaign should work, though.
FractalFrost
Posts: 4
Joined: Sun Feb 07, 2016 5:14 am

Re: Utility Items and Backpack Size

Post by FractalFrost »

Amineri wrote:
FractalFrost wrote:In the CharacterStats.ini what do eStat_BackpackSize and eStat_UtilityItems do exactly? I have been attempting to increase the amount of utility items one can equip on a soldier, but it does not seem to impact anything when I change either of those for the soldier template. Is there somewhere else I have to make changes to increase the amount of utility items a soldier can bring with them on a mission.
I'm pretty sure the template gets instanced into an XComGameState_Unit when the soldier is created, so changing the template configuration won't have any impact on existing soldiers. New recruits, or starting with a new campaign should work, though.
I did start a new campaign, the amount of utility item slots did not change. I think it might be tied to armor like in the first game, the question is, where exactly.
Amineri

Re: Utility Items and Backpack Size

Post by Amineri »

Yes, I'm not quite sure where that is lurking. Much like EU/EW, there's just so much code that it takes quite a while to get comfortable with even a portion of it.

With EU and EW, I was still finding new things a couple of years after release, and I don't expect that to change here :)
FractalFrost
Posts: 4
Joined: Sun Feb 07, 2016 5:14 am

Re: Utility Items and Backpack Size

Post by FractalFrost »

Amineri wrote:Yes, I'm not quite sure where that is lurking. Much like EU/EW, there's just so much code that it takes quite a while to get comfortable with even a portion of it.

With EU and EW, I was still finding new things a couple of years after release, and I don't expect that to change here :)
All right, thanks. I am sure either myself or someone else will find it eventually.
kyuu
Posts: 1
Joined: Sat Feb 13, 2016 11:31 pm

Re: Utility Items and Backpack Size

Post by kyuu »

FractalFrost wrote:
Amineri wrote:Yes, I'm not quite sure where that is lurking. Much like EU/EW, there's just so much code that it takes quite a while to get comfortable with even a portion of it.

With EU and EW, I was still finding new things a couple of years after release, and I don't expect that to change here :)
All right, thanks. I am sure either myself or someone else will find it eventually.
I've been trying to do a similar thing (move all secondary weapon abilities to the weapons themselves and let rookies equip any weapon type) and this is all the info I've been able to compile:
  • There's an extra slot in every character's definition called eSlot_AmmoPocket that's setup to only accept Ammo items. Unfortunately, the function that determines whether you have the slot or not always returns false and is in XComGameState_Unit so can't be overridden...
  • AddItemToInventory in XComGameState_Unit actually sets eStat_UtilityItems to 2.0f (base and max) if the armor you have equipped is medium armor (or rather has bAddsUtilitySlot set to true in its template). Similarly, RemoveItemFromInventory sets eStat_UtilityItems to 1.0f if you are removing medium armor. Pretty sure this means the ini setting does jack all.
  • You can easily make new slots appear in the locker via overriding UIArmory_Loadout's UpdateEquippedList method. The method actually is setup to allow any number of Utility Items, but it (obviously) is restricted to 1 or 2 slots thanks to the above hard coded values. If you manually increment the appropriate variable, the new slots will display and function as far as the UI is concerned. The new UI slot knows whether you already have a grenade/medkit/etc equipped. You can even have the Secondary Weapon slot display for Rookies or change when the Grenade and Ammo pockets are displayed. The Ammo Pocket even filters out any non-ammo items with no other changes needed.
  • Unfortunately... nothing will actually get equipped in the new slots. When equipping an item, it calls CanAddItemToInventory in XComGameState_Unit. This function's checks will block the item from actually being added to the Soldier's inventory. It checks the size of all currently equipped Utility Items against eStat_UtilityItems, will call HasAmmoPocket() (again, always returns false), etc and the function will return false and the item never actually equipped. Even with the appropriate ini changes to Rookie's class data, no secondary weapon will actually be equipped.
So... yeah. The actual mechanics being the number of Utility slots is locked (and hardcoded at that!) in a GameState class that can't (easily) be overridden. Ah well, guess my Rookies will have to stick with not having a sidearm for now... :(
FractalFrost
Posts: 4
Joined: Sun Feb 07, 2016 5:14 am

Re: Utility Items and Backpack Size

Post by FractalFrost »

I ended up doing more digging myself on the matter after that last post and found pretty much the same Kyuu in terms of how the game handles utility slots. Seems a little odd for Firaxis to do it like that, I am sure they had their reasons though. It will probably only be a matter of time before someone manages to get this sorted out.
Witt
Posts: 1
Joined: Sat Mar 25, 2017 11:10 pm

Re: Utility Items and Backpack Size

Post by Witt »

Also trying to figure this out. Did anyone try adjusting the XComGameData_CharacterStats.ini numbers in the LW2 mod? I changed the UtilityItems slots from 3 to 5, but don't see an effect.

Also changed backpack size in DefaultGameData_CharacterStats.ini (in original XCOM configs), etc.

I don't know how to set the UIArmory_Loadout's UpdateEquippedList mentioned by Kyuu, though. So is it possible that I've actually changed the number of slots, but that I can't see them in the UI?

VERY rookie modder,
Witt
Post Reply