modding initial stats


  • Please log in to reply
11 replies to this topic

#1 slickrcbd

slickrcbd

    Squaddie

  • Members
  • Pip
  • 10 posts

Posted 25 March 2014 - 01:18 PM

Does anybody know where I can modify the values for the initial stats of new soldiers? I can work a hex editor, but I'm unsure where to look.

I'm just thinking that for anti-frustration, I'd like to swap the initial stat ranges for throwing and reactions. So that reactions have an initial allocation of 50-80 while throwing is 30-60.
After all, it is so much easier to raise throwing, and while a starting soldier with 30-32 reactions almost never reacts even when kneeling with a pistol or dart gun at full TU, making it almost useless, a soldier starting with a mere 50 throwing can still reliably get grenades under the target, and is almost never more than one square off, making the stat in general almost useless.
Having to start with 30-60 might decrease the accuracy enough that training rookies might be necessary, but I haven't done enough experimenting with wounded soldiers to be sure.

Plus, it raising throwing stats is the easiest to do, and I do it anyway as often when milking a base for money or ammo I have everyone throwing all the junk the aliens drop through the ceiling into the "green room" before bugging out.

Also, if the firing accuracy is in the 40-range, I tend to make that rookie a grenadier and give him some type of pistol, plus as many human grenades as he can handle in order to gain experience. Even against mutons or etherals (especially against etherals until he proves resistant to MC he gets a starter pistol and grenades, unless I have flying suites, when he gets a laser pistol). He can always grab a plasma off a dead alien).

So, can anybody help me pull this off for the Windows CE version of X-COM 1 & 2? I'm not sure where to search or what to search for, as I couldn't find it looking for the minimum values.

#2 Tycho

Tycho

    Lieutenant

  • Project Staff
  • PipPipPipPip
  • 703 posts
  • Gender:Male

Posted 25 March 2014 - 03:25 PM

The stats are set starting from 0x436F2D.

#3 slickrcbd

slickrcbd

    Squaddie

  • Members
  • Pip
  • 10 posts

Posted 26 March 2014 - 08:15 AM

What file? UFO Defense.exe is only 0x79000 bytes long. Terror From the Deep.exe is only 0x8F000 bytes.
You have an extra digit there.

#4 Tycho

Tycho

    Lieutenant

  • Project Staff
  • PipPipPipPip
  • 703 posts
  • Gender:Male

Posted 26 March 2014 - 09:11 AM

Sorry.  if you're using a simple hex editor the address will be less the 4 at the start.  I use IDA which shows the program loading into the memory ref at 0x40000.  I tend to forget that.

#5 slickrcbd

slickrcbd

    Squaddie

  • Members
  • Pip
  • 10 posts

Posted 26 March 2014 - 12:16 PM

I'm sorry, but I'm not making much sense of these values. At least not related to stats.
I'm a bit rusty at modding, but figuring out how to change the stats in soldier.dat was easy even without the guides online. This I can't make heads or tails of.

Perhaps the offset is wrong because I'm using the Windows CE version?

Attached Thumbnails

  • modstats.JPG


#6 Tycho

Tycho

    Lieutenant

  • Project Staff
  • PipPipPipPip
  • 703 posts
  • Gender:Male

Posted 26 March 2014 - 03:03 PM

View Postslickrcbd, on 26 March 2014 - 12:16 PM, said:

I'm sorry, but I'm not making much sense of these values. At least not related to stats.
I'm a bit rusty at modding, but figuring out how to change the stats in soldier.dat was easy even without the guides online. This I can't make heads or tails of.

Perhaps the offset is wrong because I'm using the Windows CE version?
You're looking at programming code in assembly. It's not like a DAT file format.  Here is some of the reverse assembled code using IDA for that section starting at 0x36F57: (The sGetRandomNum_43D850 is my notation not the standard output of IDA)

mov     [ebp+0], ax
mov     [ebp+2], dx
mov     [ebp+4], dx
mov     [ebp+6], dx
mov     [ebp+29h], al
mov     [ebp+8], ax
mov     [ebp+0Ah], ax
mov     [ebp+0Ch], ax
call    sGetRandomNum_43D850
add     al, 32h
push    0Fh
mov     [ebp+2Ah], al
call    sGetRandomNum_43D850
add     al, 19h
push    1Eh
mov     [ebp+2Bh], al
call    sGetRandomNum_43D850
add     al, 28h
push    1Eh

#7 slickrcbd

slickrcbd

    Squaddie

  • Members
  • Pip
  • 10 posts

Posted 26 March 2014 - 05:28 PM

Thank you for the help.
That explains it. I was looking for the data section, not code. I might need to ask for more help as I never learned 8086 assembly. I can understand 6502/65C02/65C816 assembly on the Apple II computers, and I did have one semester of IBM Assist Assembly on mainframes back in the 2000/2001 school year before dropping programming in favor of a more tech support and network administration curriculum, but I never got around to learning Intel.
Your mnemonics are unfamiliar to me, as both Assist (which I haven't used since that one semester) and 6502 family use different mnemonics. However, I think I can infer enough. Please bear with me as I've only been moding games by changing data files for the last ten years. I'm way out practice, I haven't done any real programming besides batch files, scripts, and the link in over fifteen years, and that was either using QBASIC or C, and I never learned to make GUIs except with Visual BASIC 6.
I'm just establishing my skill level as I though I'd be modifying a data table/section like with alien stats.
From what you disassembled, assuming I'm interpreting the mnemonics correctly, I should just search for the first occurrence of 0x1E and the second  0x32 and swap the numbers to swap the base reactions and throwing. A bit of trial and error and I should be able to figure them out using these two links as guides, since it seems to go more in the order of soldier.dat rather than the in-game display.
http://www.ufopaedia...=Starting_Stats
http://www.ufopaedia...tle=SOLDIER.DAT


Sorry for been "needy", I never was much of a programmer. I have some obsolete 20th century knowledge (probably not so bad for X-COM), and about a year of community college on a programming track, but that's about it.

Here's the change I made
36fc4 32->1e
36f96 1e->32
Seems I got the throwing skill lowered, but I still got some reactions in the 30's range when I started a new game and looked at the initial soldiers in EU.  I have to leave the computer again, but I'll try some of the other instances of 0x1E and see if it works or not and report back later tonight. Thank you for giving me a start.


BTW, do you happen to know where the offset is for the same thing in TFTD? I looked for the first 8 bytes hoping it was duplicated, but it didn't work, probably because of different offsets.

#8 Tycho

Tycho

    Lieutenant

  • Project Staff
  • PipPipPipPip
  • 703 posts
  • Gender:Male

Posted 28 March 2014 - 09:30 AM

your not reading this correctly.  The 'push' command puts the data onto the stack.  When listed before a 'call', it usually is passing the information to the subroutine listed on the 'call' .   Any routine that generates a number, that number is returned through eax (ax or al).  I hope this helps.  I currently don't have the information on the Terror offsets.
As as example, from the above:
call sGetRandomNum_43D850
add al, 32h
push 0Fh
mov [ebp+2Ah], al
Some number was sent to the Random generator (the line with the value is prior to the exampled posted). The result is returned through eax (or its single byte value, al).  0x32 is added to this.  The total is then stored in the offset located at [ebp+2Ah].

#9 slickrcbd

slickrcbd

    Squaddie

  • Members
  • Pip
  • 10 posts

Posted 29 March 2014 - 12:47 PM

Without fully comprehending it, I managed to kludge together something that worked before you replied back, then I went to bed.

I'm sorry for taking so long to get back. I started feeling ill later that same day.
I've been having some health problems and was actually scheduled to goto the hospital for some tests.
They STILL haven't gotten back to me with the results that were supposed to be in Thursday afternoon, but were not there Friday morning even though the doctor's office promised to call me back. I should have called them back right before they went home for the weekend, but I'll have to wait until Monday.

Anyways, I didn't fully figure it out, but by changing multiple 0x1E's to 0x32's, I managed to do a bit of overkill. I seem to be getting reactions scores 50-90 instead of the desired range, but its close enough. Raising reactions without "laser pistol gifts" is a pain anyways, and it's easy enough to raise the secondary stats via accuracy that I'm not worried about the loss of training from raising reactions because they start too high.  

I also found that I made a mistake when trying to find the equivalent code in TFTD, and did indeed locate the proper code and managed to implement the same changes in TFTD.  It is not exactly what I wanted, but it is close enough that I'm satisfied. I now get lower initial throwing stats and higher reactions. The reactions are a bit higher than I'd like, but I find it good enough.

Thank you for all the help. I really appreciate it.
Should I post a log of the exact changes with offsets so that others can follow how to do them?

#10 seregavlg

seregavlg

    Squaddie

  • Members
  • Pip
  • 6 posts

Posted 27 May 2014 - 08:06 AM

Should I post a log of the exact changes with offsets so that others can follow how to do them? -   please post your offsets

#11 slickrcbd

slickrcbd

    Squaddie

  • Members
  • Pip
  • 10 posts

Posted 05 January 2015 - 10:27 PM

Sorry, somehow the alert for this got misfiled in my e-mail box without me ever reading it. I think I clicked on the wrong e-mail when I told it to file it away, or accidentally selected two e-mails.
I didn't notice that there was an additional post.

Now I have no recollection at all what offsets I made. This is the result of using the old MS-DOS  "comp" command built in to Windows. Do you have any suggestions for a program that can compare my modded game to the original and report the changed bytes? I thought comp did what I needed, but maybe not.
I also did a few changes to tanks as well, so it will show up in the output.
C:\Program Files\MicroProse\X-COM Collector's Edition\UFO Defense>comp "original
_ufo_defense.exe" "ufo defense.exe" /d /l /c
Comparing original_ufo_defense.exe and ufo defense.exe...
Compare error at LINE 1920
file1 = 30
file2 = 50
Compare error at LINE 1920
file1 = 30
file2 = 50
Compare error at LINE 1920
file1 = 30
file2 = 50
Compare error at LINE 1920
file1 = 30
file2 = 50
Compare error at LINE 1920
file1 = 50
file2 = 30
Compare error at LINE 3423
file1 = 60
file2 = 66
Compare error at LINE 3423
file1 = 60
file2 = 75
Compare error at LINE 3423
file1 = 33
file2 = 30
Compare error at LINE 3423
file1 = 0
file2 = 60
Compare error at LINE 3423
file1 = 0
file2 = 33
10 mismatches - ending compare

Compare more files (Y/N) ? n
n


#12 slickrcbd

slickrcbd

    Squaddie

  • Members
  • Pip
  • 10 posts

Posted 05 January 2015 - 10:43 PM

Nevermind, I was right about FC in the first place, I was just so used to using it for ASCII comparisons.
There were so many differences that they scrolled off the screen. I instead redirected to a text file.
Some of these were a few changes I made to the tanks and to the avalanche missiles. I know I increased the number of missiles to 4 to compensate for that bug of the last one missing.
Anyways,
Comparing files Original_UFO_Defense.exe and UFO DEFENSE.EXE
00036F8A: 1E 32
00036F96: 1E 32
00036FA0: 1E 32
00036FAE: 1E 32
00036FC4: 32 1E
0006D580: 3C 42
0006D582: 3C 4B
0006D584: 21 1E
0006D586: 00 3C
0006D588: 00 21
0006D58A: 5A 6A
0006D58C: 50 3C
0006D594: 55 73
0006D596: 37 3C
0006D5A0: 4B 33
0006D5AA: 32 3C
0006D5AC: 21 14
0006D5AE: 00 32
0006D5B0: 00 21
0006D5B2: 55 5A
0006D5BC: 6E 82
0006D5C2: 00 32
0006D5C4: 00 24
0006D5C6: 64 6E
0006D5D0: 8C F0
0006F9AC: 00 01
0006F9CA: 1C 89
0006F9CB: 0C 13
0006F9CE: 1E 28
0006FA02: 34 99
0006FA07: 03 05
0006FB32: 03 04
0006FB36: 03 04
0006FB3E: 0A 14
0006FB5A: 02 06
0006FB62: 15 1A
000738C2: 05 55
000738C4: 02 82
000738DA: 6E 91
000738DC: 5A 82
000738DE: 5A 82
000738E0: 50 64
000738E2: 46 5A


I'm pretty sure the only relevant changes were here.
I'm not 100% positive, but I'm 99% certain that the moding described in this thread was all in the same area, so those are the only changes I made.
00036F8A: 1E 32
00036F96: 1E 32
00036FA0: 1E 32
00036FAE: 1E 32
00036FC4: 32 1E





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users