Jump to content

R&D on four enhancements


johnnylump

Recommended Posts

Figuring out the code for m_kInterception.m_arrInterceptors[0].m_iConfirmedKills was rather complex, so I may have made a mistake there, although it looks OK in UE Explorer. Please, if anyone has any ideas where I went wrong, let me know! (I can post the original function here, if that would help any -- I took my bytes from a long section that appeared to only matter if multiple interceptors were attacking the same UFO, which is apparently a disabled feature.

Link to comment
Share on other sites

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

I think you want something like this:

I = 2 * kInterception.m_arrInterceptors[iShip].m_iConfirmedKills;
I += akShipWeapons[iWeapon].iToHit;
if(Rand(100) <= I)
{
    kCombatExchange.bHit = true;
    kCombatExchange.iDamage = (GetShipDamage(akShipWeapons[iWeapon], kCombatExchange));
}

This should give a 2% increase in the chance to hit, for each confirmed kill by that interceptor.

If you post just the bytes (as opposed to "Dump Hex" which includes the offsets and ASCII) for the whole function and the offset where the above code is located, I'll try and have a look. Just makes it easier to copy/paste into a hex editor instead of deleting all the ASCII etc. and hunting down the offset for the relevant bytes :smile:

I often find that only making one change at a time helps a lot to identify what's causing the problem because there might be multiple errors and you won't know if you've fixed one part, but another part is still causing the crash :smile:

Link to comment
Share on other sites

Update I've made some changes and have a verified working function Updateweapons, until I add this line:

I = 2 * m_kInterception.m_arrInterceptors[0].m_iConfirmedKills;

 

which crashes the game on startup. (I've checked jumps and virtual size, and they're OK.)

 

Hex for this line is:

 

0f 00 29 34 00 00 90 24 02 19 10 2c 00 19 01 dd

0b 00 00 09 00 ec 33 00 00 00 01 ec 33 00 00 09

00 0f e3 00 00 00 01 0f 3e 00 00 16

 

Breakdown of code

0f 00 29 34 00 00 90 24 02 Let i = 2 * (this part is OK)

 

 

19 Context Token

10 2c 00 index [0]

19 Context Token

01 dd 0b 00 00 09 00 ec 33 00 00 00 kinterception

01 ec 33 00 00 09 m_arrinterceptors

00 0f e3 00 00 00 01 0f 3e 00 00 m_iconfirmedkills

16 close paren

 

I think something may be wrong in how I'm setting up the variable reference, but I'm not sure what -- it was a lot of trial and error to get it to appear correctly in UE. (One thought: Should I be using 35 (structmembertoken) somewhere instead?

Edited by johnnylump
Link to comment
Share on other sites

Whole function:

30 34 00 00 ab 1f 00 00 00 00 00 00 26 34 00 00 00 00 00 00 00 00 00 00 30 34 00 00 00 00 00 00 a1 00 00 00 fa 11 00 00 6a 05 00 00 96 03 00 00 0f 00 2b 34 00 00 25 07 1f 04 96 00 2b 34 00 00 1b df 0f 00 00 00 00 00 00 16 16 0f 00 2c 34 00 00 1b 35 10 00 00 00 00 00 00 00 2b 34 00 00 16 19 00 2c 34 00 00 13 00 00 00 00 00 00 1b 2c 2c 00 00 00 00 00 00 00 30 34 00 00 16 07 83 00 81 1b 14 14 00 00 00 00 00 00 00 2b 34 00 00 16 16 06 11 04 0f 00 2e 34 00 00 19 00 2c 34 00 00 0a 00 ae 3d 00 00 00 1b 91 10 00 00 00 00 00 00 16 0f 00 2a 34 00 00 25 07 11 04 96 00 2a 34 00 00 36 00 2e 34 00 00 16 07 03 01 9a 38 3a 35 a7 02 00 00 a9 02 00 00 00 00 10 00 2a 34 00 00 00 2e 34 00 00 38 3a 24 00 16 06 03 04 07 38 01 b1 10 00 2a 34 00 00 19 00 2c 34 00 00 09 00 76 3d 00 00 00 01 76 3d 00 00 1e 00 00 00 00 16 06 03 04 b8 10 00 2a 34 00 00 19 00 2c 34 00 00 09 00 76 3d 00 00 00 01 76 3d 00 00 35 a5 02 00 00 a9 02 00 00 00 00 10 00 2a 34 00 00 00 2e 34 00 00 16 0f 35 e3 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 00 2b 34 00 00 0f 35 e2 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 00 2a 34 00 00 07 50 02 9a 00 2b 34 00 00 25 16 0f 00 29 34 00 00 25 07 2f 02 81 1b c5 14 00 00 00 00 00 00 01 d4 0b 00 00 16 16 0f 35 e1 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 01 d4 0b 00 00 06 4d 02 0f 35 e1 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 26 06 dc 02 0f 35 e1 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 25 0f 00 29 34 00 00 90 24 02 19 10 25 19 01 dd 0b 00 00 09 00 ec 33 00 00 00 01 ec 33 00 00 09 00 0f e3 00 00 00 01 0f 3e 00 00 16 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0f 00 29 34 00 00 35 a1 02 00 00 a9 02 00 00 00 00 10 00 2a 34 00 00 00 2e 34 00 00 0b 07 8a 03 98 a7 2c 64 16 00 29 34 00 00 16 14 2d 35 e0 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 27 0f 35 df 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 92 1b 36 10 00 00 00 00 00 00 10 00 2a 34 00 00 00 2e 34 00 00 00 2f 34 00 00 16 a7 2c c8 16 16 06 c7 03 14 2d 35 e0 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 28 0f 35 df 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 25 0f 35 de 0b 00 00 e4 0b 00 00 00 01 00 2f 34 00 00 01 d9 0b 00 00 55 00 2d 34 00 00 0a 00 00 2f 34 00 00 16 a5 00 2a 34 00 00 16 06 b7 00 a5 00 2b 34 00 00 16 06 0b 00 0f 00 29 34 00 00 25 07 67 05 96 00 29 34 00 00 36 00 2d 34 00 00 16 07 a4 04 9a 35 e3 0b 00 00 e4 0b 00 00 00 00 10 00 29 34 00 00 00 2d 34 00 00 25 16 55 35 cc 0b 00 00 ce 0b 00 00 00 00 01 dc 0b 00 00 14 00 10 00 29 34 00 00 00 2d 34 00 00 16 06 d7 04 55 35 cd 0b 00 00 ce 0b 00 00 00 00 01 dc 0b 00 00 14 00 10 00 29 34 00 00 00 2d 34 00 00 16 07 59 05 2d 35 e0 0b 00 00 e4 0b 00 00 00 00 10 00 29 34 00 00 00 2d 34 00 00 a2 10 35 e1 0b 00 00 e4 0b 00 00 00 00 10 00 29 34 00 00 00 2d 34 00 00 01 db 0b 00 00 35 df 0b 00 00 e4 0b 00 00 00 00 10 00 29 34 00 00 00 2d 34 00 00 16 a5 00 29 34 00 00 16 06 2a 04 04 0b 53 00 00 00 02 00 82 00 2c 2c 00 00 00 00 00 00

 

(If you load it up, I know it won't actually add the bonus; this is an intermediate step)

Edited by johnnylump
Link to comment
Share on other sites

I can see what changing 2c 00 to 25 does, but what's the 78 3d do?

Actually, I think I made a mistake. 78 3D 00 00 is the object index for m_iHP instead of m_iConfirmedKills (0F 3E 00 00). In which case it would seem you had it right to begin with. Not sure why it didn't work before then :blink:

Link to comment
Share on other sites

Hrm, that's really strange given it still shows up correctly in UE and the game loads up. I wonder if that means those bytes are extraneous.

 

Unfortunately, when I try to add the calculated bonus "i" to the weapon's to hit value, I get an ingame crash as an interception begins. I used an

i += (hitvalue)

structure; I'm going to recode as an

i=i+(hit value)

and see if that works.

 

For the object/variable reference, nowhere do I see it made in one piece in XComStrategyGame, so I had to merge two references:

 

In XGInterceptionEngagement.Init

m_kInterception.m_arrinterceptors

19 10 00 12 34 00 00 19 00 14 34 00 00 09 00 ec 33 00 00 00 01 ec 33 00 00

 

In XGInterception.CompleteEngagement

m_arrInterceptors[I].m_iConfirmedKills

19 10 00 03 34 00 00 01 ec 33 00 00 09 00 0f e3 00 00 01 0f 3e 00 00

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...