Jump to content

Editing armor attributes for soldiers.


Zombie

Recommended Posts

Not sure if this has been found before but I was fooling around in the executable for UFO Defense on the PSX a bit the other day and happened across a set of values which looked strangely familiar. It looked like armor stats. So off I went to my CE version to test it out. Editied basic body armor (actually no armor) to have 100 all-around protection, saved the changes under a different name and restarted the game using the edited exe. On the first mission I checked my soldiers. Yup, they all had 100 armor! :)

 

Now for the particulars. (Remember: this is only for the Collector's Edition). Open the executable with 100 for a column width. Scroll down to line 4733. Columns 77-86 is basic armor, 87-96 is Personal Armor, column 97 (line 4733) to 6 (line 4734) is the Power Suit and 7-16 (still line 4734) is the Flying Suit. There is a space between each attribute, hence why each field has a range of 10. ;)

 

- Zombie

Link to comment
Share on other sites

Troops without X-Com manufactored armor wear kevlar.

 

What's this about a range of 10? Isn't that rather small? ;)

 

Edit: Ah, I get it - Five armor sections per suit, times two bytes each, makes a range of ten bytes. I thought you were referring to the range of each armor attribute.

Link to comment
Share on other sites

Exactly. Take for example the kevlar armor. It starts at column 77 and goes to 86.

 

77 = Front Armor (12)
78 = space
79 = Left Armor (8)
80 = space
81 = Right Armor (8)
82 = space
83 = Rear Armor (5)
84 = space
85 = Under Armor (2)
86 = space

 

86-77+1 = a range of 10. ;)

 

- Zombie

Link to comment
Share on other sites

Heh, looksie what I found in the TFTD CE executable last night. You guessed it: the armor values! :)

 

Same deal as before, open the executable with 100 column width. Armor attributes reside in line 5178 starting at column 33.

 

33-42 = No Armor

43-52 = Plastic Aqua Armor

53-62 = Ion Armor

63-72 = Magnetic Ion Armor

 

Finding these numbers were rather easy since I already knew the general location of where to look. It didn't hurt that the "no armor" values match between EU and TFTD. Enjoy! ;)

 

- Zombie

Link to comment
Share on other sites

It is indeed amazing how much stuff you can find in this game - if you know what values to look for. I'm stating the obvious here, but having related values on hand make it easy to identify what you're looking at each time you search through the file.

 

For those interested: If you're keen on finding larger values, like your starting cash, weapon buy/sell prices, etc, don't forget that they're words(16-bit) or double words (32-bit), and are stored in little endian format.

 

A rifle's what? $3000 purchase, right? That's 0x0bb8. In little endian, you'd be looking for b8 0b (184 and 11). Sell price is $2250, or 0x08ca - in little endian that's ca 08 (202 and 8). They may actually be stored in doubles, so I'm missing four 0's after each value, but this shouldn't matter with such small values.

 

You should be able to find both values after about maybe several attempts (allowing for the executable stub and maybe other data that may have similar values).

 

Great way to make mods of new weapons and change their buy/sell prices accordingly, eh?

 

- NKF

Link to comment
Share on other sites

Kick a$$. This was what I wanted to know. But, I have some questions:

 

Which .exe are you editing?

What program are you using to hex edit it?

Is this with or without using XcomUtil on your game beforehand?

 

I'm decent at the ol' hex, but I don't know what programs people use now adays.

Link to comment
Share on other sites

Which executable? There is only one executable in the CE (Collector's Edition or Gold)version. It's either UFO Defense.exe or Terror from the Deep.exe.

 

What program? Good old MS Edit. Works like a charm.

 

I only use XComUtil when I fire up Bomb Bloke's logger. For research, I always use an orphaned copy of the executable so other outside programs can't screw it up. ;)

 

- Zombie

Link to comment
Share on other sites

  • 7 months later...

I've tried following Zombie's directions - running command.com under WinXP then in C:\ufo

 

running edit /100 UfoDefense.exe.

 

I copy pasted the characters for the flying suit armor values over on top of the values of the power suit (I don't like using the flying suit but it has better armor values!).

 

When I started a new game, the UFOpedia still had the old values for the power suit when I research it.

 

Does that just mean that the armor values aren't linked directly to the UFOpedia entry?

 

Or have I screwed up and failed in my attempted changes?

Link to comment
Share on other sites

Let's do this step-by-step, shall we?

 

Before we begin, are you using the CE version of the game?

 

All-righty, open up a command prompt. Type "edit" then enter. MS-Edit should now be open. Under FILE, select OPEN, then navigate your way to the UFO directory. Highlight "UFO Defense" on the left side, then checkmark the Open Binary box on the right. Now change Line Width to 100.

 

Half the battle is over, but this is where I differ from some. Instead of overwriting, I delete the unneeded characters/symbols and then replace them manually. I find this method easier to keep track of unwanted deletions/additions which will screw up the exe. (If you make a mistake, it's better to start over rather than hoping for the best). Each armor attribute is two bytes in length, so leave those zeros in place. Go about your editing, then when you are comfortable that you didn't screw anything up, click on FILE, then SAVE. That should be it. Start a new game with the edited executable and you should see the changes on your first combat mission.

 

Ok, I'm pretty sure you got the editing part down just fine. Like you said, it's just that those values aren't updated in the UFOPaedia. Not sure where else they could be, but one of these days we'll find them. Until then, just trust me and go on a mission. :(

 

- Zombie

Link to comment
Share on other sites

If you're using the CE version of UFO and using the XCOMUTIL split executables, don't forget that you have to edit the correct file for the armour values to show up correctly. So, to be safe, edit BOTH files. They're identical copies of each other, so the offsets will be the same, so no worries there.

 

- NKF

Link to comment
Share on other sites

Or, if you are using xcomutil, grab a copy of Bomb Blokes executable splitter/merger in our Files section. Merge the split executables together, edit the armor in the merged exe, then split it apart again. That'll save you a couple of steps (just make sure to rename them to what they were called before). Quite a handly little tool, one which I use quite often. :(

 

- Zombie

Link to comment
Share on other sites

Hi, thanks for the help guys. I am using Xcom CE and xcomutil.

 

After editing UFO Defense.exe then copying it twice and renaming to tactical.exe and geoscape.exe I found that the entry for the Power Suit in the UFOpedia did in fact update to the new values (110, 90, 90, 80, 70).

 

However I think simply copying UFO Defense.exe and renaming it did away with a lot of the xcomutil changes. So I guess I can either try using that splitter/merger or just run XcuSetup again to get my xcomutil changes re-implemented.

 

Anyway, cheers guys.

Link to comment
Share on other sites

IIRC, when you install XComUtil it takes the UFO Defense executable and splits it into Geoscape.exe and Tactical.exe. It leaves UFO Defense.exe alone.

 

So let's say you edit starting armor attributes in UFO Defense and then run the game via XComUtil. XComUtil only uses the split executables so the changes wouldn't show. You would have to edit both Geoscape and Tactical. The reverse also holds true. If you edit the split executables, the changes wouldn't be made to UFO Defense. In order to see the changes when you run the game with UFO Defense you would need to recombine the split executables again. BB's splitter/merger is perfect for this chore. :(

 

- Zombie

Link to comment
Share on other sites

The Tactical.Exe and Geoscape.Exe files were originally used in the Dos version of the game, but were somewhat "hidden" in the CE edition.

 

As XcomUtil still needed them, it created them out of the "UFO Defense.Exe" file. The resulting two files are the same size as the original, but are modified to specifically only run their respective game engine when executed. XcomUtil from then on ignores the original and uses the files it created.

 

In this case, you only really need to make your changes to the Geoscape.Exe file, as units in the battlescape aren't created by the Tactical.Exe file.

Link to comment
Share on other sites

  • 4 months later...
I'm using MS edit on the exe, but all I'm seeing are really odd symbols (spades smilies, etc) On the bottom line it tells me the value of each symbol which is all fine and dandy...but how do I change those symbols? I don't have any idea how to type them, much less know which symbol means what.
Link to comment
Share on other sites

The symbols are the ascii representation of the value that you see in the right hand corner. More often than note, you want to ignore the symbols what you see on screen unless you're editing a string. Getting to know the symbol however does allow you to recognise other instances of it in the rest of the file.

 

The trick to entering binary values include:

 

- If you're just starting out editing with MS-Edit: Make sure you're in overwrite mode. That is to say, press insert to get the block cursor. This way you can write over the value under the cursor and not shift the entire row across. This can lead to disaster if you forget to correct this when you save.

 

- To enter most values, hold down alt and type in three numbers on the numeric pad. Say you wanted a value of 201, you'd type alt+201. This works for most values, except some lower values around 0 - 25 or thereabouts.

 

- To enter a 0, type ctrl+p+2. I have no idea why this works, but it does.

 

- To enter values 1 - 25, type ctrl+p+alphabet letter that corresponds to the number you want. For example a = 1, b = 2 , c =3, d = 4, etc.

 

- Any values that are already present in the file can be copy and pasted. Easiest way to get the lower values that can't be entered with the alt+3 key combo.

 

- If the value you want has a symbol that's available on the keyboard, you can type that in directly. For example, a @ has a value of 64, d has 100, etc.

 

This should help get you started working on all the byte values.

 

- NKF

Link to comment
Share on other sites

Larger values? If you have an understanding on how 16-bit and 32-bit integers are stored, you're all set. They're just stored in reverse. If not, read on:

 

Well, most values in the game are bytes, but there are words and dwords. Bytes are easy to work with since they only range between 0-255. Larger values are a bit harder and require a bit of conversion to hexadecimal (or binary) to assist split the larger value down into smaller bytes.

 

Let's take a value of 2500 that is to be entered into a 16-bit integer (i.e. 2 bytes). We convert this into hexadecimal and we get 0x9c4. We even the numbers up by adding a 0 on the front to get 0x09c4.

 

Each pair of numbers in hexidecimal make up a single byte. So if we split them into their respective bytes 09 and c4. 09 the high byte and c4 is the low byte. In the files you want edited, they'll be stored in the little-endien format, where the low byte comes first then the high byte. So what you want to enter is c4 then 09. Or in decimal, 196 then 9.

 

Did that make any sense?

 

- NKF

Link to comment
Share on other sites

Armor attributes are stored in 16 bit format (meaning 2 bytes long). The first byte is the low bit (numbers up to 255) and the second byte is the high bit (numbers greater than 255 and less than 65536). Usually, if you see a number in the executable with one null character directly after it, it means it is a 16-bit number. Editing the high bit will increase armor by a multiple of 256 for every number you increase it. However, since armor is stored in a single byte in a mission file, the cap is always 255 no mattter what you edit into the second byte in the exe. :)

 

If you don't like to fool around with hexidecimal, you can do it all in decimal (base-10). In NKF's example, say you want to change armor to 2500. Simply divide 2500 by 256. The answer is 9.765625. The high bit would thus be a value of 9. The low bit would be either (0.765625 * 256) or [2500 - (9 * 256)], depending on your calculation preference. So the low bit would be 196. Same answer, but easier to visualize and calculate.

 

32 bit values follow the same format except they are 4 bytes long (arranged low to high). Byte 1 is values up to 255, byte 2 is values from 256 to 65535 (2^16-1), byte 3 is values from 65536 (2^16) to 16,777,215 (2^24-1) and byte 4 is for values 16,777,216 (2^24) to 4,294,967,295 (2^32-1). The max value of each byte is always 255 which creates some havoc when trying to determine the value of a 32-bit number, but it is pretty straight-forward to calculate it out. Hope this helps! :)

 

Late Edit: Upon closer inspection, you are probably only using hex so this wouldn't be any help. Ah well. For those of us who don't like working in hex, it should come in handy at least. :)

 

- Zombie

Edited by Zombie
Link to comment
Share on other sites

For some reason, everything makes more sense to me in hex :-P I can understand numbers and letters...symbols and all that math make my brain hurt ><

 

On a similar subject, has anyone found the armor, or for that matter any other, location for aliens and civilians in TFTD CE? I was looking on the Wiki; they seem to have the UFO CE, but not TFTD, and the ref they have for TFTD is most definitely not it for CE...in the CE exe it's a bunch of text related to bigob.dat and stuff.

Link to comment
Share on other sites

I went to 480930, and it's nothing but 0's and the occasional 1. It does that for a good 2 or 3 lines.

 

Also, I wasn't asking for the armor values for soldiers, I already knew where they were thanks to that same post. I was asking for the location of armor for aliens and civilians, as well as the rest of their stats. I've used xc2me2 to edit the aliens, as it seems to line up fine, but whenever I get into a tactical battle with whatever I edited, the game hangs.

Link to comment
Share on other sites

I went to 480930, and it's nothing but 0's and the occasional 1. It does that for a good 2 or 3 lines.

 

Also, I wasn't asking for the armor values for soldiers, I already knew where they were thanks to that same post. I was asking for the location of armor for aliens and civilians, as well as the rest of their stats. I've used xc2me2 to edit the aliens, as it seems to line up fine, but whenever I get into a tactical battle with whatever I edited, the game hangs.

Apologies, I think I gave you the location for the DOS executable of TFTD. :) Anyhow, TFTD alien stats start at 570,905 (this is assuming the first byte of the exe starts at 1, if you prefer to start at 0, simply subtract 1). Look for a string starting with 13,7,2,1,62,120. That is the Hallucinoid. The other aliens are as follows:

 

Hallucinoid Terrorist
Calcinite Terrorist
Xarquid Terrorist
Deep One Terrorist
Tentaculat Terrorist
Bio-Drone Terrorist
Triscene Terrorist
Aquatoid Soldier
Aquatoid Squad Leader
Aquatoid Technician
Aquatoid Medic
Aquatoid Navigator
Aquatoid Commander
Gill Man Soldier
Gill Man Squad Leader
Gill Man Technician
Gill Man Commander
Lobster Man Soldier
Lobster Man Squad Leader
Lobster Man Technician
Lobster Man Navigator
Lobster Man Commander
Tasoth Soldier
Tasoth Squad Leader
Coelacanth
Civilian1 (Male)
Civilian2 (Female)
Displacer

IIRC, xc2me2 only is able to edit alien stats in the DOS version (not the CE). That could be why your game crashes. :)

 

- Zombie

Link to comment
Share on other sites

"IIRC, xc2me2 only is able to edit alien stats in the DOS version (not the CE). That could be why your game crashes. "

 

Yeah, probably :-) The thing is, all of the stats are correct. I compared them to the DOS version, and everything matched up. Meh, whatever. Thanks for the info, I'll start working on the aliens soon :-)

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...