Jump to content

Finding the first step?


NephilimNexus

Recommended Posts

This games internal structure is so messed up and dirty with data leftovers, that I feel like we are digging in dystopian barrens here(in the shadow of a grand, ultra-hightech sci-fi megasprawl; Redmond Barrens in Shadowrun´s Seattle anyone?).
Link to comment
Share on other sites

  • Replies 229
  • Created
  • Last Reply

Top Posters In This Topic

Well, I unpacked XComGame and went into XGTacticalGameCore and found the Base XP function listed on the previous page. The 1.25 and 1.00 are definitely stored as floats. I found those in the decompressed XComGame.upk and changed them both to 10. I then ran the game with the edited upk (after changing the SHA-1 in the .exe) and started a new game. I didn't see any difference. 2 of my troops each got 2 kills and only ranked up once. There's another flat XP calc function as well... I may try to edit that. So just for this one example there is a constant and 2 different functions, neither of which use the constant. Any of which could be what it's actually using. This is why heavy mods without recompiling are going to be rough. :facepalm:

 

UPDATE: GetBetterAlienKillXP stores its return values as single bytes chars... This means max of 255 XP per kill. Not sure that will be noticeable. BTW... each soldier gets a bonus of 20 XP apparently if no one dies.

Edited by Lethargus
Link to comment
Share on other sites

2 of my troops each got 2 kills and only ranked up once.

 

Well, there may be code in a function somewhere that makes sure a soldier can only get promoted once per mission. Not unreasonable :D

 

 

The council missions often result in being given an experienced soldier... who you have to level up "manually", so I there may be a system in place for handling multiple level-ups for a block of XP.

Link to comment
Share on other sites

2 of my troops each got 2 kills and only ranked up once.

 

Well, there may be code in a function somewhere that makes sure a soldier can only get promoted once per mission. Not unreasonable :D

 

You are correct... it's in XGBattle and if you have enough XP to get 2 levels, it gives you 1 level and sets your XP 1 shy of the next level. Looks like it was a lazy programming method to make sure you could never level past Colonel accidentally. Off to dinner and then back to look for something more obvious to edit for proof of concept...

 

UPDATE: Success. It may not seem like much, but it's confirmation this process works to change in game code.

In XComGame.upk, class XGTacticalGameCore, function RollForHit

function bool RollForHit(float fChance, out TCharacter kShooter, out TCharacter kTarget, out float fRoll)
{
fRoll = class'XComEngine'.static.SyncFRand(string(Name) @ string(GetStateName()) @ string(GetFuncName()));
return fRoll <= fChance;
}

I changed to

function bool RollForHit(float fChance, out TCharacter kShooter, out TCharacter kTarget, out float fRoll)
{
fRoll = class'XComEngine'.static.SyncFRand(string(Name) @ string(GetStateName()) @ string(GetFuncName()));
return fChance <= fChance;
}

and on the first shot fired it caused the game to crash. Must be something about how it compares memory values. So then I tried changing it to:

function bool RollForHit(float fChance, out TCharacter kShooter, out TCharacter kTarget, out float fRoll)
{
fRoll = class'XComEngine'.static.SyncFRand(string(Name) @ string(GetStateName()) @ string(GetFuncName()));
return fRoll != fChance;
}

which should mean almost every single hit always hits. Sure enough... it works. Every shot fired hits the target. It makes the game harshly brutal but proves more is possible. The hard part is finding the code segment the game uses that you want to edit. I also tried editing the LevelUpStats function to always give 100 Will per rank up. It didn't seem to work. So something that seems like an obvious code location isn't always correct.

Edited by Lethargus
Link to comment
Share on other sites

and on the first shot fired it caused the game to crash. Must be something about how it compares memory values.

 

Man, that sucks. I thought that would work, too.

 

Well I did get almost exactly the same effect in the end. This just makes me sad I can't do what I really wanted... I had hoped to implement a script to allow one character to use the items of a downed character they're on (to get around the whole "my only support is critical and no one can heal" thing) but with only simple script edits that's not looking likely.

 

On the up side you can probably tweak the AI a little with simple edits. I think I'm going to look into getting rid of their free scurry to cover move.

 

EDIT: Seems my x10 XP multiplier was working as well. I forgot I left that in and my troops were all ranking up after each mission regardless of their old rank. Had a Colonel with only 4 kills thanks to gaining group XP for doing so well in a mission.

Edited by Lethargus
Link to comment
Share on other sites

Trying to edit the binary compiled script is seriously rough...

 

else
{
	kSoldier.kAppearance.iGender = ((Rand(3) == 0) ? 2 : 1);
}

 

compiled is

 

06 01 02 0F 35 27 0E 00 00 29 0E 00 00 00 00 35
32 0E 00 00 3D 0E 00 00 00 01 00 3A A4 00 00 45
9A A7 2C 03 16 25 16 02

 

The 2C 03 16 25 16 is the magic area. The 2C is the offset for rand(), 03 is the seed (changing that to 00 means all troops are always female (tested and confirmed)), but the 16 25 16 is some sort of byte packed structure I can't wrap my brain around. The 25 changed to a 26 makes the code (Rand(3) == 1) but 35 seems to reference some completely different function in some other class entirely. It's beyond me. You'd have to create some sort of custom UnrealScript decompiler specific to XCom or something. These types of packed structures seem to be everywhere I want to change something and I just can't figure them out. Anyone else taking a look at the compiled script?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...