Jump to content


Editing Prices For Stuff

  • Please log in to reply
2 replies to this topic

#1 grommet



  • Forum Members
  • PipPipPip
  • 26 posts

Posted 16 August 2006 - 01:01 AM

One of the things thats always kinda annoyed me is that the game pre-loads the Heavy Cannon and Autocannon with that belt of AP shells I brought for the END of the mission, AFTER I've swept and secured the map and am moving into the UFO (where I'd like to keep explosions and pyrotechnics to a minimum). I'd really rather that the HE or I ammo be preloaded, as it is MUCH better for the sweep and secure map phase. As I was looking through the OBDATA.DAT file, it occured to me that I could probably get the game to do this by moving the AP ammo data to the end of the ammo list for the respective guns.

So I tried it, and it worked! =b

It even shows the new order in the UFOpaedia...but in the base buy/sell, transfer, and equip craft screens, it still sez AP ammo for the first ammo slot...so I changed the order of the ammo labels in ENGLISH.DAT, and now it even labels them properly! B)

But there is still 1 little problem...the prices are still the same as before the edit. Now I realize that this isn't a major deal, probably not amounting to more than $10000 over the course of the entire game...but I do use these guns through the entire game (if not on the aliens, then on the terrain!!), and it irks me...

So, does anyone know where the prices for stuff you can buy/sell are located? Failing that, any ideas on how they would be stored? (as some prices are in excess of 65K, would the game use three bytes to store them? or just use two bytes and multiply by 10?)

Any insights or informed opinions welcomed...


#2 NKF



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

Posted 16 August 2006 - 07:05 AM

If I remember correctly, you're looking for a 16-bit integer - i.e. 2 bytes. Remember, values are stored in little-endian, so a $3000 (rifle price), while normally 0x 0B B8 (11, 184) in plain hexadecimal, you will be looking for a value of B8 0B (or 184, 11).

These values are in the geoscape.exe portion of the game.

I realise that 3,000 will probably show up elsewhere, so look for it and try to match it up against the selling price of $2,250 (0x08 ca (i.e. ca 08 (202, 8))), which should be adjacent if not nearby the purchase price.

Once you've found this, you should be able to spot the other items as well.


edit: If I'm mistaken, and they're only stored as 32-bit integers (4 bytes), just pad your numbers with a few extra 0's accordingly.

Edited by NKF, 16 August 2006 - 07:10 AM.

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

Number of members: 1

#3 grommet



  • Forum Members
  • PipPipPip
  • 26 posts

Posted 19 August 2006 - 10:29 AM

Well, after MUCH poking, prodding, and prying, I never was able to find the costs of items in GEOSCAPE.EXE...at least, not that I could be SURE of. I found lots of places that MIGHT be it, but I don't really wanna go hacking randomly at the file, so I backed up and took the easy way out...

PURCHASE.DAT, located in your savegame directory, contains the buying and selling prices for all items in the game...but only for that savegame. If you start a new game, it will have the default values (pulled, I assume, from GEOSCAPE.EXE, which is why I wanted to mod them there...)

In any case, this allows me to modify the prices for the respective ammos back to their proper values...at least for that game (the other changes I made, to OBDATA.DAT, ENGLISH.DAT, and ENGLISH2.DAT, are global changes that WILL effect new games...so I have to mod PURCHASE.DAT every time I start a new game to get the right prices for the changed ammos...but thats not too often, I'll just have to remember to do it...)

I'll keep trying to find the values in GEOSCAPE.EXE, when the mood takes me, but for now, I've fixed my problem, so I think I'll play the game instead :P

I did do a fair amount of work disecting the PURCHASE.DAT file, which had no entry in the XCom Wiki, so I added one =b


P.S. For those who might have wondered, prices over $65K are stored as three bytes = 24 bits = ~16.7M possible values, or ~8.4M if its a signed integer...plenty enuff for any prices in XCom!