Author Topic: Changing the prices of things in shops  (Read 11391 times)

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Changing the prices of things in shops
« on: 2008-10-11 17:03:10 »
After searching for information on how to change the prices of shops (and finding nothing) I decided to search ff7.exe with a hex editor. Progress has been slow, but I think that I have stumbled across some data for prices in shops. At 0x523B8C in my patched ff7.exe (official patch and chocobo patch) there are some hex bytes with seem to correspond to the prices of Cid's weapons (and the data starting at 0x5219C8 is dialogue from shops - what, I wonder, are the spaced-out bytes from 0x521E18 to 0x52381D?). There are lots of other bytes in that part of the file that look like prices as well. I'll do some more searching tonight; who knows what will be found? Maybe nothing, maybe something; maybe someone else might have something to add...

My apologies if all of this has already been discovered and I am reinventing the wheel.

EDIT: They ARE prices: I changed the prices for potions and Phoenix downs

EDIT2: RESULT! EUREKA! :-D

I was looking for the prices at which master materia could be sold, but couldn't find anything of which I could be sure. Then, an idea came to me: why not mash the numbers on my keyboard like a hyperactive five-year-old and see what happens? I did, and when I loaded the game, the prices for master materia were FUBAR (the R standing for recognition - I made a backup, of course).

It turns out that the prices from master materia are from 0x523E58 to 0x523FC3 - the price is the decimal conversion of the hex bytes x 70, so "All" materia (at 0x523EB4) is 1 400 000/70, or 4E20 (shown as 204E in a hex editor). I changed it to 7D0, and now mastered "All" materia sells for 140 000 gil.

EDIT3:

Those "spaced-out bytes from 0x521E18 to 0x52381D" are, as I should have known, the items and materia that the shops sell, and also determine the text at the top of the screen in some way. By changing 0x521EE0 from 31 to 50 I managed to get the materia seller in the Sector 7 slums to sell "Leviathan" materia instead of "Fire".

I'm waiting nervously for someone to reply "we found this already!"
« Last Edit: 2008-10-12 01:17:23 by Leighos Kudistos Megistos »

Tyler_Wu

  • Cool newbie
  • *
  • Posts: 64
  • Karma: 0
    • View Profile
Re: Changing the prices of things in shops
« Reply #1 on: 2008-10-12 03:15:07 »
That's awesome, i wouldn't even be able to memorize how to use a hex editor.

I think Gjoerulvs had changed the prices that mastered materia sell for, but i dunno about that other stuff you mentioned like changing the prices of things in shops.

Armorvil

  • Freak
  • *
  • Posts: 621
  • Karma: 0
  • Working on : FFVII Total Grudge
    • View Profile
Re: Changing the prices of things in shops
« Reply #2 on: 2008-10-12 13:30:50 »
Wow, great work figuring this out !

On the PSX version, this data is located in the SHOPMENU.MNU file. Your topic gave me the urge to do some research, and I figured out where the prices for items are located.
In this PSX file, the items' prices are located at offset 0x6854.
The price for Potion is there and is comprised of two bytes : 32 00 (50 gil). Then, two bytes after this one (I don't know what those 2 bytes are used for, they are always 00 00), there is the price for the next item (Hi-Potion) : 2C 01 (300 gils). Then, we have 00 00 again, 02 00 (the price for the X-Potions), 00 00, DC 05 for the price of Ethers, etc...

If you want to find out at which offset in the PC version (in FF7.exe) this data is stored, just search for these bytes in your hex editor :

32 00 00 00 2C 01 00 00 02 00 00 00 DC 05 00 00 02 00 00 00 02 00 00 00 02 00 00 00 ...

The items are listed in the same order as in the kernel.

On a side note, could you give me a list of bytes in the area where you found the ALL materia's cost, LKM ? It would allow me to search for them in the SHOPMENU.MNU file :D

EDIT : Never mind about me asking about a series of bytes to find the materia's prices. I found it. After the items, there are a bunch of 00s and then there are the weapons' prices (starting with Cloud's, etc). Maybe the armor's prices are in there too. Then there are a bunch of FFs and we get the materia's prices - once again in the kernel's order (meaning that it starts with MP Plus, HP Plus, Speed Plus, Magic Plus, etc).

What I would like to find though, is the byte responsible for a mastered materia's price. The price for a mastered materia is 70 x its initial price, and it's way too high IMO.
« Last Edit: 2008-10-12 14:39:23 by Armorvil »

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #3 on: 2008-10-12 14:30:03 »
Look for;

Code: [Select]
00 00 00 00 20 4E 00 00 01 00 00 00
The materias are all in order of their ID number, and their data is directly below the data for weapon prices, sandwiched in between several rows of FF filler above and below; it starts with two 40 1F 00 00s and ends with a lot of 01 00 00 00s.

Armorvil

  • Freak
  • *
  • Posts: 621
  • Karma: 0
  • Working on : FFVII Total Grudge
    • View Profile
Re: Changing the prices of things in shops
« Reply #4 on: 2008-10-12 14:41:18 »
Yeah, thanks :)
I managed to find this shortly after I asked.

But did you find the byte responsible for the 70x multiplicator, if the materia becomes a mastered one ? I'd like to change it to a 3x or 4x ...
« Last Edit: 2008-10-12 14:42:57 by Armorvil »

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #5 on: 2008-10-12 15:44:22 »
I see what you mean...

Well, I'm having a few crashing problems at the moment so I can't try anything out, and I don;t have my PSX discs with me. Perhaps you could search for every "46" in SHOPMENU.MNU? Obviously, most of them will refer to items and prices (46 is, after all, the ID for tents), but one of them might determine the multiplicator for master materia. So, you could change it to, say 06 and see what happens.

Maybe you could use elimination: change all of the 46s in the first half of the file and see what happens. If the multiplicator changes, you'll know it's in that half, if it doesn't then it's in the other half (if it is in that file at all - and I imagine it would be), and repeat as necessary; obviously, this is much harder with the PC version (for once).

gjoerulv

  • No life
  • *
  • Posts: 1158
  • Karma: 35
  • me
    • View Profile
    • My Youtube
Re: Changing the prices of things in shops
« Reply #6 on: 2008-10-12 16:27:26 »
This is fantastic! It would be great if you made a patch that reduces the sell price of mastered materias!

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #7 on: 2008-10-12 16:30:22 »
Well, unfortunately I don't know how to make patches yet...

And it looks as if at the moment I have only found the general price of materia rather than the multiplier, so reducing that would reduce the buying price as well.

Still, "All" materia isn't in the shops until late in the game, so maybe reducing the price of just that wouldn't really bother anyone.

EDIT: The multiplier seems not to be in *that* part of ff7.exe (but surely it has to be in that file somewhere, right?); I have tried mashing the keyboard and messing up every value there: everything in the shops is gibberish, but the x70 multiplier for master materia sticks around like a cockroach in a nuclear war zone.
« Last Edit: 2008-10-14 16:33:38 by Leighos Kudistos Megistos »

dziugo

  • No life
  • *
  • Posts: 1474
  • Karma: 3
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: Changing the prices of things in shops
« Reply #8 on: 2008-10-14 18:51:27 »
It's in code section of ff7.

Offsets:
Code: [Select]
0x0031F14F - for actual price when selling
0x0031F19E - probably just for display in shops

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #9 on: 2008-10-14 19:00:56 »
Woohoo! :-D

Thank you, thank you, thank you!

I've set my multiplier to x10; much more reasonable.

Deathblow

  • Fast newbie
  • *
  • Posts: 32
  • Karma: 0
    • View Profile
Re: Changing the prices of things in shops
« Reply #10 on: 2008-10-15 16:54:25 »
I dont understand everything said here, are you saying that you opened ff7.exe in a hex editor and made changes? This looks promising, I was commenting the other day that I wanted to change the value of items in the shops, especially phoenix downs(because a feather from a magical beast that brings people back to life should cost way more than 300gils more like 5000gils and potions to be 1000gils and hi potions 3000gils) and potions and hi-potions so people cant stock up on like 50 of them and now that the "Wall Market" kernel editor you can change the healing power of potions to make them usable in later stages of the game. Ive never sold materia before so Im not interested in that but escalating item prices would make the game more challenging especially when already using different difficulty mods. A program or patch would be great but if someone figures out how to change the prices of phoenix downs, potions and hi-potions please pm me. I would greatly appreciate it

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #11 on: 2008-10-15 18:17:57 »
Quote from: Deathblow
I dont understand everything said here, are you saying that you opened ff7.exe in a hex editor and made changes?

Yes, I first did it when I decided to mod my limit breaks. I thought it would mess up the game, but it didn't; it seems that as long as you always, always, always remember to make a backup, making changes to ff7.exe isn't any different from modding any other part of the game (I could be horribly wrong here, but I haven't had problems yet).

If you want to change the prices of those items look for:

Code: [Select]
32 00 00 00 2c 01 00 00 02 00 00 00 dc 05 00 00 02 00 00 00 02 00 00 00 02 00 00 00 2c 01 00 00
in ff7.exe. In my 5.61kb file they are at 0x523858. I think you've told me somewhere else that you use hex editor neo; if so, then ctrl+G and go to 523858: hopefully you'll see that code. the first 32 00 00 00 is a 50 gil item, namely the potion. Change that e8 03 00 00, save, load the game and then go into a shop. Hopefully potions will cost 1000 gil. The 2c 01 00 00 item next to it is (if I remember correctly) the Hi potion. Change that to  b8 0b 00 00 and it should cost 3000 gil. I think that the second 2c 01 00 00 item is the Phoenix Down (although I haven't checked) change that to 88 13 00 00 and see if the price of Phoenix Downs changes.
« Last Edit: 2008-11-01 11:54:47 by Leighos Kudistos Megistos »

Deathblow

  • Fast newbie
  • *
  • Posts: 32
  • Karma: 0
    • View Profile
Re: Changing the prices of things in shops
« Reply #12 on: 2008-10-15 18:44:56 »
thanks for replying with the quickness. i found that line and ill try it when i get home, by any chance do you know how many columns the exe is? i think its also called byte size ie: kernel.bin5 is 44 columns, kernel.bin6 is 36 columns etc, so that everything lines up properly.

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #13 on: 2008-10-15 18:48:10 »
I don't think that ff7.exe works that way. You could get things to line up in files like kernel.bin5 or 6 because they only have data for weapons or armour, and the sections of data were all the same length; not so ff7.exe (this is another place where I could be completely wrong)

NFITC1

  • No life
  • *
  • Posts: 2903
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Changing the prices of things in shops
« Reply #14 on: 2008-10-15 18:55:09 »
Are these all JUST prices? Any way of editing the shops themselves to change what is sold in them?

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #15 on: 2008-10-15 19:05:16 »
Yes there is! The rather spaced out looking data starting at 0x521e18 0x52381f tells the shops which items to sell: the numbers in the bytes are their item/materia IDs .

As you can see from the third edit to my first post in the thread, I managed to get edits to this data to work. I don't know what order the shops are in (although I imagine that the earlier one meets them in the game, the earlier they appear in the data), nor how to decide whether they sell items or materia, but these can be edited.

NFITC1

  • No life
  • *
  • Posts: 2903
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Changing the prices of things in shops
« Reply #16 on: 2008-10-15 21:59:59 »
As you can see from the third edit to my first post in the thread, I managed to get edits to this data to work. I don't know what order the shops are in (although I imagine that the earlier one meets them in the game, the earlier they appear in the data), nor how to decide whether they sell items or materia, but these can be edited.

Ahh, yes I see now. I also see that in that same data there are a bunch of 1s in front of all that:
Quote
01 00 00 00 31 00 00 00 01 00 00 00 32 00 00 00 01 00 00 00 34 00 00 00 01 00 00 00 35 00 00 00
Those are the indexes of Fire, Ice, Lightning, and Restore. I think that leading one is significant. Telling the game what type of item to sell.
. . .
I just tried changing these 1s to 0s and the store offered Dragon Scales, Impalers, Eye drops, and Molotovs instead of those materia. So it looks like a leading 01000000h indicates materia. Maybe changing this to 02000000h makes them weapons? After looking at the shop data that's not likely going to do anything. I think changing the 01 00 00 00 is the key to changing the type of item, but I'd have to play around with different values to figure out what.
« Last Edit: 2008-10-16 00:57:16 by NFITC1 »

ARMs

  • Crazy poster
  • *
  • Posts: 164
  • Karma: -1
    • View Profile
Re: Changing the prices of things in shops
« Reply #17 on: 2008-10-24 09:25:59 »
anyone know the series of hex code to change the multiplier of a mastered materia.
« Last Edit: 2008-10-24 09:27:49 by ARMs »

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #18 on: 2008-10-24 10:51:28 »
Look for
Code: [Select]
00 6b d2 46 89 55 fc 8b and change the 46h to the multiplier you want; there is another 46h slightly lower down which you should probably change as well.

Unfortunately, I don't have my PSX discs with me, so I can't find where they are in that version; unless someone here can help you, you'll just have to look for them by searching the individual files.
« Last Edit: 2008-10-24 10:53:12 by Leighos Kudistos Megistos »

ARMs

  • Crazy poster
  • *
  • Posts: 164
  • Karma: -1
    • View Profile
Re: Changing the prices of things in shops
« Reply #19 on: 2009-01-20 20:39:09 »
Has anyone found the multiplier for the psx version.  Hopefully someone found it, cause i been trying but no success.  if not maybe i might try looking for it harder in the future.

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #20 on: 2009-01-20 20:52:24 »
Sorry.  :cry:

I've looked for it a few times as well. And apparently, the PSX version uses a different coding language from the PC version, so perhaps searching for those bytes might not be very helpful.

NFITC1

  • No life
  • *
  • Posts: 2903
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Changing the prices of things in shops
« Reply #21 on: 2009-01-21 13:56:08 »
This is all making me want to make a shop editor, except I can't find any pointer to specific shop data. :( Also, editing an executable could be construed as being a virus. My first MDef fix attempt got caught as a virus because a jump pointer was wrong. :D

Kudistos Megistos

  • Banned
  • No life
  • *
  • Posts: 3936
  • Karma: 1
    • View Profile
Re: Changing the prices of things in shops
« Reply #22 on: 2009-01-21 14:01:06 »
Shop editor? Pity you already used the name Wall Market  :-D

NFITC1

  • No life
  • *
  • Posts: 2903
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Changing the prices of things in shops
« Reply #23 on: 2009-01-21 20:44:28 »
Shop editor? Pity you already used the name Wall Market  :-D

Yeah. :( Maybe I'll call it Costa Del Sol or something. Maybe something boring like FFVIISE. :P Of course, I'll need the shopmenu.mnu file (I'd like someone to send me a copy, plz!) to look at the PSX shops. Those should be easy to edit.

Anyway. I'd like to expound more on what I found earlier in this thread.
Shops consist of 84 bytes in the following pattern: Byte, Byte, Word, 10 x [Word, Word, DWord]. The first Byte I believe has something to do with responses to things like "can't hold", "can't afford", etc. I'm still trying to figure out what the second Byte is. The following Word is the index of the shop's name. Each name is no more than 20 bytes long including the null terminator.
Each set of "Word, Word, DWord" indicates an item to sell in that shop. There are no more than 10 spaces available for items. The first word is 0 if the object to sell is an item/weapon/accessory and 1 if the object is a materia. The second Word doesn't mean anything (it's never referenced) and is always 0. The DWord is an index of the object to be sold. For materia it is just the index that it appears in kernel section 9. Items/Weapons/Accessories use the same indexing method as the Item menu does (though with 0 quantity since shops apparently contain a limitless supply of all goods at all times ;) ). If the first Word, Word, DWord triplet is 0, 0, 0, then it is treated as a potion. It MUST be the first item for the shop to sell a potion. After the first triplet, a 0, 0, 0 will indicate no item.
I'd love it if there was a single place to find the pointer to these shops, but there isn't. :(
« Last Edit: 2009-01-23 14:53:27 by NFITC1 »

ARMs

  • Crazy poster
  • *
  • Posts: 164
  • Karma: -1
    • View Profile
Re: Changing the prices of things in shops
« Reply #24 on: 2009-01-23 03:28:09 »
Hopefully you can find it while working on the shop menu.   This is a very annoying problem for difficulty mods.