Jump to content

X-COM EU Gold Edition: HWP Modding


armorfiend

Recommended Posts

I took the liberty of testing those offsets, here's the results:

offset 322858 is the # of rounds the tank/cannon gets in the battlescape.

offset 241450 is the # of rounds needed in stores to assign the tank/cannon to a squad.

 

None of these changed the number of rounds that were removed from the stores though, still needs more searching, but at least we're making progress. excellent work armorfiend! :blink:

Link to comment
Share on other sites

Man, you rock!

 

If you like, I found some other offsets to check.

my B-list offsets - these were the ones that didn't quite make it to the list I showed you earlier

29,392

40,474

49,142

49,850

61,773

301,345

470,570

 

my C-list offsets - pretty much anything that looked like I should check it for a pattern. There's really no rush to look at these.

7,303 10,506 11,568 17,273

20,185 22,489 27,774 29,683

36,322 50,647 51,708 52,363

52,860 59,246 61,871 62,788

70,506 79,878 84,966 86,482

89,450 97,920 108,968 115,672

129,765 132,217 133,752 141,443

154,999 211,407 264,795 430,424

 

*'s I no longer think likely, as I've seen them as part of other functions.

Link to comment
Share on other sites

Ok, since I had a general location where Tank Cannon rounds in battlescape are (thanks you guys), I found the Rocket Tank and Laser Tank rounds as well:

 

Tank				   Offset	   MS-Edit
Tank/Cannon			322858	   322959
Tank/Rocket Launcher   322864	   322965
Tank/Laser Cannon	  322870	   322971

Haven't found the Plasma Tank or Fusion Tank rounds yet. I'll try some more 255's around that area to see if there is an 8 around there too. If it follows the same format, those should hopefully be 6 bytes apart as well. :blink:

 

- Zombie

Link to comment
Share on other sites

very cool.

 

Looking at this, after setting my columns at 6 bytes, I'm pretty sure that their pattern goes like this:

 

[6 198 69 118 30 235] rather than startig at 198, but I'll test it to make sure.

 

edit:

holy weird crap, batman.

Setting the 6 to a 10 in that group, glitched my rocket tanks. Each time I took them to a new mission, they had the wrong number of rockets.

The first mission, they had 1.

The second mission, they had 14.

Third, 230(!!!)

Fourth, 220.

 

...so I have no idea what was going on, there. At a guess, the first digit there is saying 'give to tank X...' or something. No idea, really. Except it buggered the tanks. And they actually did have that many rockets; in the one, firing the single rocket reduced the tank to 0, and in the others, I was able to fire dozens of rockets.

Link to comment
Share on other sites

Looking at this, after setting my columns at 6 bytes, I'm pretty sure that their pattern goes like this:

 

[6 198 69 118 30 235] rather than starting at 198, but I'll test it to make sure.

I think the data actually starts at 322853 (322954 in MS-Edit) with a value of 117. When you change the 117 for the Tank/Cannon to 235 (Tank/Rocket Launcher), the Cannon only has 8 rounds (normal shells). When you edit the rocket tank to have a value of 117, there's no difference in ammo or shells. Odd stuff. Here's the revised table to show the start of the set:

 

Tank				   Offset	  MS-Edit
Tank/Cannon			322853	  322954
Tank/Rocket Launcher   322859	  322960
Tank/Laser Cannon	  322865	  322966

 

edit:

holy weird crap, batman.

Setting the 6 to a 10 in that group, glitched my rocket tanks. Each time I took them to a new mission, they had the wrong number of rockets.

These two numbers are might actually be one byte in little endian like before. Not sure how 1653, 2795 and 1259 tie into the game but it must point to something. Possibly it's the turret type or something. Then again, those numbers are quite high. They may be single one-byte values too. If we find the Plasma Tank and Fusion Tank, we can make a determination based on the group. :blink:

 

Since I figured out the ordering last night, I tried searching the executable with a string of 198, 69, 118 (these numbers are common to the first three tanks, so logic dictates the other two may share them as well). The only place where there may be a match is starting at around offset 326193 (326294 in MS-Edit). I tried editing the 255 and 8 nearby values but it didn't seem to do anything to the ammo quantity in-game. Maybe one of you guys could double check this. ;)

 

- Zombie

Link to comment
Share on other sites

Remember that some bytes represent raw data, while some bytes represent instructions for the computer to carry out. Some bytes are sorta like pointers. They might say "take this bit of data and stick it here". Changing that 6 to a 10 could well've resulted in taking some random bit of memory being dumped into the cannon's ammo offset.
Link to comment
Share on other sites

Good point. I guess I'm still focused on the game files where each byte is related to something data-wise, not instruction-wise. :blink:

 

Nevertheless, editing either of the first two bytes produces roughly the same effect. I'm almost positive it's a 2-byte variable for something. ;)

 

- Zombie

Link to comment
Share on other sites

Ah, but also keep in mind that UFO doesn't always bother to clean memory before using it (which leads to registry keys in your save files for eg). If you mess up the instructions that set the tank ammo, then that offset might get some random bit of data put in it... Or (and I now admit this is more likely then my first guess) it might not get changed at all. Whatever random bit of junk that was already in that space would stay there.
Link to comment
Share on other sites

Well, the curious thing was that setting the cannon tank's - or what I think is the cannon tank's- 6 to a 10, to match the rocket tank, left the cannon tank's ammo count still functional, while it screwed with the rocket tank.

 

I even set the ammo amount differently- I set it to 50, and that was reflected by the cannon tank, even while the rocket tank was still screwed up.

 

edit:

 

Okay, I'm looking at the values needed to load the craft.

I *think* I may have found the rocket tank at 241, 530. I'm trying it now.

nope.

 

edit again:

 

'198 69' shows up 153 times in the combined executable. I'm pretty sure it's an operation code of some sort, and not a code for 'load this on the dropship' - mostly because I don't think there are 153 different things to put ON a dropship, but even if there was one for each, I'm not even sure there are 51 things you can put on a dropship.

 

That said, the idea that we're looking at two-byte words seems reasonable. If we look at this as a two-byte address, an operation, and two bytes of information, then we'd want to know what that second to last byte is. The three ground-crawlers all have the same code- 118. But, 118 is also really common.

 

I think...

 

I think that 118 is actually some modifier to the 198 69 operation. If we cruise through 198 69 entries, we see that it has these values immediately following:

6, 10, 12, 14, 15, 24, 41-43, 51, 53-64, 66, 70, 80-85, 111-118. 111-118 are by far the most common, with the rest usually only being used twice- references to each other, perhaps?

 

bah. I feel like this information should tell me everything I need to know to find the next series, but I'm missing it.

Interestingly, 198 69 seems to show up mostly in 4-byte patterns, with its suffix run in sequence. (198 69 111, 198 69 112, etc).

Link to comment
Share on other sites

An update, since it's been a week:

 

Still haven't found any new useful values.

 

The more I tinker with the values I do have, the less certain I am that this is the right concept, that I'm moving towards. The greatly increased mobility of the tanks, while it does seem appropriate, means that they leave the infantry behind and take over. It also means that fights are over much faster, and I just don't get the same feeling of 'oh god no, where is the last alien?' any more.

 

I may have to re-scale this somehow.

Link to comment
Share on other sites

  • 10 months later...

I've come back to this mod.

 

I was unhappy with the way the tanks changed the feel of the game, so now I'm trying to change the toggle that gives them their turret. I'll make them into large infantry and see what I can do from there...

 

...testing so far:

 

the battlescape values for near some of the tanks ammo amounts are:

117 [6 198 69 118 30 235][10 198 69 118 8 235][4 198 69 118 255 51] 255 199

 

I put those in brackets because only the 30/8/255 are values where I know what they do. Those are the ammo values for the cannon, rocket, and laser tanks, respectively.

 

Setting the 6 to 1, breaks the infantry, kills the laser and plasma tanks, and breaks the rocket tank. The rocket tank again winds up with 1 ammo. The infantry, however, now get a tank layout inventory screen, with an infantry graphic in it. They no longer appear in the battle map itself, and- for their weapon- wind up with a cannon turret, plasma turret, or laser turret graphic. They wind up with a pistol clip in their off hand, but the pistol clip is actually a weapon of some sort. All in all, thoroughly broken.

 

if I swap the 10 and the 6, which you'd think would just give the cannon tank 8 rounds and the rocket tank 30, instead the cannon tank winds up with 255 rounds and the rocket tank winds up with 1 round.

Two thoughts:

This number is a pointer, that is also relative to its own position in the file.

Also, screwing up the rocket tank always leaves it with 1 round when it enters the battlescape. I don't know why.

 

[scratched a bunch of testing that basically showed it's just a two-byte pointer that I was screwing with]

 

Maybe I should be grouping it like so:

117 6 [198 69 118 30 235 10] [198 69 118 8 235 4] [198 69 118 255 51 255] 199

...testing saaaaays...

no. Swapping the 10 and the 4 crashes when I enter the battlescape.

 

This must be the ammunition that is loaded into a magazine.

[198 69 118] must simply be the opcode for 'put the next byte into an address for its ammunition amount' And really, whether the address precedes the opcode or follows the ammo amount, it doesn't matter to what I'm currently trying to do, which is to tell the tank it's not a tank any more.

:P

 

Update:

I'm an idjit. BladeFireLight mapped out a lot of the values for the aliens. Which is where the tanks live.

His(her?) mapping, and some of my own numbers:

481080 - standard tank

 

: Race

: Rank

: ?? (0)

: Can fly? (0 or 1)

: TUs

: Health

: Energy

: Reactions

: Strength

: Firing Accuracy

: Throwing Accuracy

: ?? (70)

: Armor- Front

: Armor - Left

: Armor - Right

: Armor - Rear

: Armor - Under

: ?? (0)

: ?? (50)

: ?? 0

: ?? 1 - setting to 0 does nothing. Some sort of toggle?

: ?? (0)

: ?? 4

: ?? 4

: ?? 16

: ?? 16

: ?? 0

: ?? 4

: Psi Skill

: Psi Strength

: [ = 11 - (bravery/10) ]

: ?? (30)

: ?? 0

: ?? 0

: Tank type - what to die as [74, tank. 70, hovertank]

: Big Unit? (0 or 1)

: Victory points

: Aggression

: Intelligence

(scratch that last, the 15 starts the male civilian.)

 

I'm betting that some of these ??s here are things like the inventory screen used, the size when crouched or standing, and the like. Also the size for the motion scanner, I would think, would be here. I would expect to find the things that go into the data file.

Link to comment
Share on other sites

Update:

I'm an idjit. BladeFireLight mapped out a lot of the values for the aliens. Which is where the tanks live.

His(her?) mapping, and some of my own numbers:

481080 - standard tank

 

: Race

: Rank

: ?? (0)

: Can fly? (0 or 1)

: TUs

: Health

: Energy

: Reactions

: Strength

: Firing Accuracy

: Throwing Accuracy

: ?? (70)

: Armor- Front

: Armor - Left

: Armor - Right

: Armor - Rear

: Armor - Under

: ?? (0)

: ?? (50)

: ?? 0

: ?? 1 - setting to 0 does nothing. Some sort of toggle?

: ?? (0)

: ?? 4

: ?? 4

: ?? 16

: ?? 16

: ?? 0

: ?? 4

: Psi Skill

: Psi Strength

: [ = 11 - (bravery/10) ]

: ?? (30)

: ?? 0

: ?? 0

: Tank type - what to die as [74, tank. 70, hovertank]

: Big Unit? (0 or 1)

: Victory points

: Aggression

: Intelligence

(scratch that last, the 15 starts the male civilian.)

 

I'm betting that some of these ??s here are things like the inventory screen used, the size when crouched or standing, and the like. Also the size for the motion scanner, I would think, would be here. I would expect to find the things that go into the data file.

Obviously (at least to me). Just take a look at the Editing Alien Stats section of my alien stats page here at StrategyCore. That should fill in most of your question marks. :P

 

- Zombie

Link to comment
Share on other sites

You did, because you said so in your first post. LOL :P

 

Thanks to:

NKF in this thread: https://www.strategycore.co.uk/forums/Editi...anks-t5985.html

Zombie has a great list of tank stats, already identified, here: https://www.strategycore.co.uk/xcom/pg/ufoalienstats

Hatfarm has a great editor, and a website with file information: https://hatfarm.xcomufo.com/

Jennifer Stein's editor.

J'ordos has been great for finding more information and offsets as well

Bomb Bloke, and everyone else not mentioned above who's participating in this thread, for helping me learn more about modding.

 

- Zombie

Link to comment
Share on other sites

You did, because you said so in your first post. LOL :P

 

- Zombie

 

...and that's when I KNEW I was losing my mind.

 

 

Setting the inventory layout to 1 or 2 has no effect that I can see. I'm guessing that I'll need to convince the game that they *have* an inventory, before that can come into play.

 

Also, what is Loftemps?

Link to comment
Share on other sites

Yup, I tried a whole bunch of numbers for the inventory layout when I was researching the alien stat but nothing seemed to change. My guess is that the inventory layout is basically unused/unimplemented. :P

 

Loftemps should really be spelled LOFTemps = Line Of Fire Templates. Basically this is an index into the loftemps.dat file which contains various pixelated "forms" the game uses to construct/build an approximate 3D shape on the battlescape. Mostly this is for line of fire determinations but it also affects visibility among other things. Bomb Bloke knows far more about this than I do. :)

 

- Zombie

Link to comment
Share on other sites

Graphically UFO is 2D. Functionally, it's 3D. LOFTemps contains the data used to create the 3D models.

 

My toolpack contains a program which can re-write all the 2D terrain sprites to better represent the 3D models they're tied to. It's not perfect (you're still stuck in the isometric view), but it gives an idea of what's going on. You can use it to spot holes in (supposedly) solid objects, like the one that lets you see into the Supply Ship when sitting near it's entrances. If you scroll to the bottom of this page you can see an example, or refer here for a more in depth discussion.

 

(Your troopers see through the holes anyway. The program just makes it so you yourself can see where the actual holes are).

 

Units also use LOFTemps, along with a few other values, to act as 3D objects (they come out as upright cylinders, or four upright cylinders in the case of large units (eg tanks)). By messing with this, you can literally make your units invisible and unhittable (no 3D object = nothing can see/hit them). Refer here for some notes on the subject.

 

In the record for any given unit in UNITREF.DAT, offset 113 (decimal) determines whether the inventory screen can be accessed. Set it to 0 for a tank and the inventory will work (though it'll also become vulnerable to stun, but this should be fixable if you also mess with the highest bit flag at offset 120).

 

I have no idea where those values exist in the executable file.

 

There is a problem in that there are actually different inventory layouts available. Two of 'em. Try and use any other, and the game crashes. Unfortunately, the same byte which deals with this also determines a tank's turret type, and there are way more then two types of tanks.

 

That is to say, only the standard cannon/rocket tanks can have accessible inventories. I reckon only Seb could get the others to work.

Link to comment
Share on other sites

In the record for any given unit in UNITREF.DAT, offset 113 (decimal) determines whether the inventory screen can be accessed. Set it to 0 for a tank and the inventory will work (though it'll also become vulnerable to stun, but this should be fixable if you also mess with the highest bit flag at offset 120).

 

I have no idea where those values exist in the executable file.

 

There is a problem in that there are actually different inventory layouts available. Two of 'em. Try and use any other, and the game crashes. Unfortunately, the same byte which deals with this also determines a tank's turret type, and there are way more then two types of tanks.

 

That is to say, only the standard cannon/rocket tanks can have accessible inventories. I reckon only Seb could get the others to work.

 

Yeah... I'm trying to find the place in the exe file where a the 'has a turret' versus 'has an inventory screen' is decided. I know it's in there somewhere.

My tentative plan at the moment is to eventually give the flying tanks one of the two tank inventory screens, and the crawlers the other (if I can). Not a perfect solution, but I think it'd be a nice touch for them to have the different screens.

I'm not really concerned about losing the turret swivel. While it's nice, graphically, it always winds up leaving the tank oriented the wrong way, with its strongest armor facing somewhere other than where the alien's return fire will come from.

 

 

Also, thanks for the info on LOFTemps. I'm thinking I shall not need to do anything to it, at the moment.

 

huh! A thought... where, in the executable, are the XCOM troopers generated? Maybe if I could compare them to the aliens...

Edit:

Zombie and Seb75 come through for me again! The soldier modding thread just below this one has the info... You guys rock.

Link to comment
Share on other sites

I'm not really concerned about losing the turret swivel. While it's nice, graphically, it always winds up leaving the tank oriented the wrong way, with its strongest armor facing somewhere other than where the alien's return fire will come from.

Tanks automatically get turrets regardless of what that byte's set to. It simply indicates which one you'll get.

 

For example, if you set that value to 0 for all tanks, they'd all have valid inventory layouts, but they'd all end up with basic cannon turrets (this has no effect on what they fire).

 

Here's a sample image of the inventory when that value is 1:

 

rocket_inventory.jpg

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