Jump to content

Enemy Within: Items slots modding.


jkjkhardcore

Recommended Posts

To manual install a ToolBoks custom mod (like the grid view for EW) you need to do a few things.

 

 

You need a way to decompress the UPK files (ToolBoks has one but will not do it for you ATM but I'll tell you haw to use it)

A hex editor (I use HxD for most stuff)

a text editor (you may be able to get away with windows notepad for some but I use Notepad++)

BACKUPS if somthing goes wrong

resourcehack is optional but if it's working for you use it (I tend to do the hex edit on the exe to load DGC.ini so I don't need yo use resourcehack)

 

Before you do anything with the EW files back them up.

 

Installing

 

Open the custom mod you want to install in a text editor (in this case "Item Grid EW.txt")

Look for any lines that start "UPK_FILE=" (in this case that's just UICollection_Strategy_SF.upk) backup those files and copy them from "\XCom-Enemy-Unknown\XEW\XComGame\CookedPCConsole" to wherever you have ToolBoks.

Decompress the copied upu files using decompress.exe (you should be able to just drag them to the exe to do that)

Move the upk files in the new unpacked folder to "\XCom-Enemy-Unknown\XEW\XComGame\CookedPCConsole" (rest of line not needed for UICollection_Strategy_SF.upk) and remove any corresponding .uncompressed_size files only the .uncompressed_size for UPKs you have decompressed.

Open the UPK files to be edited in your hex editor.

Go back to the text editor after the "UPK_FILE="line there is an "OFFSET=" line (That tells where to start the edit) copy the number and go back to your hex editor.

In HxD there is an OFFSET: in the bottom left you can double click on that to bring up the goto offset. Click the "dec" box and make sure the "begin" boes is checked than past the number copied form the mods "OFFSET=" line and click ok (it may be different in other hex editors)

go back to the text editor and under the { INSTALL } line select THE WHOLE LINE (it will be broken into multiple lines in windows notepad even if word wrap is off so use Notepadd++) and copy it

back in HxD press Ctrl+B or chose edit and select "Past Write" NOT Crtl+V OR "PAST INSERT"

Save

The "Item Grid EW.txt" is only set to change the item view. INI edits are needed to use mote items.

to use more items the DGC.ini lines for armors need to be changed. each armor has it's own "iSmallItems=" setting that controls how many item can be used with that armor (the game will crash if you go above 16 small items but remember there is the +1 small item upgrade so don't go above 15 here)

 

Custom mod DGC.ini edits are under [iNI] and just replace the equivalent INI lines in the DGC.ini file with whatever is in the mod.

 

Excellent job, thanks, works like a charm. Karma +1.

 

Another question with this though, there seems to be a hard-coded limitation of grenades that the game detects:

 

The three first slots are the only ones which can be assigned to grenades. If you assign more, the game ignores all the grenades you carry around beyond the first three, making it possible to carry around 3 (or 6 with grenadier or deep pockets) grenades maximum. This applies to all kinds of grenades, so carrying 2 frags, 2 needles, 2 ghost grenades doesn't works either.

 

Some testing reveals that carrying around several stim-packs on the last slots DOES work, however the game displays that you carry only one. When you carry multiple ones, you can use one, then the next turn the game UI displays that your stim isn't usable anymore, however you can use it a second time (didn't test with more than two). Other items, which you don't toss seem to work as well (scope, plating, vests e.t.c.)

 

I'll try to screw around into XCG.upk to see if this is hard-coded somewhere.

 

@ Prometheus > I'd upload the upk for you, but it's a little too huge for the forums.

 

 

 

 

EDIT:

 

IMPORTANT UPDATE!!!

 

In order for the grenades to be effectively unlimited (to bypass the 3 grenades thing) you have to assign eWP_Backpack into their properties (DGC.ini), in order to remove them from the soldier's belt. This bypasses the quantity of grenades you can carry around and makes it so all the grenades you take, you can use.

 

Next Goal: Make it possible to carry 2 medikits at a time.

 

EDIT 2:

 

It seems like not all grenades are still counted. While the method I described above does extend the grenade you may take with you from 3 to 5, beyond that, there's still some grenades the game forgets about. Checking to see if I can fix that.

 

EDIT 3:

 

Okay, here are the results of my testing:

 

Using a soldier with deep pockets:

 

- Taking 2 different kinds of backpack bound grenades, 2x4, gives the soldier 8 grenades of one type (removes smoke), seemingly forgetting the last sets of grenades (or not using deep pockets on them), taking chitin plating boots health.

 

- Taking 3 different kinds of backpack bound grenades, 3x2, as well as chitin, medikit and scope, the soldier has 6 grenades of 1 kind, 2 grenades of second kind, 0 grenades of 3rd, 0 smoke grenades, 0 medikit charges, no chitin boost. Scope boost remains.

 

- Taking 3 different kinds of backpack bound grenades, 3x3, gives the soldier 6 grenades of 1st type, 2 grenades of 2nd type, 2 grenades of 3rd type but removes smoke grenade.

- Taking 1 belt bound kind of grenades and 2 backback bound ones, 1x2 + 2x2, gives the soldier 4 of each grenade, but removes smoke grenades, chitin plating and medkit. Scope boost stays.

 

 

Deducing from this, it looks like backpack items share space between all of them. I'm not sure how many backpack spaces there are overall, but I'll try testing with a soldier without deep-pockets and without smoke grenades to see how things work out. So far it looks like there is 3 belt spaces and 3 backpack spaces, however I'm not sure how these interact together and if deep pockets affects that.

 

 

 

EDIT 4:

 

It seems deep pockets does NOT affect the way equipment slots are distributed so far. My advise right now would be to stick with 6 inventory slots, however 8 might work out as well. It also seems to work better if there are less grenade types and under 3 grenades of the same type. The best results are with 2 belt bound grenades, 2 backpack bound grenades, 2 items. However 3 belt grenades, 3 backpack grenades and 2 items seems to work as well.

 

Conclusion: This all is a pretty messy, messy, messy story. I'll screw with upks and inis and post if I find out anything interesting, but yeah, sticking to 6 inventory slots maximum seems like the most logical thing right now.

Edited by ReclusePhayder
Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

To manual install a ToolBoks custom mod (like the grid view for EW) you need to do a few things.

 

You need a way to decompress the UPK files (ToolBoks has one but will not do it for you ATM but I'll tell you haw to use it)

A hex editor (I use HxD for most stuff)

a text editor (you may be able to get away with windows notepad for some but I use Notepad++)

BACKUPS if somthing goes wrong

resourcehack is optional but if it's working for you use it (I tend to do the hex edit on the exe to load DGC.ini so I don't need yo use resourcehack)

 

Before you do anything with the EW files back them up.

 

Installing

 

Open the custom mod you want to install in a text editor (in this case "Item Grid EW.txt")

Look for any lines that start "UPK_FILE=" (in this case that's just UICollection_Strategy_SF.upk) backup those files and copy them from "\XCom-Enemy-Unknown\XEW\XComGame\CookedPCConsole" to wherever you have ToolBoks.

Decompress the copied upu files using decompress.exe (you should be able to just drag them to the exe to do that)

Move the upk files in the new unpacked folder to "\XCom-Enemy-Unknown\XEW\XComGame\CookedPCConsole" (rest of line not needed for UICollection_Strategy_SF.upk) and remove any corresponding .uncompressed_size files only the .uncompressed_size for UPKs you have decompressed.

Open the UPK files to be edited in your hex editor.

Go back to the text editor after the "UPK_FILE="line there is an "OFFSET=" line (That tells where to start the edit) copy the number and go back to your hex editor.

In HxD there is an OFFSET: in the bottom left you can double click on that to bring up the goto offset. Click the "dec" box and make sure the "begin" boes is checked than past the number copied form the mods "OFFSET=" line and click ok (it may be different in other hex editors)

go back to the text editor and under the { INSTALL } line select THE WHOLE LINE (it will be broken into multiple lines in windows notepad even if word wrap is off so use Notepadd++) and copy it

back in HxD press Ctrl+B or chose edit and select "Past Write" NOT Crtl+V OR "PAST INSERT"

Save

The "Item Grid EW.txt" is only set to change the item view. INI edits are needed to use mote items.

to use more items the DGC.ini lines for armors need to be changed. each armor has it's own "iSmallItems=" setting that controls how many item can be used with that armor (the game will crash if you go above 16 small items but remember there is the +1 small item upgrade so don't go above 15 here)

 

Custom mod DGC.ini edits are under [iNI] and just replace the equivalent INI lines in the DGC.ini file with whatever is in the mod.

 

You have been very kind, your instructions have been crystal clear ... It works!
My soldiers warmly thank you :thumbsup: :tongue: :dance: :yes:
Link to comment
Share on other sites

 

To manual install a ToolBoks custom mod (like the grid view for EW) you need to do a few things.

 

 

You need a way to decompress the UPK files (ToolBoks has one but will not do it for you ATM but I'll tell you haw to use it)

A hex editor (I use HxD for most stuff)

a text editor (you may be able to get away with windows notepad for some but I use Notepad++)

BACKUPS if somthing goes wrong

resourcehack is optional but if it's working for you use it (I tend to do the hex edit on the exe to load DGC.ini so I don't need yo use resourcehack)

 

Before you do anything with the EW files back them up.

 

Installing

 

Open the custom mod you want to install in a text editor (in this case "Item Grid EW.txt")

Look for any lines that start "UPK_FILE=" (in this case that's just UICollection_Strategy_SF.upk) backup those files and copy them from "\XCom-Enemy-Unknown\XEW\XComGame\CookedPCConsole" to wherever you have ToolBoks.

Decompress the copied upu files using decompress.exe (you should be able to just drag them to the exe to do that)

Move the upk files in the new unpacked folder to "\XCom-Enemy-Unknown\XEW\XComGame\CookedPCConsole" (rest of line not needed for UICollection_Strategy_SF.upk) and remove any corresponding .uncompressed_size files only the .uncompressed_size for UPKs you have decompressed.

Open the UPK files to be edited in your hex editor.

Go back to the text editor after the "UPK_FILE="line there is an "OFFSET=" line (That tells where to start the edit) copy the number and go back to your hex editor.

In HxD there is an OFFSET: in the bottom left you can double click on that to bring up the goto offset. Click the "dec" box and make sure the "begin" boes is checked than past the number copied form the mods "OFFSET=" line and click ok (it may be different in other hex editors)

go back to the text editor and under the { INSTALL } line select THE WHOLE LINE (it will be broken into multiple lines in windows notepad even if word wrap is off so use Notepadd++) and copy it

back in HxD press Ctrl+B or chose edit and select "Past Write" NOT Crtl+V OR "PAST INSERT"

Save

The "Item Grid EW.txt" is only set to change the item view. INI edits are needed to use mote items.

to use more items the DGC.ini lines for armors need to be changed. each armor has it's own "iSmallItems=" setting that controls how many item can be used with that armor (the game will crash if you go above 16 small items but remember there is the +1 small item upgrade so don't go above 15 here)

 

Custom mod DGC.ini edits are under [iNI] and just replace the equivalent INI lines in the DGC.ini file with whatever is in the mod.

 

Excellent job, thanks, works like a charm. Karma +1.

 

Another question with this though, there seems to be a hard-coded limitation of grenades that the game detects:

 

The three first slots are the only ones which can be assigned to grenades. If you assign more, the game ignores all the grenades you carry around beyond the first three, making it possible to carry around 3 (or 6 with grenadier or deep pockets) grenades maximum. This applies to all kinds of grenades, so carrying 2 frags, 2 needles, 2 ghost grenades doesn't works either.

 

Some testing reveals that carrying around several stim-packs on the last slots DOES work, however the game displays that you carry only one. When you carry multiple ones, you can use one, then the next turn the game UI displays that your stim isn't usable anymore, however you can use it a second time (didn't test with more than two). Other items, which you don't toss seem to work as well (scope, plating, vests e.t.c.)

 

I'll try to screw around into XCG.upk to see if this is hard-coded somewhere.

 

@ Prometheus > I'd upload the upk for you, but it's a little too huge for the forums.

 

 

 

 

EDIT:

 

IMPORTANT UPDATE!!!

 

In order for the grenades to be effectively unlimited (to bypass the 3 grenades thing) you have to assign eWP_Backpack into their properties (DGC.ini), in order to remove them from the soldier's belt. This bypasses the quantity of grenades you can carry around and makes it so all the grenades you take, you can use.

 

Next Goal: Make it possible to carry 2 medikits at a time.

 

EDIT 2:

 

It seems like not all grenades are still counted. While the method I described above does extend the grenade you may take with you from 3 to 5, beyond that, there's still some grenades the game forgets about. Checking to see if I can fix that.

 

EDIT 3:

 

Okay, here are the results of my testing:

 

Using a soldier with deep pockets:

 

- Taking 2 different kinds of backpack bound grenades, 2x4, gives the soldier 8 grenades of one type (removes smoke), seemingly forgetting the last sets of grenades (or not using deep pockets on them), taking chitin plating boots health.

 

- Taking 3 different kinds of backpack bound grenades, 3x2, as well as chitin, medikit and scope, the soldier has 6 grenades of 1 kind, 2 grenades of second kind, 0 grenades of 3rd, 0 smoke grenades, 0 medikit charges, no chitin boost. Scope boost remains.

 

- Taking 3 different kinds of backpack bound grenades, 3x3, gives the soldier 6 grenades of 1st type, 2 grenades of 2nd type, 2 grenades of 3rd type but removes smoke grenade.

- Taking 1 belt bound kind of grenades and 2 backback bound ones, 1x2 + 2x2, gives the soldier 4 of each grenade, but removes smoke grenades, chitin plating and medkit. Scope boost stays.

 

 

Deducing from this, it looks like backpack items share space between all of them. I'm not sure how many backpack spaces there are overall, but I'll try testing with a soldier without deep-pockets and without smoke grenades to see how things work out. So far it looks like there is 3 belt spaces and 3 backpack spaces, however I'm not sure how these interact together and if deep pockets affects that.

 

 

 

EDIT 4:

 

It seems deep pockets does NOT affect the way equipment slots are distributed so far. My advise right now would be to stick with 6 inventory slots, however 8 might work out as well. It also seems to work better if there are less grenade types and under 3 grenades of the same type. The best results are with 2 belt bound grenades, 2 backpack bound grenades, 2 items. However 3 belt grenades, 3 backpack grenades and 2 items seems to work as well.

 

Conclusion: This all is a pretty messy, messy, messy story. I'll screw with upks and inis and post if I find out anything interesting, but yeah, sticking to 6 inventory slots maximum seems like the most logical thing right now.

 

This just gave me a headache lmao.

Link to comment
Share on other sites

Well, I have looked at this and the answer is a little bit complex. I had to mod some of these functions in order to add the additional items into Long War, so fortunately was already familiar with this section of the upks.

 

The game has two different inventory systems:

1) struct TInventory contains just arrays of item IDs. It contains space for 1 armor, 1 pistol, 16 large items and 16 small items. This system is used by the strategy game for the most part.

2) class XGInventory is a dynamic graph of class objects. These are primarily used for attaching/displaying item models onto units.

 

In Enemy Within there are 25 slot attachment points. These are used to attach item objects to units. Note that eSlot 15 is ESlot_Head. This is how soldier customization is done.

 

 

enum ELocation
{
    eSlot_None,
    eSlot_RightBack,
    eSlot_LeftBack,
    eSlot_RightHand,
    eSlot_LeftHand,
    eSlot_Grapple,
    eSlot_RightThigh,
    eSlot_LeftThigh,
    eSlot_LeftBelt,
    eSlot_RightChest,
    eSlot_LeftChest,
    eSlot_RightForearm,
    eSlot_RightSling,
    eSlot_RearBackPack,
    eSlot_PsiSource,
    eSlot_Head,
    eSlot_CenterChest,
    eSlot_Claw_R,
    eSlot_Claw_L,
    eSlot_ChestCannon,
    eSlot_KineticStrike,
    eSlot_Flamethrower,
    eSlot_ElectroPulse,
    eSlot_GrenadeLauncher,
    eSlot_PMineLauncher,
    eSlot_RestorativeMist,
    eSlot_MAX
};

 

 

 

 

There is a function XGLoadoutMgr.ConvertTInventoryToSoldierLoadout that handles the conversion from the basic TInventory structure into the XGInventory design.

 

For example:

    if(I < kInventory.iNumLargeItems)
    {
        if(kChar.eClass == 6)
        {
            <snip>
        }
        else
        {
            if(I == 0)
            {
                Loadout.Items[1] = class<XGWeapon>(class'XGItemLibrary'.static.GetItem(kInventory.arrLargeItems[I]));
            }

For non-MECs this loads the first large-item into eSlot 1, which is eSlot_RightBack. The 2nd large item goes into eSlot 2, eSlot_LeftBack. This is why the Rocket Launcher goes onto the left and the main weapon is holstered to the right. For example, if you give a Heavy a medkit and watch the animation, the unit has both LMG and Rocket Launcher on the back while the medikit is in hand.

 

Any subsequent large items (anything more than 2) gets tossed into a non-display backpack dynamic array with:

Loadout.Backpack.AddItem(class<XGWeapon>(class'XGItemLibrary'.static.GetItem(kInventory.arrLargeItems[I])));

Small items work a little differently.

 

The rules for small items are:

  1. Any item marked as eWP_Backpack goes into the backpack
  2. The 1st non-backpack small item goes into eSlot 7, eSlot_LeftThigh
  3. The 2nd non-backpack small item goes into eSlot 10, eSlot_LeftChest
  4. The 3rd non-backpack small item goes into eSlot 8, eSlot_LeftBelt

 

Unlike with the large items, there is no default behavior forcing any additional non-backpack items above 3 into the backpack. They simply are not converted to the XGInventory. Everything in the tactical game draws from the XGInventory, so those items are effectively lost during the tactical battle.

 

This is a slight design flaw that is only is exposed when more than 3 non-backpack small items are equipped to a character.

Link to comment
Share on other sites

Good explanation Amineri!

 

Does your sniper shoot from pistol while holding sniper rifle simultaneously? Similar issue was with arc thrower in pistol slot, but now it happened in vanilla EW.

Link to comment
Share on other sites

Good explanation Amineri!

 

Does your sniper shoot from pistol while holding sniper rifle simultaneously? Similar issue was with arc thrower in pistol slot, but now it happened in vanilla EW.

 

I think this is a bug in the code that swaps or rotates weapons between slots. I occasionally created this bug when I was adding new items (in particular the First Aid Kit had troubles) but was able to fix it for that case.

 

The relevant function here is XGUnit.SwapEquip. At this point I'm not going to be attempting any unofficial bug fixes, as I fully expect Firaxis to have been working on bug fixes since Enemy Within was frozen for release on 1 October.

 

I think the key is probably a bug in the native code that identifies primary and secondary weapons. I think the reason the Arc Thrower was buggy was that it wasn't a valid secondary weapon.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...