Jump to content

R&D -- Adding additional items


Amineri

Recommended Posts

Following anUser's suggestion, I'm continuing a discussion started in the http://forums.nexusmods.com/index.php?/topic/963262-r-d-additional-options-for-shiv-customization/ thread.

 

This thread will focus on the changes being made to allow additional items to be added to the game.

 

Here is the skinny:

1) In the strategy game, all items (available in strategy game) are initially created in the function XGItemTree.BuildItems

 

2) Each item built has it's own call to BuildItem, which has 10 parameters:

itemID, cash, alloys, elerium, time, engineers, techReq, itemReq, FtechReq, EimageID

 

cash can mean price to create, or price to sell on gray market, depending on item

 

3) Builditems has 3176 bytes available

 

4) Any item created via a BuildItem call can have the <cash, alloys, elerium, time, engineers> values overwritten via BalanceItems entry in the DGC.ini

 

5) Not all items built in BuildItems have a DGC.ini entry, but new DGC.ini entries can be created

 

6) The vanilla game builds 101 items in BuildItems

 

7) By structuring the BuildItems calls to set <cash, alloys, elerium, time, engineers> to ZERO in the creation call, and overwriting those values via DGC.ini BalanceItems entries, much space can be freed up

 

:cool: By setting the default BuildItem call to allow 2 requirements, each BuildItem will be 24 bytes (for buildable items), and 22 bytes (for non-buildable items -- e.g. corpses, alloys, UFO Power Sources)

 

9) This frees up enough space for a bit over 127 BuildItem calls to be made -- 26 additional items compared to vanilla

 

a) If space is allocated for three requirements on every item, then only 122 BuildItem calls can be made

 

b) There are some free bytes that will allow some number of items to be declared with three requirements -- just not all of them

 

-------------------------------------------------------------------

 

The BuildItems hex code will be put into a commented ToolBoks file to allow for easier manipulation of the hex code. However, the only reasons to change the hex code are:

a) Change one or more the tech/item/ftech requirements

b) Change the EImage ID for the item

c) Change the category of the item

A full DGC.ini listing of all buildable / equippable items will be provided as well. This list will be sorted into the same order as the call order in BuildItems for easier referencing.

 

---------------------------------------------------------------


Example of ToolBoks commented BuildItems hex code

 

 

 

0F 01 61 35 00 00 26 {//category 1}
1B 6E 04 00 00 00 00 00 00 2C 02 25 25 25 25 25 2C 00 4A 2C 00 2C 25 16 {// pistol}
1B 6E 04 00 00 00 00 00 00 2C 03 25 25 25 25 25 2C 00 4A 2C 00 2C 10 16 {// assault rifle}
...
0F 01 61 35 00 00 2C 04 {//category 4}
1B 6E 04 00 00 00 00 00 00 2C 71 25 25 25 25 25 2C 00 4A 2C 00 2C 34 16 {// SHIV minigun}
1B 6E 04 00 00 00 00 00 00 2C 72 25 25 25 25 25 2C 0B 4A 2C 00 2C 34 16 {// SHIV Sentry}
1B 6E 04 00 00 00 00 00 00 2C 73 25 25 25 25 25 2C 00 4A 2C 06 2C 35 16 {// SHIV Laser}
...
0F 01 61 35 00 00 2C 05 {//category 5}
1B 6E 04 00 00 00 00 00 00 2C AB 25 25 25 25 25 4A 4A 4A 2C 0E 16 {// Elerium 115}
1B 6E 04 00 00 00 00 00 00 2C AC 25 25 25 25 25 4A 4A 4A 2C 24 16 {// Alloys}
1B 6E 04 00 00 00 00 00 00 2C AD 25 25 25 25 25 4A 4A 4A 2C 00 16 {// Fragments}

 

Link to comment
Share on other sites

A couple of notes, from our earlier experience in adding the SHIV weapons:

 

* There are eImages that exist that are NOT in the vanilla game -- I've seen a funky scope-looking thing and a thermal detonator-looking thing, to name a couple. I will attempt to catalog them as time permits, and it would be useful if we could create a single reference for these.

 

* To the best of my knowledge, we have not solved how to connect new items to tactical game graphics -- this appears to be independent of eImage settings. Amineri has previously noted UIScreen.GetImagePath may control the image that appears in the tactical HUD, but that's unconfirmed. Actual meshes appear to be set all over the place.

Link to comment
Share on other sites

My thought was quite in JL's line, maybe first we'd need to test which items provie of a usable mesh, maybe those placeholderarmor, or alien weapons most probably (sectoid grenade?), and then sepparate those that don't have a usable meh but that could be used as a placeholder item just to control extra perks and ability charges, such as a cannibalized rocket item, not rocket launcher. The ini property eWP_backpack sets if an item is displayed when equipped, it can be turned off for cannibalized items. Anyway if I don't get it wrong allowing 3 requirements fo item we still have got space for 21 new items, compared to 25 items with 2 requirements. It seems we could do with 21.
Link to comment
Share on other sites

@JL -- I think the "thermal detonator" thing is the default image for the Battlescanner if you make it buildable. Is the "funky scope" not the EMP cannon?

That said, I would love a wiki page that listed EImage IDs and the corresponding graphics

 

@anUser -- We can have our cake and eat it, too.

 

I set the default to two items, so that byte-juggling wouldn't be necessary in the majority of cases, but even with a default of 2 it is possible to make some number of items have 3.

 

1) There will be a "pool" of null-ops at the end of the hex file (with the left-overs).

 

2) For each items with three reqs, one byte is added to the BuildItem call, so one byte is taken from that null-op pool.

 

((The same could actually be done for all items, but it's a bit of a pain, so to minimize it I had the thought to set the default to 2. There are just enough items already with 2 reqs that making 1 the default would have been annoying. That said, if your mod has a large number of items with 3 reqs, you could rework the default ... it just leaves less room for new items.))

Link to comment
Share on other sites

@Amineri: you're right, prerequisites shouldn't be a concern regarding items, I'm sure we'll find a way to squeeze some calls and extend some others when the time's come for a final build, specially considering there's a pool of null bytes, so moving to another subject, I'll list some items I'm using, or I was planning to use, or at least I'm planning to test wether they're usable:

 

 

Tested Items:

- eItem_SmokeGrenade (item ID 86) *requires Perk & edit to UpdateItemCharges, IsClassEquipable & GetLockerItems

- eItem_AlienGrenade (item ID 88) *requires edit to UpdateItemCharges & OnFoundryProjectCompleted

- eItem_BattleScanner (item ID 99) *requires Perk & edit to UpdateItemCharges (soldiers carry by default 1 battlescanner item in a hidden inventory slot)

- eItem_Grapple (item ID 36) * requires edit to DGC.ini & IsClassEquipable, it doesn't have an icon (or I haven't found it) but the mesh works ok (it's a bit weird to have a section of the arm hanged in the belt but hey, it works)

 

Possible functional items with mesh and animations:

- eItem_PlaceholderWeapon0 to eItem_PlaceholderWeapon7 (item ID 21-28)

- eItem_SectoidPlasmaPistol, eItem_PlasmaLightRifle_ThinMan, eItem_PlasmaLightRifle_Floater, eItem_PlasmaLightRifle_Muton, eItem_PlasmaAssaultRifle_Muton, eItem_HeavyPlasma_Floater, eItem_HeavyPlasma_Muton (item ID 39-45) * Despite aliens using standard "player" plasma weapons, players could use "alien" plasma weapons, and so incorporating different degrees of quality in plasma weapons (I assume they're functional and have got default mesh, animation & shot visuals, that's to be tested).

- eItem_OutsiderWeapon (ID 50)

- eItem_DLCArmor0 to eItem_DLCArmor7, eItem_PlaceholderArmor0, eItem_PlaceholderArmor1 (item ID 64-73)

- eItem_FlashBang (item ID 87) * still non-functional, it needs an ability to be tied with. The plan is using the "Shredder Rocket" ability for this, so it would no longer be available to rockets.

- eItem_PlaceholderGrenade0, eItem_PlaceholderGrenade1 (item ID 89, 90) + eItem_SectoidGrenade, eItem_FloaterGrenade, eItem_MutonGrenade, eItem_CyberdiscGrenade, eItem_ThinManGrenade (item ID 92-96) * it's still unclear if we can have several items using the same ability and performing in a different way each one (ie several grenade types with different damage or radius value, even radius randomness, etc), or how we can make use of several grenade types (a gas grenade using the Plague ability?).

- eItem_ShivMinigun, eItem_ShivSentry, eItem_ShivLaser, eItem_ShivPlasma, eItem_SHIVDeck_I, eItem_SHIVDeck_II, eItem_SHIVDeck_III, eItem_PlaceholderShivUpgrade0, eItem_PlaceholderShivUpgrade1 (items ID 113-121) + eItem_IntWeap_I, eItem_IntWeap_II, eItem_IntWeap_III, eItem_IntWeap_IV, eItem_IntWeap_V, eItem_IntWeap_VI, eItem_PlaceholderIntWeapon0, eItem_PlaceholderIntWeapon1 (item ID 123-130) * I ignore wich of those weapons are actualy used by the game

 

Items that may have a mesh but also may give problems with animations:

- eItem_FlameThrower (item ID 20)

- eItem_SectopodArm, eItem_SectopodCannon, eItem_SectopodHeatRay, eItem_ChryssalidClaw, eItem_DroneBeam (items ID 30-34)

- eItem_CyberdiscWeapon (item ID 37)

- eItem_ZombieFist, eItem_ElderWeapon, eItem_MutonBlade (items ID 47-49)

 

Items that may be required to use some ability:

It may be hard-coded somewhere that some ability can only be used if certain item is equipped, which we could change, or it could be a prerequisite in order to display animations correctly, so I'll list those items in case we were to use the ability apparently tied to each item

- eItem_SectopodArm, eItem_SectopodCannon, eItem_SectopodHeatRay, eItem_ChryssalidClaw, eItem_DroneBeam (items ID 30-34)

- eItem_CyberdiscWeapon (item ID 37)

- eItem_ZombieFist, eItem_ElderWeapon, eItem_MutonBlade (items ID 47-49)

- eItem_Plague, eItem_SectopodClusterBomb (ID 52, 53)

- eItem_PsiGrenade (ID 98)

 

Items that probably won't have a mesh:

This items could still be made equippable, but wouldn't show up in the tactical game, they'd just display an icon, like the scope item. They could be used to grant some bonus to the wielder, or to add additional charges of an ability.

- eItem_PlaceholderVehicle0, eItem_PlaceholderVehicle1 (ID 109, 110)

- eItem_PlaceholderIntConsumable0, eItem_PlaceholderIntConsumable1 (ID 136, 137)

Also those "label" items don't seem to be used anywhere, so if there's no problem in giving them a different name and icon there are tons of them:

- eItem_BEGIN_WEAPONS (ID 1)

- eItem_BEGIN_SPECIAL_WEAPONS (ID 29)

- eItem_BEGIN_ALIEN_SHARED_WEAPONS (id 38)

- eItem_END_ALIEN_SHARED_WEAPONS (id 46)

- eItem_END_SPECIAL_WEAPONS, eItem_END_WEAPONS, eItem_BEGIN_ARMOR (id 54-56)

- eItem_BEGIN_ITEMS (id 75)

- eItem_END_ITEMS, eItem_BEGIN_GRENADES (id 83, 84)

- eItem_BEGIN_ALIEN_GRENADES (91)

- eItem_END_ALIEN_GRENADES (97)

- eItem_END_GRENADES, eItem_BEGIN_VEHICLES (id 100, 101)

- eItem_END_VEHICLES, eItem_BEGIN_VEHICLE_UPGRADES (id 111, 112)

- eItem_BEGIN_SHIP_WEAPONS (id 122)

- eItem_END_SHIP_WEAPONS, eItem_BEGIN_INTERCEPTOR_CONSUMABLES (id 131, 132)

- eItem_END_INTERCEPTOR_CONSUMABLES, eItem_END_VEHICLE_UPGRADES, eItem_BEGIN_CORPSES (id 138-140)

- eItem_END_CORPSES, eItem_BEGIN_CAPTIVES (id 158, 159)

- eItem_END_CAPTIVES, eItem_BEGIN_COLLECTIBLES (id 169, 170)

- eItem_END_COLLECTIBLES (id 190) and also perhaps eItem_NullPrereq & eItem_MAX (id 194, 195)

 

 

I've also made a list of possible display icons that aren't used in the game. I based this list on the icons used in BuildItems function, I just sorted the icons that were used, and those mssing were: 7, 22, 24, 33, 35, 39, and then there were items that used a high img number, the highest 199. If we assume each index corresponds to a picture, then other possible candidates are: from 67 to 198, except for 163, 186 and 193 that are already used.

 

 

I haven't made a complete list of new items I wanted to implement, I'll work on that this days and also I'll try some of this items to see which ones have a mesh and animations and which don't. There are a few new items I have in mind that would grant a perk or extra charges, but clearly I'd prefer having items with working animations (ie more weapons) rather than items that they're just there. Anyway, if some item is used to give perks or charges and later on we discover it can be used as a weapon, changing that would be quite simple, I'm just saying this in case (quite unlikely, but possible) that we discover so many usable weapons that we're short of space in BuildItems to create just equippable items (as opposed to animated weapons). In any case it'd be good to know if some of those weapons can be used.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...