Jump to content


Photo

Hwp Editing?


  • Please log in to reply
7 replies to this topic

#1 Khalnath

Khalnath

    Rookie

  • Forum Members
  • Pip
  • 0 posts

Posted 12 March 2006 - 03:29 PM

Is it possible to edit the armament of HWPs? I want to make a Hovertank with a rocket launcher.

#2 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 13 March 2006 - 02:45 AM

Ah yes, this is easy. I don't know of any game editors that do it, but I know how you can do it with a hex editor. All you need to do is fiddle with the game executable that has the HWP turret information.

I can give you a general idea of where the offsets are for the collectors edition executable. Not the exact starting point, but close enough. Deciphering the information is up to you. But it's simple enough if you first write down the values you can find from the ufopaedia for cross referencing.

Look around offset 447, 989 in ufo.exe/ufo defence.exe (or do what I did, open the executable in MS-Edit, set columns to 100 and go down to row 4479 and start looking at the values in the general area). If you're using the XComutil CE executables, they're in the same place in both geoscape.exe and tactical.exe. You just have to figure out which set of stats actually take effect in the game.

Anyway, you'll probably see a pattern of familiar numbers. The one I gave you should put you near a set of values that look like

2 0 12 0 85 0 55 0 45 0 0 0 0 115 0 75 0 0 0

and so on. If we ignore all the second 0's, you'll see some very familiar numbers. Note, all tank turret values are in little endian short integers (i.e. numbers are stored backwards), so each set of information actually takes up two bytes, although only the first byte of the short integer is used in the game. .

The first 2 is the damage type. 12 = ammo, 85 = ammo damage, 55 and 45 = snap accuracy and cost, 0 and 0 = auto accuracy and cost , 115 and 75 = aimed accuracy and cost. These are the stats for the rocket turret.

If you look around, you'll find the alien turrets and eventually locate the fusion hovertank's weapon.

Good luck. Happy spelunking! And if any of the above didn't make any sense to you, don't worry. It will to someone out there. ;)

Heey... a thought just occured to me. How about a stun bomb tank, or an incendiary tank with hundreds of ultra-low-powered rockets, with an automatic fire mode? Whee!

(Note, I don't know if changing these values will determine how much ammo is needed to load the tank onto your ship. I'm not adventurous enough to actually fiddle with these values drastically - yet. Actually, I must try looking for it some day. Finding the ammo cost values for loading tanks onto your ship could be really useful in fixing the gauss coelecanth arming error in TFTD)

- NKF

Edited by NKF, 13 March 2006 - 02:53 AM.

Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1

#3 Khalnath

Khalnath

    Rookie

  • Forum Members
  • Pip
  • 0 posts

Posted 13 March 2006 - 02:49 AM

That sounds well within my abilities, thanks. I'll report back after I try it.

#4 grommet

grommet

    Sergeant

  • Forum Members
  • PipPipPip
  • 26 posts

Posted 11 August 2006 - 11:00 PM

OK, so I was thinking about weapons to breach UFO hulls today, and a thought occured to me...the laser HWP would be a logical unit to do so. Lasers have no recoil, and the laser HWP would make a stable firing platform, with almost unlimited power available to cut through the hull. I never use tanks for killing anyway, just as scouts/decoys, and to take out cover/walls, so this seemed like a logical use for the unit. While Blaster Bombs and XcomUtil modded HiEx will breach UFO hulls, they both do massive collateral damage, and I personally think that the modded HiEx is TOO powerful, limiting their utility against Cyberdisks or terrain because of the collateral damage and HUGE blast area.

So, to turn the Laser HWP into a alien can-opener, I thought I'd up the damage a bunch (say, about 230), but, to represent the lengthy operation of cutting through the hull (and to prevent abusive use of the upgunned weapon), remove the snapshot option and make the aimed shot take ~90%TUs.

I started by reviewing the info in the Wiki, as well as that posted in several places here and on the strategycore forum on modding HWPs. Then I sat down to find the data I needed to change in GEOSCAPE.EXE...and immediately ran into difficulties. First off, I am playing DOS version 1.2 because I wanted to see the effect of no stat caps and also because I want to test whether you can get back countries that have signed a pact (I've read that this is possible in the older versions, but I've NEVER been able to in ver1.4) Unfortunately, all the info I could find on what offsets to use were for 1.4 or CE versions, so I had to search for the data. Using MS-EDIT (came with WinXP), I can't seem to enter 0 in the search box...any other character seems possible, but how do you enter a 0? <ctrl>P<ctrl>2 works in the editor itself, but not in the search box, copy and paste don't work (right click don't work, and <ctrl>V enters the character for value(22))...this is a real problem, as the stats for turrets are short integers (16 bits), which means that every other value in the data array for each turret is 0!

So I eventually give up on EDIT in frustration, and fire up a real hex editor...only to find after much searching that the turret stats are not in GEOSCAPE.EXE...they are in TACTICAL.EXE!! (at least in the DOS version of the game) After discovering this, I finally found the data I needed to change...but looking at that data raised some questions, and I thought I would see if anyone knew the answers. First off, the data:

Turret  Dam.	Ammo	 Dam	Snap  Snap   Auto   Auto   Aimed   Aimed   (?)
Type	Type	(?)			 Acc   TU%	Acc	TU%	Acc	 TU%
T/C	 0(AP)	 4	   60	 60	33	  0	  0	 90	  80	  0
T/R	 2(HE)	12	   85	 55	45	  0	  0	115	  75	  0
T/L	 3(LA)	17	  110	 50	33	  0	  0	 85	  75	  0
H/P	 4(PL)	36	  110	 86	30	  0	  0	100	  60	  0
H/B	 2(HE)	40	  140	  0	 0	  0	  0	120	  80	  1
Cela	7(?)	 38	  140	 75	30	  0	  0	110	  60	  0
Cyb	 4(PL)	34	  130	 75	30	  0	  0	110	  60	  0
Sect	3(LA)	34	  100	 75	30	 50	 35	110	  60	  0
Keep in mind that the Turret Type column and the parenthetical notation after the Damage Type were added by me for this table...also remember that there is a 00 byte between each of these values that I'm not showing.

1> So, what does the Ammo value mean? I had thought it would be an ammo counter, but that is obviously not the case... Where, then, would the ammo count for each HWP type be?

2> Also, the damage type value of 7 for the celatid would be its acid spit...is this damage type found anywhere else in the game? What happens if one assigns another weapon damage type 7? Would it get the celatid's arcing trajectory attack (like a grenade)?

3> Do Sectopods really do laser damage?

4> I assume that the final value is a flag for whether the weapon uses programmable waypoints...if you set this to 1 for the rocket tank, would it get waypoint targeting like the blaster?

[Update] After monkeying around a bit more, I've decided that the ammo type probably determines what graphic the weapon uses when firing: the numbers match weapons in the OBDATA.DAT file (4=Heavy Cannon, 12=Rocket Launcher, 17=Laser Gun(Rifle), 36=Plasma Rifle, 40=Blaster Launcher, 38=Plasma Pistol, 34=Heavy Plasma)

This still leaves open the question of where one can find the ammo counter for these weapons...I'd really be interested if anyone knows...maybe we could fix the damn arming bug that makes the Gauss Coelecanth nigh useless...

Grommet

#5 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 12 August 2006 - 02:35 AM

That's the problem, as the laser HWP does not return ammo, we'd probably be looking for 00's! And that's not practical on account of how many 0's and 32's (when using MS-Edit's limited search) there are out there.

The turret information's definitely in tactical - there's no reason to have it in geoscape.exe. However, if anything, the ammo handling will be found in geoscape.exe. That would be a good place to start. With the dos version of the game, as the executables are not composites of both executables, you get a much smaller search space, so you have a distinct advantage there (yes, I know you can just skip past the Geoscape or Tactical portion, where ever they don't apply - it's still easier to work with smaller files).

The only clues you could probably go on would be to look for the amount of ammo each tank needs to be loaded onto a ship and then search in a similar location in TFTD's executables and look for the gauss ammo count and see if you can find it in the UFO executable. Perhaps knowing the index number of the physical store items will help.

Once you know where the loading occurs, a similar search on the unloading can be done. At least, that's how I think it can be done.

- NKF

Edited by NKF, 12 August 2006 - 02:43 AM.

Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1

#6 grommet

grommet

    Sergeant

  • Forum Members
  • PipPipPip
  • 26 posts

Posted 12 August 2006 - 08:41 AM

NKF, I know you use MS EDIT alot...can you comment on the problem I was having entering a 0 into the search box?

Using MS-EDIT (came with WinXP), I can't seem to enter 0 in the search box...any other character seems possible, but how do you enter a 0? <ctrl>P<ctrl>2 works in the editor itself, but not in the search box, copy and paste don't work (right click don't work, and <ctrl>V enters the character for value(22))


Would using a copy of EDIT from a different OS help? I have XPpro, 2Kpro or AS, 98se, or even DOS 6.22 available...

Grommet

#7 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 12 August 2006 - 04:30 PM

Unfortunately, no, I can't get it to search for zero values. Although MS-Edit is a surprisingly handy hex-editor for a plain text editing program, it's quite lacking as well. The best it can do is non-zero values. As you said, a 0 can't be entered into the search dialogue, you can't enter it, and you can't select it for the search either.

It gets worse when you're looking for a large number and there's a zero value in between it. Selecting the same number elsewhere and then going to search will only give you the characters up to the 0 or 32.

Looking for adjacent values is by far your best shot. For large values with zeros in the middle you can look for all instances of part of the value up to the first zero. Although this is tedious, it works.

- NKF

Edited by NKF, 12 August 2006 - 04:32 PM.

Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1

#8 grommet

grommet

    Sergeant

  • Forum Members
  • PipPipPip
  • 26 posts

Posted 15 August 2006 - 07:03 AM

OK, so I've been playing with the stats for HWPs, and found my answers...mostly. Thought I would share my findings with those interested:

As noted, the file that must be modded is TACTICAL.EXE (for the dos version, anyway...it would be GEOSCAPE.EXE for the CE(Windoze) version.)

I modded the Laser HWP as I described in my earlier post, and it worked most excellently...it blows through UFO hulls ~1/2 the time, and knocks down inner UFO walls even better; I removed the snapshot option, and Aimed shots (the only kind it can now make) cost 90% TUs, and this was reflected correctly in the game. So, Hoorahh!! A non-explosive Alien can opener!! B)

As for my other questions, this is what I found:
1> The second value (third byte) controls the graphic and sound effects when the turret fires. The value references a weapon in OBDATA.DAT for which effects to use...when I changed this from 17 to 2 for my laser tank, it started firing rifle bullets! (That still knocked holes in UFO hulls!! OMG ) Note that 2 is NOT one of the values used for the turrets, but it confirmed for me that this value was a lookup to OBDATA.DAT weapons.

2> I tried assigning damage type 7 (the celatid's acid spit) to the laser tank, with no real apparent effect...the tank still shot straight, mostly (it did seem to arc when it missed once, tho...I did try changing the second value to 38 (plasma pistol in OBDATA.DAT), like the celatid, but this just made it look/sound like plasma fire...I dunno, needs more testing...I did not reenable snapshots, maybe that would arc??

3>Still haven't tested the Sectopod...they're kinda rare. However, as this exercise has explicitly shown, the fact that Sectopod fire LOOKS and SOUNDS like plasma, doesn't mean it ain't laser damage...which would make Sectopod fire VERY effective against other Sectopods...and does explain why its so good at killing ITSELF w/reaction fire if you MC the wrong quarter! LOL

4> The last value DOES enable waypoint targeting...I did NOT try this with the Laser HWP, but I set the flag to 1 for the Rocket HWP, and PRESTO!! Waypoint guided rockets from your Rocket HWP!

Conclusions: In one of the threads on arming civilians, NKF suggested arming them with turrets to avoid clogging the item table with a bunch of added weapons/clips, but lamented that they would look/sound like they were firing cannons...well, if you were willing to have the Tank/Cannon look/sound like its firing rifle/pistol bullets, you could change the weapon lookup to 2 or 0 (rifle or pistol, respectively) and arm the civs with it...presto, civs armed with rifles/pistols (tho they wont have a visible gun, and you wont capture their weapons if they're killed/stunned). You could even change the accuracy/TU cost/damage to suit...just keep in mind that any changes to a turret would also effect the tank that mounts it...

Waypoint targeting for the Rocket Tank is kinda cool...and provides a GREAT explaination for why Ammo for the Rocket Tank costs 333% as much as a large rocket, while doing 15% LESS damage :P BTW, enabling waypoint targeting will override the Snapshot/Auto/Aimed fire buttons with the Launch Missile button, but you may wanna zero out the snapshot settings anyway...in testing, I had a rocket tank reaction fire on a Sectoid, even though it didn't have enuff TU left to launch a guided missile!

Grommet