• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Tool✓] Prize corner editor help?

15
Posts
6
Years
Hey I'm working on a slightly tweaked version of Leaf Green and am having trouble editing the Game corner prizes.
I haven't found a tool to edit them and I'm so new to hex editing it's a bit over my head

Any help would be appreciated
thanks in advance
 
Last edited:

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
Hey I'm working on a slightly tweaked version of Leaf Green and am having trouble editing the Game corner prizes.
I haven't found a tool to edit them and I'm so new to hex editing it's a bit over my head

Any help would be appreciated
thanks in advance

Changing the Game Corner prizes requires two changes to be made, firstly, editing the prizes given (and their associate prices) which can be done easily through scripting and secondly, changing the multichoice box which will require some hex editing as you're using LG. FR has a multichoice box editor that would make the second part a lot easier but it isn't available for LG. I'd strongly recommend that you change over to a FR ROM as almost all of the community's research and tool development has been focused on it while LG is rarely given a second thought. Anyway, here's a guide on how to change the Game Corner prizes in LG. As always, make a back-up of your ROM before you make any major changes in case something goes horribly, horribly wrong.

Firstly, it is pretty simple to change the rewards you receive through scripting with a tool like XSE. Here's the script for the left-most attendant with dynamic pointers and some comments I added to help better understand what is happening in the script.

Spoiler:


The parts that you want to pay attention to are the @Choice pointers as they determine what you will receive depending on your answer. Variable 0x4001 is the ID for the item that you will receive while 0x4002 determines how much it costs in coins. For example, @Choice1 sets 0x4001 to 0xC2 (Smoke Ball) and 0x4002 to 0x320 (800 coins). You can find a list of item IDs in diegoisawesome's XSE tutorial, though you will need to convert them into hexadecimal notation. These variables are checked for several different uses later on: buffering the item's name, checking if you have enough coins and checking if your bag is full before finally giving you the item and subtracting the price.

The other two attendants vary slightly but ultimately function similarly. Just search for the parts of their scripts that are similar to the @Choice parts and you'll be able to easily edit what they give you. If you were to play your game after changing the attendant's scripts you will receive your new prizes, however the multichoice boxes will still display their original text. Here is the tricky part where we need to hex edit.

This thread gives an overview of how to edit multichoice boxes in FR and is largely applicable to LG, however the pointers are different between the two versions. The FR table of multichoice boxes starts at 0x3E04B0 while the LG ones start at 0x3E035C. The mutlichoice box numbers that we're looking for are 0xE (Pokemon attendant), 0x1E (TM attendant) and 0x29 (Item attendant). For this example I'm going to continue using the item attendant, but all three tables can be edited in exactly the same way.

Firstly, you need to find the pointer to your chosen multichoice box. Since we know how the table is constructed (thanks to JPAN's thread) we only need to do a little bit of maths to figure out which pointer we need. The length of each table entry is 8 bytes with the first occurring at 0x3E035C. Knowing this, we can find any entry with the mathematical operation: (0x8 * 0xTableID) + 0x3E035C. When I replace 0xTableID with 0x29 we get the result 0x3E04A4. When you go to that pointer in the editor you should see the data string "2C FE 3D 08 06 00 00 00" - this is the data for our multichoice box. An easy way to check if you've gotten the correct location is to check the fifth byte and make sure that it lines up with the number of choices in your multichoice box. Since our fifth byte is 06 we can be sure that this is the data we're looking for as that is the number of options available to use (five items and an exit command). You can also edit this byte to another number (no greater than 08) to change the number of options available. If you want to have more options than six for multichoice 0x29 you will need to do some more repointing that I won't be covering unless you need it.

The part that we're interested in is the reversed pointer making up the first four bytes of the table entry. To make the pointer usable we need to swap its constituent parts around, reversing the order of each byte. Our pointer should look like this:

2CFE3D08 - > [2C] [FE] [3D] [08] -> [08] [3D] [FE] [2C] -> 083DFE2C - > 0x3DFE2C

Goto the resulting pointer in your hex editor and you should see a another data table with the structure "XXXXXXXX 00000000" where the Xs are a reversed pointer. These ones are a different to the ones we were messing with above as these are text pointers and point to the text strings that we see in the multichoice box. At this pointer we can open up XSE again and prepare a new string to replace these ones. You can make a simple text pointer by compiling this script:

Spoiler:


The '\c\h13\h50' part of the text is a special command that shifts the following text to the right-most side of the box. The '' part miniaturises the text, making it look more stylish.

Write down the location where the text script is inserted and make a reverse pointer of it. Using the example I showed above, if the text was inserted at 08812345 our reversed pointer would be 45238108. Overwrite the original pointer and save it. When you test it out in game the first option's text should have changed to a Lucky Egg. Go 8 bytes ahead to the next pointer and repeat this until you've changed every option with custom text.

I know that you said that hex editing is a bit over your head at this point in time, but since you're using LG there are no tools to change multichoice boxes. Hopefully this is helpful - I'm pretty sleepy so I'm sure there's something that I explained pretty badly somewhere in there. If you have any questions feel free to post them and I'll try to help out again.
 
15
Posts
6
Years
thanks!
heheh certainly a lot to take in

through my own tinkering I managed to find out how to change stuff like the pokemon and coin values and stuff but I somehow caused the starting message of all the clerks (not just the middle guy I was working on) to go from "We exchange...." to " e exchange...." despite not directly doing anything to them.

following that I'm having trouble saving and uploading the updated scripts to the main rom (clicks but no messages) but that's probably a basic fix I can look into after I get sleep

Here's what the first part looks like if you're curious:
'---------------
#dynamic 0x800052
#org @start
'---------------
#org 0x16CB64
lock
faceplayer
checkflag 0x243
if 0x0 goto 0x816CD75
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x81A7ABC
showcoins 0x0 0x0
msgbox 0x8197033 MSG_KEEPOPEN '" e exchange your COINS for prizes."
goto 0x816CB8E

'---------------
 
15
Posts
6
Years
Slowly figuring it out

Managed to get the given prizes and costs to work but the list still displays the old stuff like the Doc said(i.e. lists clefairy at 750 coins -> select -> so you want pikachu? -> yes -> deducts 620 coins and pikachu acquired)
Firstly, you need to find the pointer to your chosen multichoice box. Since we know how the table is constructed (thanks to JPAN's thread) we only need to do a little bit of maths to figure out which pointer we need. The length of each table entry is 8 bytes with the first occurring at 0x3E035C. Knowing this, we can find any entry with the mathematical operation: (0x8 * 0xTableID) + 0x3E035C. When I replace 0xTableID with 0x29 we get the result 0x3E04A4. When you go to that pointer in the editor you should see the data string "2C FE 3D 08 06 00 00 00" -
Tried looking this bit up and, unless I'm horribly confused on how looking up pointers in xse, I didn't get the same search result but a warp bit instead

I'll have to slightly redo the scripting for the other clerks too to fix that weird dialogue quirk I mentioned.
 
Last edited:

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
Slowly figuring it out

Managed to get the given prizes and costs to work but the list still displays the old stuff like the Doc said(i.e. lists clefairy at 750 coins -> select -> so you want pikachu? -> yes -> deducts 620 coins and pikachu acquired)

Tried looking this bit up and, unless I'm horribly confused on how looking up pointers in xse, I didn't get the same search result but a warp bit instead

I'll have to slightly redo the scripting for the other clerks too to fix that weird dialogue quirk I mentioned.

I knew I had forgotten something in my sleep-deprived mind. The multichoice editing part of my post is all meant to be done in a hex editor, not XSE. Since you're having some difficulty, here's an addendum that will walk you through it a bit better.

Using the mathematical operation in my post, we get these three pointers: 0x3E03CC, 0x3E044C and 0x3E04A4 for multichoice boxes 0xE, 0x1E and 0x29 respectively. If you jump to these three locations in a hex editor using the 'go to' function you will arrive at a pointer. You need to reverse these pointer in the way I stated in my earlier post. When you do that you will see that these pointers are pointing to 0x3E0074, 0x3DFDFC and 0x3DFE2C. If you go follow this second set of pointers you will be directed to six pointers that point towards the text that is displayed for each option in the multichoice box. Here's some screenshots of where they are and what they look like:

Spoiler:


Now all you have to do is replace each pointer highlighted with custom text like the one in my previous post. Compile your text in XSE, note down the pointer you receive and reverse it like I did (once again in my first post). Replace the pointers that are highlighted in these screenshots with your reversed pointers and it should go fine. But you should still make a back up before doing all of this!

Hopefully the images of your end destination are a bit more helpful than just dumping info on you~

thanks!
heheh certainly a lot to take in

through my own tinkering I managed to find out how to change stuff like the pokemon and coin values and stuff but I somehow caused the starting message of all the clerks (not just the middle guy I was working on) to go from "We exchange...." to " e exchange...." despite not directly doing anything to them.

following that I'm having trouble saving and uploading the updated scripts to the main rom (clicks but no messages) but that's probably a basic fix I can look into after I get sleep

Here's what the first part looks like if you're curious:
'---------------
#dynamic 0x800052
#org @start
'---------------
#org 0x16CB64
lock
faceplayer
checkflag 0x243
if 0x0 goto 0x816CD75
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x81A7ABC
showcoins 0x0 0x0
msgbox 0x8197033 MSG_KEEPOPEN '" e exchange your COINS for prizes."
goto 0x816CB8E

'---------------

As for your text issue you're having, that's happening because you're compiling scripts with static (rather than dynamic) pointers and have overwritten the 'W' in their speech. You've put '@start' which is a dynamic pointer at the start of your script, but it isn't connected to anything while everything else are still static pointers (e.g 0x16CB64). You need to change all of the static pointers into dynamic pointers in order to compile scripts without the possibility of overwriting data that's already in the ROM. It might take some time, but it worth it so you don't have headaches like the one you're experiencing.
 
15
Posts
6
Years
I knew I had forgotten something in my sleep-deprived mind. The multichoice editing part of my post is all meant to be done in a hex editor, not XSE. Since you're having some difficulty, here's an addendum that will walk you through it a bit better.

Using the mathematical operation in my post, we get these three pointers: 0x3E03CC, 0x3E044C and 0x3E04A4 for multichoice boxes 0xE, 0x1E and 0x29 respectively. If you jump to these three locations in a hex editor using the 'go to' function you will arrive at a pointer. You need to reverse these pointer in the way I stated in my earlier post. When you do that you will see that these pointers are pointing to 0x3E0074, 0x3DFDFC and 0x3DFE2C. If you go follow this second set of pointers you will be directed to six pointers that point towards the text that is displayed for each option in the multichoice box. Here's some screenshots of where they are and what they look like:

Spoiler:


Now all you have to do is replace each pointer highlighted with custom text like the one in my previous post. Compile your text in XSE, note down the pointer you receive and reverse it like I did (once again in my first post). Replace the pointers that are highlighted in these screenshots with your reversed pointers and it should go fine. But you should still make a back up before doing all of this!

Hopefully the images of your end destination are a bit more helpful than just dumping info on you~
Was really hoping that'd solve it but I get completely different results for the 'go-to'.
It's on the correct line but (for the 0xE example for 0x3E0074) instead of the pictured results it comes out:
A5 7E 41 08 00 00 00 00 04 60 41 08 00 00 00 00
B9 7E 41 08 00 00 00 00 CA 7E 41 08 00 00 00 00
D8 7E 41 08 00 00 00 00 65 77 41 08 00 00 00 00

So either the rom base is off, I'm doing something wrong, or some other deal is going on.
Either way Murphy's Law is out for me
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
Was really hoping that'd solve it but I get completely different results for the 'go-to'.
It's on the correct line but (for the 0xE example for 0x3E0074) instead of the pictured results it comes out:
A5 7E 41 08 00 00 00 00 04 60 41 08 00 00 00 00
B9 7E 41 08 00 00 00 00 CA 7E 41 08 00 00 00 00
D8 7E 41 08 00 00 00 00 65 77 41 08 00 00 00 00

So either the rom base is off, I'm doing something wrong, or some other deal is going on.
Either way Murphy's Law is out for me

Alright, I just realised that I had a LG v1.1 ROM. I had to download it just to answer this question so my apologies.

In the LG v1.0 ROM, the multichoice table begins at 0x3E02EC, meaning that ones we're after have pointers at 0x3E035C (0xE), 0x3E03DC (0x1E) and 0x3E0434 (0x29). Following each respective pointer we go to 0x3E0004, 0x3DFD8C and 0x3DFDBC. Here are the correct pointers you need to change:

Spoiler:
 
15
Posts
6
Years
Did some workarounds and solved some technical issues I was having troubles with.
Should all be functioning properly now
Thanks for the assists Doc! Sorry for any headaches~
 
Back
Top