Jump to content
XCOMUFO & Xenocide

Manufacturing New Items?


Treach

Recommended Posts

Hello Friends, my first post to these boards. Just back back into the swing of the fun that is XCOM2.

 

Long story short, I'm trying to figure out if it's possible to make Zrbite manufacturable. I've done some reading on these forums and the UFOpaedia, but the information there seems to be more directed at XCOM1. Product.dat seems to be hardcoded in what items are listed and in what order. Is there some correlation to the obdata.dat file, perhaps one of the unknown bit entries as a pointer to the item in product.dat? Or perhaps this is in the exe code itself? Any ideas/thoughts guys?

 

Cheers!

Link to comment
Share on other sites

Since Zrbite is not a valid listing in product.dat, I doubt anything could be done. Now, if all items in the game had listings in product.dat, then this would be a piece of cake. Edit a setting here, a setting there, and bingo, manufacturable Zrbite. Alas, nothing is that simple. Looking at purchase.dat, I think we could make Zrbite able to be bought by editing the purchasability flag. Is that ok too? :D

 

- Zombie

Link to comment
Share on other sites

Since Zrbite is not a valid listing in product.dat, I doubt anything could be done. Now, if all items in the game had listings in product.dat, then this would be a piece of cake. Edit a setting here, a setting there, and bingo, manufacturable Zrbite. Alas, nothing is that simple. Looking at purchase.dat, I think we could make Zrbite able to be bought by editing the purchasability flag. Is that ok too? :D

 

- Zombie

 

Hey, thanks for the info. Do you know of a resource that I can use to figure out what the listings are in purchase.dat? I've found some lists for XCOM1 but not XCOM2. Google/UFOpaedia/the search button turns up nothing.

 

Treach

Link to comment
Share on other sites

Hey, thanks for the info. Do you know of a resource that I can use to figure out what the listings are in purchase.dat? I've found some lists for XCOM1 but not XCOM2. Google/UFOpaedia/the search button turns up nothing.

 

Treach

Yeah, there is basically nothing on TFTD. Primarily it's because people don't really play that game as often as EU. The lack of TFTD modding info on the wiki is also a little bit discouraging to budding hackers, but a lot of these files can be decoded by simply looking at the EU counterparts. (That is, if the bytes match).

 

Speaking of offsets, I was fooling around with base.dat today and noticed that TFTD's base.dat is 296 bytes long, not 292 as X-COM EU. That's like the third file I know of where the bytes do not match:

 

Record     Item
 1        Aquanaut
 2        Scientist
 3        Technician
 4        TRITON
 5        HAMMERHEAD
 6        LEVIATHAN
 7        BARRACUDA
 8        MANTA
 9        Ajax Launcher
 10       D.U.P. Head Launcher
 11       Craft Gas Cannon
 12       P.W.T. Cannon
 13       Gauss Cannon
 14       Sonic Oscillator
 15       Ajax Torpedoes
 16       D.U.P. Head Torpedoes
 17       Gas Rounds(×50)
 18       P.W.T Ammo
 19       Gauss Cannon Ammo
 20       Coelacanth/G. Cannon
 21       Solid Harpoon Bolts
 22       Coelacanth/Aqua Jet
 23       Aqua Jet Missiles
 24       Coelacanth/Gauss
 25       Gauss Cannon Ammo
 26       Displacer /Sonic
 27       Displacer /P. W. T.
 28       P.W. Torpedo
 29       Dart Gun
 30       Dart Clip
 31       Jet Harpoon
 32       Harpoon Clip
 33       Gas Cannon
 34       GC-AP Bolts
 35       GC-HE Bolts
 36       GC-Phosphorous Bolts
 37       Hydro-Jet Cannon
 38       HJ-AP Ammo
 39       HJ-HE Ammo
 40       HJ-P Ammo
 41       Torpedo Launcher
 42       Small Torpedo
 43       Large Torpedo
 44       Phosphor Torpedo
 45       Gauss Pistol
 46       Gauss Pistol Clip
 47       Gauss Rifle
 48       Gauss Rifle Clip
 49       Heavy Gauss
 50       Heavy Gauss Clip
 51       Magna-Blast Grenade
 52       Dye Grenade
 53       Particle Disturbance Grenade
 54       Magna-Pack Explosive
 55       Particle Disturbance Sensor
 56       Medi-Kit
 57       M.C. Disruptor
 58       Thermal Tazer
 59       Chemical-flare
 60       Zrbite
 61       Sonic Cannon
 62       Cannon Power Clip
 63       Sonic-Blasta Rifle
 64       Blasta Power Clip
 65       Sonic Pistol
 66       Pistol Power Clip
 67       Disruptor Pulse Launcher
 68       Disruptor Ammo
 69       Thermal Shok Launcher
 70       Thermal Shok Bomb
 71       Sonic Pulser
 72       M.C. Reader
 73       Vibro Blade
 74       Thermic Lance
 75       Heavy Thermic Lance
 76       Aquatoid Corpse
 77       Gill Man Corpse
 78       Lobsterman Corpse
 79       Tasoth Corpse
 80       Calcinite Corpse
 81       Deep One Corpse
 82       Bio-Drone Corpse
 83       Tentaculat Corpse
 84       Triscene Corpse
 85       Hallucinoid Corpse
 86       Xarquid Corpse
 87       Ion-Beam Accelerators
 88       Magnetic Navigation
 89       Alien Sub Construction
 90       Alien Cryogenics
 91       Alien Cloning
 92       Alien Learning Arrays
 93       Alien Implanter
 94       Examination Room
 95       Aqua Plastics
 96       Alien Re-animation Zone
 97       Plastic Aqua Armor
 98       Ion Armor
 99       Mag. Ion Armor

- Zombie

Edited by Zombie
Link to comment
Share on other sites

The byte count for UFO -vs- TFTD differs in some files because TFTD uses 16-bit integers in one or two stats in place of a few of UFO's 8-bit stats.

 

Say, Zombie, you mentioned you can make certain items purchaseable? Can this be done for the 6 unused items in UFO's item table? If you can that will give UFO modders 6 free slots to put in modded weapons and not touch the plain vanilla weapons. Me, I just want that ultra-heavy gatling laser... woo.

 

- NKF

Edited by NKF
Link to comment
Share on other sites

The byte count for UFO -vs- TFTD differs in some files because TFTD uses 16-bit integers in one or two stats in place of a few of UFO's 8-bit stats.

Oh. Then I suspect that the TFTD records don't have any more info in them. The difference always bothered me, and I was planning to take a look at them sometime. This'll save me some time. :doh:

 

Say, Zombie, you mentioned you can make certain items purchaseable? Can this be done for the 6 unused items in UFO's item table? If you can that will give UFO modders 6 free slots to put in modded weapons and not touch the plain vanilla weapons. Me, I just want that ultra-heavy gatling laser... woo.

Well, editing the purchasibility flag to 1 for the unused items doesn't make them show up in the purchase screen. Editing one item directly into your stores doesn't make it show up in the sell screen. There has to be something else which governs whether an item shows up in either place. Maybe I'll mess with obdata.dat to make them as near to a legit weapon as possible to see if that does the trick. Other than this, I'll have to study the wiki closer to get some clues. We'll get to the bottom of this... eventually. :D

 

- Zombie

Link to comment
Share on other sites

Outstanding work Zombie and NKF! I just did as you said, hacked my purchase.dat in my savegame folder, made zrbite cost 10 (just for testing B) ) and purchase flag to 01, and lo and behold it's in my purchase list! Am going to fart around with the other files and see if I can't somehow make it a manufacturable item. My goal is to tie it to research, once that's completed zrbite should be manufacturable, probably at about a 1/2 to 2/3 cost like aqua plastics I think is fair.

 

Zombie and NKF, why not post your findings to ufopaedia? That's some awesome work and it definitely should not get lost in the forums. Will report back with findings.

 

Treach

 

Edit -

 

Dammit ok, I just realized I can't find any data on the product.dat file, and it's 774 bytes vs 630 for XCOM1. Hatfarm's list on his site at http://www.stonepool.com/xcom/hacking/product.html is for XCOM1 as well. 774 / 12 is 64.5 so that's not right, 774 / 18 is 43 so that might be it, XCOM1 had 35 entries, so you throw in the 3 lances + 5 gauss clips for the weapons/sws/subweap that adds up to 43. Now we just need to figure out what order... Anyone know up front?

 

Edit 2 -

 

OK, more progress. Product.dat entries are indeed 18 bytes long. 0-3 bytes are price. 4-5 is work hours. 6 is workspace required. 7 is 00. 8-10 I don't know, but it's usually 3C, 58, FF, or 51. 10 is almost always FF except for 3 entries which I suspect are the new subs. 11 is aqua plastics required. 12 is zrbite required. 13 is almost always 00 except for the 3 that I suspect are the subs. 14 I haven't a clue. 15 is either 01 or 00, most seem to be 01, can't figure it out. 16 is buildable yet? flag. 17 is always 00.

 

Urg.

 

Edit 3 -

 

HAHAH!! Found something! Offset 14 is the key. So item 7 on the list is the Displacer PWT, item 6 is the Displacer Sonic. Offset 14 for the Disp/Sonic is 0D, for the Disp/PWT it's 0E. I simply changed the offset for the Displacer PWT to 0D, and bingo, suddenly the Displacer/Sonic is buildable on my list instead of the Displacer/PWT. The problem right now is that I can't seem to figure out what the list is that offset 14 is coming from.

 

Further, I tried tacking on another entry at the bottom of the file, and basically making a near cheap/free Displacer/PWT. Didn't work, game wouldn't read it. Looks like if I'm going to make zrbite a manufacturable item I'm going to have to figure out A. what the offset 14 ID of zrbite is, and pick something to replace.

 

Major obstacle at this point is figuring out what offset 14 references against. For example, Aqua Plastic is 0x58, 88 decimal, Displacer/PWT is 0x0E, decimal 14, Displacer/Sonic is 0x0D, decimal 13, and so on...

 

Edit 4 -

 

Success! Offset 14 goes against the list in base.dat. Here's a the list from the file that I downloaded ages ago, the author is "whatever" [email protected].

 

----------------------------------------------------------------------
4. Items
----------------------------------------------------------------------
Items data can be found inside the file "base.dat" in your save game
directory. The offset for each item is fixed, just key in the amount
of item you want. Just like the soldiers data, I'll use the first base
as reference for the next bases.

-----------------------------------------------------
Item Name						Offset	   Size
-----------------------------------------------------
Ajax Launcher					0010		 2 Bytes
D.U.P. Head Launcher			 0012		 2 Bytes
Craft Gas Cannon				 0014		 2 Bytes
P.W.T. Cannon					0016		 2 Bytes
Gauss Cannon					 0018		 2 Bytes
Sonic Oscillator				 001A		 2 Bytes
Ajax Torpedoes				   001C		 2 Bytes
D.U.P. Head Torpedoes			001E		 2 Bytes
Gas Rounds(x50)				  0020		 2 Bytes
P.W.T. Ammo					  0022		 2 Bytes
Coelacanth/ G. Cannon			0024		 2 Bytes
Coelacanth/ Aquajet			  0026		 2 Bytes
Coelacanth/ Gauss				0028		 2 Bytes
Displacer/ Sonic				 002A		 2 Bytes
Displacer/ P.W.T.				002C		 2 Bytes
Dart Gun						 002E		 2 Bytes
Dart Clip						0030		 2 Bytes
Jet Harpoon					  0032		 2 Bytes
Harpoon Clip					 0034		 2 Bytes
Gas Cannon					   0036		 2 Bytes
GC-AP Bolts					  0038		 2 Bytes
GC-HE Bolts					  003A		 2 Bytes
GC-Phosphorous Bolts			 003C		 2 Bytes
Hidro-Jet Cannon				 003E		 2 Bytes
HJ-AP Ammo					   0040		 2 Bytes
HJ-HE Ammo					   0042		 2 Bytes
HJ-P Ammo						0044		 2 Bytes
Torpedo Launcher				 0046		 2 Bytes
Small Torpedo					0048		 2 Bytes
Large Torpedo					004A		 2 Bytes
Phosphorous Torpedo			  004C		 2 Bytes
Gauss Pistol					 004E		 2 Bytes
Gauss Rifle					  0050		 2 Bytes
Heavy Gauss					  0052		 2 Bytes
Magna Blast Grenade			  0054		 2 Bytes
Dye Grenade					  0056		 2 Bytes
Particle Disturbance Grenade	 0058		 2 Bytes
Magna-Pack Explosive			 005A		 2 Bytes
Particle Disturbance Sensor	  005C		 2 Bytes
Medi-Kit						 005E		 2 Bytes
MC Disruptor					 0060		 2 Bytes
Thermal Tazer					0062		 2 Bytes
Chemical-Flare				   0064		 2 Bytes
Vibro Blade					  0066		 2 Bytes
Thermic Lance					0068		 2 Bytes
Heavy Thermic Lance			  006A		 2 Bytes
Sonic Cannon					 0072		 2 Bytes
Cannon Power Clip				0074		 2 Bytes
Sonic Blasta Rifle			   0076		 2 Bytes
Blasta Power Clip				0078		 2 Bytes
Sonic Pistol					 007A		 2 Bytes
Pistol Power Clip				007C		 2 Bytes
Disruptor Pulse Cannon		   007E		 2 Bytes
Disruptor Ammo				   0080		 2 Bytes
Thermal Shok Launcher			0082		 2 Bytes
Thermal Shok Bomb				0084		 2 Bytes
Sonic Pulser					 0086		 2 Bytes
Zrbite						   0088		 2 Bytes
MC Reader						008A		 2 Bytes
Gauss Pistol Clip				008C		 2 Bytes
Gauss Rifle Clip				 008E		 2 Bytes
Heavy Gauss Clip				 0090		 2 Bytes
Aquatoid Corpse				  0092		 2 Bytes
Gillman Corpse				   0094		 2 Bytes
Lobsterman Corpse				0096		 2 Bytes
Tasoth Corpse					0098		 2 Bytes
Calcinite Corpse				 009A		 2 Bytes
Deep One Corpse				  009C		 2 Bytes
Bio-Drone Corpse				 009E		 2 Bytes
Tentaculat Corpse				00A0		 2 Bytes
Triscene Corpse				  00A2		 2 Bytes
Hallucinoid Corpse			   00A4		 2 Bytes
Xarquid Corpse				   00A6		 2 Bytes
Ion-Beam Accelerators			00B0		 2 Bytes
Magnetic Navigation			  00B2		 2 Bytes
Alien Sub Construction		   00B4		 2 Bytes
Alien Cryogenics				 00B6		 2 Bytes
Alien Cloning					00B8		 2 Bytes
Alien Learning Arrays			00BA		 2 Bytes
Alien Implanter				  00BC		 2 Bytes
Examination Room				 00BE		 2 Bytes
Aqua Plastics					00C0		 2 Bytes
Alien Re-animation Zone		  00C2		 2 Bytes
Plastic Aqua-Armour			  00C4		 2 Bytes
Ion Armour					   00C6		 2 Bytes
Mag. Ion Armour				  00C8		 2 Bytes
Technician					   0122		 1 Byte
Scientist						0123		 1 Byte
-----------------------------------------------------

 

Here's the trick. The first item on the product.dat list is the PWT Torp Launcher craft weapon, offset 14 is 0x03. Looking at the list above we see the offset is 0x16. Subtract 10 from this and divide by 2, and you get 3 in decimal, 0x03 in hex. :) Now there's a catch, between the Heavy Thermic Lance and Sonic Cannon is 6 bytes. Aqua Plastics was 88 in product.dat right? 0xC0 is 192, - 6 (since it's lower on the list) - 10 = 176. 172 / 2 = 88 decmial, 0x58 hex.

 

So now the final test. I'm going to replace.... let's say the crappy gauss pistol clip. Gauss pistol offset 14 is 3E. Replace that with Zrbite's offset 14 which I think is... 3C. IT WORKS!!!!!!!!!!!!!!!!!!

 

I guess the last problem is something that can't be fixed because it's in the game code. Ideally when the zrbite research is done, it's set the manufacturable flag to 0x00. Hopefully the UFO2000 project will fix this. :)

 

Thanks Zombie and NKF for your help!

Edited by Treach
Link to comment
Share on other sites

  • 8 months later...

... looking around the forum for the first time in a long time ...

 

Treach, why not post it to the UFOpaedia wiki yourself? As a section near the end of PRODUCT.DAT. The thing that makes a wiki wide ranging, is that folks care enough about their individual topics of interest to add them. =b

 

There are a number of places where we simply point out differences from XCOM1, because otherwise it's just too repetitious to have a lot of the exact same text in two different places. The Game Files section is a prime candidate for having both games' stuff there.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...