Jump to content

X-COM EU Gold Edition: HWP Modding


armorfiend

Recommended Posts

One of the things that has always felt a little off for me was that we could buy HWPs for ten times the cost and four times the size of the soldier, but without any real advantage.

 

What I'm working on now is trying to adjust the way the tanks work in the course of play.

 

The goal is: Each tank should have a primary weapon and a secondary weapon. The primary weapon is (whatever the tank is). The secondary weapon is a coaxial machinegun for tanks or a coaxial light laser for hovertanks. Maybe I'd modify the pistol and the HC, or something. Weapons that the player wouldn't use anyway (and then I'll make them too heavy for a human to carry around, because I'm a dick like that and don't want to break the game :blink: )

 

I want tanks to have a life expectancy beyond 'hey look, is that an alien?' and I want them to have a utility beyond 'so, I fired 8 rockets. Who's up for a weenie roast?'

 

I'll update this as I tinker. I'm very interested in hearing your thoughts and advice on it. I'm not interested in making tanks an 'I win!' button, but I'd like to make them something more useful than early-game disposable scouts.

 

...............................

update

Thanks to J'ordos and Zombie, we now know more about the tanks.

Each tank has four places that refer to their ammunition. One that says how much is needed in storage for the tank to be loaded. One that says how much ammunition the tank has when it gets to the battlescape. One that says how much ammunition is listed in the UFOpaedia. And one that dictates how much ammunition is *actually* removed from storage when the tank is added to asquad.

 

The table below will be updated as we find more info.

TANK/LOCATION		  UFOPAEDIA		  BATTLESCAPE		NEEDED		 REMOVED
Tank/Cannon			479,920			322,858			241,450
Tank/Rocket Launcher   479,928			322,864				 
Tank/Laser			 479,936			322,870				 
Hovertank/Plasma	   479,944				 
Hovertank/Launcher	 479,952

...............................

Still working on...

 

1) Finding the rest of the values in that table!

 

2) I'd love to know where the tank's right and left 'hand' are defined. From playing the game and looking at these editors, it looks like the tank is basically treated as a 2x2 soldier who happens to be carrying a tank turret in his right hand. What I'd love to do, would be to put a secondary weapon in the tank's left 'hand'.

caveat it sounds like the tank's own turrets override this. Whether this can be altered remains to be seen.

 

 

..........................................................

 

what I've got so far:

Tank chassis:

Way more accurate, more HP, better armor. An automated, computer-guided, stabilized gun platform should be substantially more accurate than the average human shooter. Flanks weaker than the front, rear weaker than flanks, under armor much weaker, on the off-chance an alien ever actually manages to roll a grenade under one.

Hovertank chassis:

More accurate than before, though not as accurate as tanks. They are subject to air currents, after all. Armor even on all sides, weakest underneath. Less armor and hitpoints than tanks, but much faster (or they would be if I could catch the issue with energy)

 

Cannon tanks:

Can now put a round through UFO armor. It's a freaking tank, after all. May be changed depending on ammo load issues and/or if I can't put on a second weapon (if I need to increase its ammo capacity, it'll probably lose the ability to put a round through a UFO, because I don't want them used to just shred everything in sight. Has autofire capability, though less accurate than aimed or snap. May or may not keep the autofire, depending on how it plays. Rebalanced the TU % of all attacks to make the tank function as if it's faster than its human counterparts.

 

Rocket tanks: working on balancing out the power. Ideally, it'll pop a hole in UFO armor, and lay waste to the smaller buildings. Not quite there yet. Added an autofire capability, and am currently cranking down the accuracy. The goal is to give the tank a bombardment attack, where it spits out a significant fraction of its ammo to saturate an area that the player can't necessarily see. Finding the right accuracy to make the rounds wind up in more or less- but not- the same place is fun. The civilians at the terror sites disagree, but they're wimps. Rebalanced the TU % of all attacks to make the tank function as if it's faster than its human counterparts.

 

Laser tanks: Very slightly increased the damage. Vastly increased the accuracy- it's a frikkin' laser, after all. Added an autofire, to allow it to engage other tank-sized foes without the player having to click 'fire' every single time. Arbitrarily decided that the laser tank should NOT be able to punch a hole in a UFO, mostly because it has infinite ammo. Rebalanced the TU % of all attacks to make the tank function as if it's faster than its human counterparts, and set it to be 4 to 5 TU's less per shot than the cannon tank.

 

Plasma hovertanks: Still trying to find a unique role for these guys that doesn't completely overshadow the cannon tank.

 

Blaster launcher hovertank: A friend gave me a great idea for these. Napalm-bomb tank. Disable the blaster effect, and it becomes another rocket tank. Change the damage type to fire, and then ramp up the damage 'til it can burn out an acceptably large chunk of the landscape. I'd have to see how it played, but at the very least it could be useful for night missions. Other concepts that could help give this tank a unique role would be very welcome.

 

.........................................................

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.

Link to comment
Share on other sites

Just two quick notes here:

 

The turret information should theoretically have the ammo information that you're after. In addition to the damage strength/type, the ammo quantity should be defined there.

 

Also, because the tank uses a tank turret for a weapon, its left and right hands are overridden and are thus ignored. So unfortunately you can't arm it with a unique set of weapons. Pity too, since it would've been really great to have a tank with a light machine gun (well, triple-shot assault gun) in addition to its main cannon. This would have cut into the item limit though.

 

- NKF

Link to comment
Share on other sites

Just two quick notes here:

 

The turret information should theoretically have the ammo information that you're after. In addition to the damage strength/type, the ammo quantity should be defined there.

 

Also, because the tank uses a tank turret for a weapon, its left and right hands are overridden and are thus ignored. So unfortunately you can't arm it with a unique set of weapons. Pity too, since it would've been really great to have a tank with a light machine gun (well, triple-shot assault gun) in addition to its main cannon. This would have cut into the item limit though.

 

- NKF

 

The turrets seem to have 20 bytes devoted to each of them... 10 numbers with spacing 0's at the front.

Quoting from your other post:

0: Damage Type

1: Ammo Type

2: Damage

3: Snap Shot Acc.

4: Snap Shot TU's

5: Auto Shot Acc.

6: Auto Shot TU's

7: Aim Shot Acc.

8: Aim Shot TU's

9: Blaster Effect

 

Ammo type is being clarified somewhere that isn't here, and I'm guessing that's where the amount is defined. Though, changing the rocket tank's ammo type to the same value as that of the cannon tank didn't give it a 30 round magazine, so I'm not really sure. But then too, tanks are loaded with ammo when you put them on the craft. I only changed that value when it was already onboard.... huh.

I will go test that.

edit:

Okay, tested that. Giving an ammo type of 4 (whatever that is) to mimic the cannon tank did not increase its magazine even after loading and unloading it from the craft.

 

Honestly, I'd think the item limit wouldn't really be a problem- taking one tank with two guns would still be a lot fewer items than four fully equipped troops...

 

Here's a thought- would it be possible to un-override the tank's left and right hands? I don't know if there are enough unused weapons in the game to redefine them all for tank use, but it might be worth a try...

 

Or, would it be possible to make a normal troop into a tank somehow?

Link to comment
Share on other sites

First of all, you can find a bunch of information on this subject on my Alien Stats page.

 

I want the tanks to be faster than troops. That is, I want them to have more TU's and do more in their turn. At the moment I'm envisioning the ground-based tanks being heavier and slower than the hovertanks, so I'm setting the ground tanks at 200 TU's and the hovertanks at 250. All goes well, except- they don't have enough energy. Now, I may change those TU values around for balance, but the energy thing baffles me. My ground tanks- I haven't tried out the hovertanks yet- are running out of energy after about 100 TU's of movement.

The next turn, they're full of TU's, but still can only go about 100 TU's move before they're out of energy again. At the moment they have a strength of 100, but I may try giving them a strength of 255 to see if that makes a difference. One of the editors I've used seemed to imply that giving a troop or tank a strength above 100 is a Bad Thing, but I don't know *why*?

The same thing happens to soldiers if you crank TU and Energy up too high. I think it's probably a combination of the two stats which makes the unit run out of energy so soon. What I normally do (at least for soldiers) is to make TU 200 and Energy something like 180 (that's basically 90%). This seems to work well for soldiers. If you want to crank up the TU even more, just make sure to adhere to the 90% rule (250 TU equates to 225 for Energy, though I haven't checked if this has any problems). The equation for energy use is INT(TU used/2), so that would indicate a 50% scale is better, but there usually is a buffer. ;)

 

The other issue which stems from TU/energy change is that normal enemy units recover energy at a rate of 30 points per turn. Tanks are 50, but when there is the option for lots of movement, you may want to consider cranking that up to 100 or 125 to allow them to recover enough to move fully the next round. Strength plays no role whatsoever in a tank so you can crank that up as high as you want (I wouldn't though, as strength is meaningless in this instance anyway). In soldiers, a very high strength limits the distance he/she can throw things, so it's best to keep that at the max of 71.

 

Ammo quantity for tanks hasn't been found in the executable yet. I looked pretty hard recently and didn't come up with anything either. It's in there though... somewhere. Might have to try editing some of those 30's to see what happens in-game. :blink:

 

- Zombie

Link to comment
Share on other sites

Awesome information, Zombie, thanks. And I'll check out that page.

I actually started looking for 30s that have an 8 nearby, figuring that the rocket information should be some multiple of 8 bytes away, minus 1. So far... I've discovered how to make the game crash intermittently. ...go me?

 

Someone mentioned stacking multiple weapons in a character's hand. How is that done? Might that be applicable to the tank, do you suppose, to give it that secondary fire?

 

-in fine-tuning my tanks' armor, I think I'm getting close, but now I have a new puzzlement. How exactly does armor work? Is it a percentage reduction? A straight reduction? Or is it a 'chance not to take damage'?

I've been testing by driving my tanks into a gaggle of aliens armed with plasma rifles. Sometimes the aliens make an absolute hash of the tank after a few hits, other times the tank seems to shrug off the hits. Yet in both cases the hits are to the same face of the tank's armor- if the dead tanks had been hit on the flank and the survivors had been hit on its front, then that would be grand. But as it stands, my results aren't reproducing themselves very well.

 

edit: After reviewing Zombie's info, I'm going to update my OP here. Looks like he already has more information than I do :blink:

But I'm still looking for more tank tweaks ;)

 

edit the second:

This 'inventory layout' seems intriguing. What is it, and where can I find more information?

Link to comment
Share on other sites

I did some lookup work on the ammo values of the HWPs, and I found a set of data that seems to match 'em, though I haven't tried them yet.

offset 379596 (decimal) in geoscape.exe (DOS version!) is 30 (cannon)

jump down 8 bytes, you get a value of 8 (rocket)

another 8 down is 255 (laser)

and another 8 is 255 (plasma)

and yet another 8 is 8 (blaster)

 

Can anyone confirm these?

Link to comment
Share on other sites

holy awesomeness, man. If this is right, you rock. I'll have to check it against the Gold edition to figure out where that matches on mine, but that sounds right.

 

edit:

that matches 479,926 (decimal) in the gold edition. Let's seeeeeee what happens.

 

edit:

changed the numbers to 50 rounds for the cannon, 12 for the rocket. No effect on my saved game even after loading and unloading the tanks from the transport, and no effect when starting a brand new game.

Oddly enough, nothing broke, either.

Link to comment
Share on other sites

J'ordos is correct! Here's a quick screencap I took of a modded tank which has a 100 round clip ;) instead of 30:

 

Cannon_Mod.png

 

Will still need to do some testing to determine what the other values stand for, but it's at least a start. Thanks Dr. J! You just saved me a bunch of time. Got any more offsets? :blink:

 

- Zombie

Link to comment
Share on other sites

well, huh.

Suppose it's pulling the value from elsewhere for how many it puts in the tank when loaded on the transport, then?

 

That's gotta be the right values, if it shows up there.

 

 

:blink:

 

edit:

Zombie, can you take it out on a mission and see if it's got 100 rounds when it gets there?

 

Thanks.

Link to comment
Share on other sites

Hmm, the tank still only shows 30 rounds on the tactical map. I'm beginning to think that the values j'ordos found is just for the geoscape (ufopaedia mostly). Tactical.exe might override these changes. Will need more testing though. :blink:

 

- Zombie

Link to comment
Share on other sites

Hmm, the tank still only shows 30 rounds on the tactical map. I'm beginning to wonder if the values j'ordos found is for the geoscape. Tactical.exe might override the other changes made. Will need more testing though. :blink:

 

- Zombie

 

 

What I'm wondering now, is... what do the other 7 bytes do?

 

oh!

Just realized there's an easy way to figure out how much ammo it REALLY has.

edit:

I started a new game, loaded a cannon tank onto a plane, and checked base stores. Only 30 rounds were transferred out of base stores.

Tactical.exe doesn't come into play until the start of a battle, right? So this should still be in ... the one that isn't tactical.exe that I can't remember because my brain apparently just died.

Link to comment
Share on other sites

Geoscape.exe is what you are looking for. :)

 

Anyhow, the data doesn't start at 479,926 (480,027 in MS-Edit with 100-column widths) in the CE/gold executable. There's a bunch of data before the "30" which looks like the associated HWP cannon damages etc. Since the data is bounded on the right side by "geograph/up000.spk" the start is somewhere around 480,020 or 480,019 (In MS-Edit that is. If you want offsets, subtract 101). I don't know exactly where yet because the game sometimes uses a null byte to terminate a data set. My thought right now is 480,019. ;)

 

Edit: Bah! I screwed up the offsets. I think the data starts at 480,021. Since the game normally has the first byte in a data field a pointer within english.dat, the 171 value for a start looks to be correct. I edited the 171 for the HWP/Cannon to 174 (to match a laser tank) and the ufopaedia showed the weapon damage type was "Laser". Editing it to 172 resulted in "Incendiary", 173: HE, 174: Plasma, 176: Stun, etc. So 480,021 has to be correct (479,920 non-MSEdit CE, or 379,590 DOS Geoscape.exe). :blink:

 

- Zombie

Link to comment
Share on other sites

Geoscape.exe is what you are looking for. :)

 

Anyhow, the data doesn't start at 479,926 (480,027 in MS-Edit with 100-column widths) in the CE/gold executable. There's a bunch of data before the "30" which looks like the associated HWP cannon damages etc. Since the data is bounded on the right side by "geograph/up000.spk" the start is somewhere around 480,020 or 480,019 (In MS-Edit that is. If you want offsets, subtract 101). I don't know exactly where yet because the game sometimes uses a null byte to terminate a data set. My thought right now is 480,019. :)

 

Edit: Bah! I screwed up the offsets. I think the data starts at 480,021. Since the game normally has the first byte in a data field a pointer within english.dat, the 171 value for a start looks to be correct. I edited the 171 for the HWP/Cannon to 174 (to match a laser tank) and the ufopaedia showed the weapon damage type was "Laser". Editing it to 172 resulted in "Incendiary", 173: HE, 174: Plasma, 176: Stun, etc. So 480,021 has to be correct (479,920 offset, non-MSEdit). :blink:

 

- Zombie

Thanks for the name, and, kickass. That is fantastic.

So what we have here, then, is a table of UFOPedia information. That may or may not affect other things... This will be useful for correcting it to reflect whatever I do with it though ;)

 

edit:

okay, so we have 8 fields:

0 with 1, changes weapon name

1 with 0, changes weapon name

2 listed damage amount (not related to actual damage amount- see turret values near offset 447,867)

3 unknown - always 0. Flag?

4 listed ammunition type - does not appear to be related to actual ammunition

5 unknown - 1 (only for ammo-carrying tanks) or 0 (all others) Seems to work with 4, for human tanks.

6 listed magazine capacity (apparently not related to actual magazine capacity) 255 for energy weapon

7 unknown - 0 or 255 (laser and plasma only) for tanks, unknown items above (terror units?) are 0 or 1.

 

When I changed 5 to 0 for the cannon tank, it's listed ammunition type changed to 'ALIENS KILLED' so at a guess, it's related to 4. But, the items above- whatever they are, terror units maybe? are all 0 even when they have a value in 4.

 

I'm going to go off and foam at the mouth... I mean sleep... now.

Link to comment
Share on other sites

So what we have here, then, is a table of UFOPedia information. That may or may not affect other things... This will be useful for correcting it to reflect whatever I do with it though :blink:

Yup, that's always good too. Never hurts to tie up the loose ends in a mod. ;)

 

And like you mentioned, it's ufopaedia info from what I can determine so far. I edited the cannon's ammo to 100, normal deal. So then I edited the 0 after it to 100 and the ammo qty in-game was 25700. So obviously these are 2-byte values in little endian. Makes sense as now there are only 4 columns. The first two bytes is Ammo Damage Type, second is Ammo Damage Power, third looks to be another pointer within english.dat (probably name of ammo), and the fourth is the Ammo Quantity. This correlates to Weapon, Weapon Power, Ammunition and Rounds in the UFOPaedia article. :)

 

- Zombie

Link to comment
Share on other sites

LOL :blink:

 

Anyhow, I searched the Geoscape part of the CE executable pretty close just now but didn't come up with anything fruitful (30 with an 8 nearby). My gut feeling says Tactical might be involved in this somehow so I might search that next. Who knows, j'ordos might come up with some more offsets first. ;)

 

- Zombie

Link to comment
Share on other sites

The Tactical engine won't affect the ammo quantity issue at all. It just uses whatever value the GeoScape engine stuck in the uniref file (offset 118).

 

Having too much strength is a problem in that when you attempt to throw something you will always fail (as the unit would heft it out the top of the map with their enhanced power). Tanks don't throw stuff or carry things so they don't actually need strength at all.

 

As Zombie says, strength has no (known) effect on energy, but base time units do. Refer to unitref offsets 15, 27, 35 and 45. By cranking 45 high enough it's possible to eliminate energy use.

 

Haven't played with item stacking much, as NKF says it likely won't work for tanks but if you want to try it anyway then have a go at my map editor. You press the "F" key once it loads (which enables most of the features) then the inventory screen lets you do much as you like. Item stacking, tank equipping, whatever.

 

You can also use the "I" button to spawn items directly into the map.

Link to comment
Share on other sites

The turret data will most probably be in Tactical, since Geoscape doesn't need to know anything about the turrets except for the ufopaedia entry filler numbers and how much ammo to take out of storage (or put back, as the case may be).

 

- NKF

Link to comment
Share on other sites

Sort of. The GeoScape engine not only has to take such-and-such an amount of ammo out of storage, but it has to put it into the tank. It wouldn't surprise me if two seperate values in the the EXE dealt with this, too, 'cause you can't really do that with a single command.

 

The GeoScape engine also determines what sort of turret goes with each tank.

Link to comment
Share on other sites

I think it's a case of subtracting the ammo amount from storage when a tank goes into a ship, and then adding the ammo back into storage when it comes out again. The laser tank to gauss coelacanth conversion in TFTD was goofed because they only set the outgoing ammo amount, but never did anything about the incoming amount.

 

The tank itself will start combat with the full amount of ammo regardless of what was taken out of storage (ammo will be based on the turret type as you say). The free ammo for base defense bug wouldn't work otherwise. After the battle, the game adds the remaining ammo into storage.

 

At least, that's how I think it goes.

 

- NKF

Link to comment
Share on other sites

ooh! I had forgotten about the free ammo bug.

And your incoming-outgoing seems right, so...

That means that the gentleman (or lady) who did the conversion found the values we seek. Or at least one of them, anyway. Is that person on the forum?

 

Bomb Bloke- does your editor only edit things during a mission? I will go look at it.

 

-fun!

the free version of the Neo hex-editor, despite being nag-ware-ish (many features, seemingly at random, will tell you that you can't use them until you buy the full version) has two nice things going for it:

1) find and replace

2) ability to change the colors.

 

I set the colors of the edited cells to background yellow, font red, and replaced all 30s with 30, and all 8s with 8. Now I'm going from 30 to 30, looking to see which ones have an 8 nearby, and of those, which have two 8s that seem to fit in a pattern.

 

Useless trivia: I don't know what 0 117 30 104 XXX 0 0 is, but it shows up a *lot*. XXX is a number, like 138, 148, 157, etc. Seems to be referring to its own position in the pattern, or alternately, something outside the pattern in relation to itself. Could just be 'break, go to X' or something.

another thought: their operations seem to follow the pattern of 10 bytes and a spacer byte.

 

and am I correct in thinking that a long line of 144's was just their way of separating one section from another?

Link to comment
Share on other sites

ooh! I had forgotten about the free ammo bug.

And your incoming-outgoing seems right, so...

That means that the gentleman (or lady) who did the conversion found the values we seek. Or at least one of them, anyway. Is that person on the forum?

No you misunderstood. NKF was trying to convey that the programmers from TFTD didn't convert the Laser Tank over to Gauss properly. :blink:

 

The "XXX" you mention might be pointers within a file such as english.dat or english2.dat. Got the location of the start of that data? I wouldn't take too much stock into the theory that 144 is used to separate sections. Usually it's a null byte (0) or something like 255 if it is used at all. In a lot of places there isn't any space between sections. As long as the program knows where the data starts there really isn't a a need for breaks, that's more for people who are coding it. ;)

 

- Zombie

Link to comment
Share on other sites

No you misunderstood. NKF was trying to convey that the programmers from TFTD didn't convert the Laser Tank over to Gauss properly. ;)

 

The "XXX" you mention might be pointers within a file such as english.dat or english2.dat. Got the location of the start of that data? I wouldn't take too much stock into the theory that 144 is used to separate sections. Usually it's a null byte (0) or something like 255 if it is used at all. In a lot of places there isn't any space between sections. As long as the program knows where the data starts there really isn't a a need for breaks, that's more for people who are coding it. :)

 

- Zombie

sure, let me dig up the start location of one of those patterns. It wasn't what I was looking for, so I didn't write it down, but it's fairly distinctive...

At 239,768 you'll see a bunch of 133 192 117 30 104 XXX 0 0 0 items.

 

it isn't *as* common as it feels like, though. A global find/replace of 117 30 with itself only yields 35 matches. So I'm full of it, apparently :blink:

 

I dunno, I mean, if you're already decompiling this, is posting these up just silliness? There are several pretty common patterns that are probably compiled instructions of some sort, but I don't want to just repeat effort or clog the forum with a bunch of useless junk.

Link to comment
Share on other sites

Further searches yielded no results so far... 'Till now I just assumed the values could be found in a set at constant intervals but it looks like this is not the case. Ofcourse there's also the problem of which exe to search and what value the laser and plasma tanks get (if present at all). Anyone knows how much ammo the plasma&laser tanks get in the unitref.dat file? Is it 255 as well?
Link to comment
Share on other sites

Further searches yielded no results so far... 'Till now I just assumed the values could be found in a set at constant intervals but it looks like this is not the case. Ofcourse there's also the problem of which exe to search and what value the laser and plasma tanks get (if present at all). Anyone knows how much ammo the plasma&laser tanks get in the unitref.dat file? Is it 255 as well?

 

 

I haven't found anything yet either, but crawling through the entire executable this morning gave me ten possible spots (out of 502 total) to try that I'll see about checking soon.

I'm still working on a project for work, but if you want to try them...

 

53,218

73,920

100,597

111,697

137,284

241,450

270,331 *

304,021

322,858

353,524

 

* this one has a mark next to indicating that I felt it was less likely than the others. I don't know why.

 

Those are offsets inside the gold edition executable, though. They'd be different in the split executables.

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