Jump to content

Editing X-COM Craft, UFO's as well as craft weapons


Zombie

Recommended Posts

Editing these stats has basically been a non-issue for CE users because there isn't an editor which can accomplish this. But no more.

 

For the last couple weeks I have been doing some research into craft.dat and basically got nowhere. Then I happened across Scott T. Jones' new craft mod. While looking at the documentation I saw the config file. Being curious, I took a peek at it. Low and behold, there were these stats listed. That gave me the order. I also searched around and decided these stats must be in the executable. That gave me the place. Last week I formulated a way to convert decimal numbers into little endian. That gave me the tools. All I needed was time and drive. That was easy. :bleh:

 

Over the course of a couple days I searched the EU executable and found the stats. But I had no idea how many bytes made up each record or where the info started. Luckily, through trial and error and a little luck I figured it out. X-COM craft data starts at non-offset byte 457129 (in MS-Edit with 100 column width it starts at 457229). There are 5 records (Skyranger, Lightning, Avenger, Interceptor and Firestorm) each consisting of 14 fields (2 bytes per field for a total of 28):

  1. Pointer within English.dat for craft name
  2. Points for destruction of craft (signed integer)
  3. Weapon Pods
  4. Max Speed
  5. Acceleration
  6. Fuel Capacity
  7. Damage Capacity
  8. Size Class
  9. Unknown 1
  10. Unknown 2
  11. Weapon Range
  12. Weapon Damage
  13. Crew
  14. HWP's

X-COM craft data ends at non-offset 457268 and directly after it starts the UFO data (Small, Medium, Large Scouts, Harvester, Abductor, Terror Ship, Battleship and Supply Ship). This ends at non-offset byte 457492. Unknowns 1 & 2 do not apply to X-COM craft and neither does Weapon Range or Weapon Damage. Those are specific only to UFO's.

 

A little bit past the UFO data starts the craft weapon stats (457497). There are 6 records (Stingray, Avalanche, Cannon, Fusion Ball Launcher, Laser Cannon and Plasma Beam) each having 9 fields (2 bytes per field for a total of 18):

  1. Pointer within English.dat for craft weapon name
  2. Weapon Range
  3. Accuracy
  4. Damage
  5. Unknown 1
  6. Reload Time
  7. Max Ammo
  8. Unknown 2
  9. Ammo Type

Unknown 2 seems to be related to craft weapon type as all launchers are 1, cannon is 100 and the beams are 50. Not sure about this though.

 

I also found all the corresponding data in TFTD. Included at the end of this post are 2 zipped Excel files: one for X-COM and one for TFTD. Anyone interested in helping decode the unknowns are welcome to look at those files for more intensive data. I did do some minor editing of the unknowns already - but not extensively so any theories will be welcomed. :what:

 

X_COM_All_Craft_Data.zipTFTD_All_Craft_Data.zip

- Zombie

Link to comment
Share on other sites

  • 2 months later...
All of this info is awesome, but it's all based on MS edit. I can't even begin to understand how to use MS edit, so I use Hex Workshop and Cygnus since they actually show everything in hex (Maybe I'm special, but my MS edit in binary mode shows all kindsa crazy symbols and stuff, not hex.) I still want to edit my ships though. How would I find this info using one of the other editors? "Starts at 499965" doesn't mean anything to me...
Link to comment
Share on other sites

499965 is an offset. That's to say, it's a certain byte in the list of data... The very first byte in the file is offset 0, the second is 1, then it goes 2, 3, 4, etc...

 

MS Calculator (Check Accessories under your Start Menu) can convert decimal to hex, if that helps (though you need to change the view to Scientific). 499965 is 7A0FD in hexidecimal.

 

There's a brief guide to using MS Edit for this in the UFO Wiki.

Link to comment
Share on other sites

I realize 499965 is an offset...and I know how to convert...but if I open craft.dat in Hex workshop, use goto and type in 7A0FD, it just dings at me and does nothing. So either you guys are speaking in a language that nobody but you understands, or I'm not understanding something :) From what I can tell (in hex workshop), the last offset in this file is 5500 (0x0000157C). In Cygnus, it tells me that offset 7A0FD is outside the file length.

 

Also, in MS edit, how would I go to that offset? I can't find any kind of goto function.

 

Thanks to you guys, I understand perfectly how to edit just about anything...I just have to be able to find it :-P

Link to comment
Share on other sites

Lol...well, that would explain my problems then :-) Thanks for pointing that out!

 

EDIT: Awesome, found it! Man, I have no idea why I was looking in craft.dat. I do have a question now, though; what needs to be edited so hammerheads and leviathans don't use zrbite as fuel?

Link to comment
Share on other sites

To find any offset you want with MS-Edit, use this trick:

 

Open your file with a line width of 100

 

Now, let's say we want offset 534925. That's in decimal - use MS-Calculator or your own scientific calculator's hex to decimal function (n-base) if your offset was in hex. Anyway, you just go to line 5349 and scroll across to column 25. Alternately, if you set the line width to 1000, you'd go down to row 534 and scroll across 925 characters. :)

 

- NKF

Link to comment
Share on other sites

"Unknown 2 seems to be related to craft weapon type as all launchers are 1, cannon is 100 and the beams are 50. Not sure about this though."

 

I've looked at the file and changed these, but it doesn't seem to do anything. What you said is correct though. I tried changing the PWT cannon to 100 and ammo to 0 (effectively making it a sonic cannon) and equipped one in game. I got a message saying I didn't have enough AJAX torpedoes to re-equip the sub. ???

Link to comment
Share on other sites

Yeah, the last two fields are a little strange in general. In fact, I'm not even sure if the last record is Ammo Type anymore. See, when I edited the Stingray Launcher to have a value of 57 for that field, it said I didn't have enough "Small Launcher" to rearm my interceptor. Me thinks this field is a pointer for the name of the ammo. It's possible that Unknown 1 is the ammo type, but haven't had much time to check. :)

 

- Zombie

Link to comment
Share on other sites

I tried changing the PWT cannon to match the sonic cannon and it still asked for ammo. Apparently, there's something else that needs to be changed in order to modify what ammo a craft weapon uses...

 

I'm about to start randomly changing UNK1 and see what it does in game. If UNK1 is just the name tho, changing this would be fruitless. Guess I'll try UNK2 as well. I'll report anything interesting I find.

Link to comment
Share on other sites

I fooled around with Unknowns 1 & 2 last night. Basically got nowhere as there doesn't appear to be any visible changes/behavior to the weapon in an intercept mode or sitting in the stockpiles. I think Unknown 1 is either ammo type or possibly damage type. Unknown 2 has to do with ammo somehow, but I haven't figured it out yet. :)

 

The last column of the craft weapon data is a pointer. Changing it corresponds to the item list in the sell screen at your base. 0 is the Stingray Launcher, 1 is the Avalanche Launcher and so on and so forth until 43. Item 43 corresponds to the first of the 3 unused laser weapons in obdata.dat. Its description is the Firestorm's UFOPaedia text. Item 44 is the Avenger's UFOPaedia text and 45 is the UFOPaedia text for the Terror Ship. I didn't check the CORPSE types in obdata yet, nor did I check the 3 >> unused

 

- Zombie

Link to comment
Share on other sites

Yesterday I was just thinking about craft weapons in general. When you look in the UFOPaedia entries, damage is always the same as accuracy for some reason. I never understood why the programmers decided on reusing those numbers. Fine, I'll just do a little editing to see what is going on. :)

 

First I edited the Accuracy byte of the Stingray Launcher in the executable to 80%, just to see if the UFOPaedia entry would update. Nope, it remained the same. Then I edited the damage byte to 90. When I checked the article again, Damage and Accuracy were both listed as 90. So it appears the programmers accidentally linked to the same byte for the article. Do we know where the UFOPaedia does this linking? I'd like to know, because I'd like to fix it. *grumbles* I'd like to fix the problem with the craft weapon text not showing up either... :)

 

With that established, I wondered if the accuracy stat was actually the number used for damage or the accuracy byte in the executable. This should be easy. I edited Accuracy of the Stingray to 0, equipped my Avenger with dual launchers + 200 ammo and engaged a UFO to find out. All the shots missed. When I edited accuracy to 5% shots sometimes hit. That explains it. The accuracy byte is used, it's just that the values aren't shown in game due to that programming glitch I mentioned above. With this in mind, I prepared this table with the correct accuracy percentages from the executable:

 

				Wrong	  Right
Weapon		   Acc.	   Acc.
Stingray		 70%		70%
Avalanche	   100%		80%
Cannon		   10%		25%
Fusion Ball	 230%	   100%
Laser Cannon	 70%		35%
Plasma Beam	 140%		50%

Some pretty big differences, eh? I'm happy that the Fusion Ball Launcher is actually 100% instead of the confusing 230%. And so much for the idea that the Plasma Beam is more accurate than the Avalanche. :)

 

Edit: seems I was a bit late in reporting this. Still, I did play a role in that a little. :)

 

- Zombie

Link to comment
Share on other sites

I believe the game does random rolls with those accuracies, which explains the misses with the fusion ball's 100% accuracy. Either a random number between 0 - 100% or 50% - 150% as per the norm?

 

As for the accuracy of the Plasma Beam-v-Avalanche, the plasma beam just looks more accurate because it gets many attempts to suceed whereas the Avalanche only gets a few tries. Like the Cannon. It only hits 1/4 of the time, but it gets so many tries in so little time. It's an illusion of sorts.

 

- NKF

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...