pokemonforever27
IS RIDING LUGIA...
- 55
- Posts
- 16
- Years
- At the computer...
- Seen Feb 3, 2019
If you play long enough and make it to the TRAINER TOWER in many POKEMON games, one of the things that's unique about the tower is that the trainers' POKEMON in there all match the highest level of your POKEMON. That's the only place in the game where that occurs.
After hours of digging through commands, tutorials, FIRERED TRAINER TOWER scripts, and tools, I finally figured it out! This comes in four parts:
PART A - JPAN/pokemonforever27's LevelCheck ASM routine
When Darthatron first suggested I look into JPAN's hacked FIRERED engine, I thought "I'm stumped now, I'll look into it." So I took a look, and that solved part of the problem. A way to do this was implemented, but that still didn't solve the burning question in my head: What is THE way? So I dug more. Eventually, JPAN posted an ASM routine that would store the highest level in LASTRESULT. I then took to learning ASM, and finally got it and the CheckLevel routine learned. This is also when I realized how GAMEFREAK did it.
PART B - GAMEFREAK's Method
GAMEFREAK's method is rather long and drawn out. It consists of checking party pointers in variables and comparing them until all possible combinations have been exhausted. The process is so long, in fact, that trying to read through it all is next to impossible. It takes them over 400 lines of code to make the check! Why do it this way? Well, because they only had to code it once (in the TRAINER TOWER). Since it was only needed once, why go through the extra trouble to make the function? The battles are custom as well, in a similar fashion. There are actually 4 hidden person events that setup the custom battles. I've included images in the attachment so that you can take a look at the script and person events for yourself.
PART C - Mysterious msgbox
The one thing that puzzled me though, even after figuring out their method, is a textbox. You can find it's code in the file "MSGBOX.txt" in the attachment. Confused? I'd be surprised if you weren't. I didn't dig into every command in this one like I did the LevelCheck because that wasn't what I was researching. However, somehow, these commands, when called in the form "msgbox 0x2021D18 MSG_KEEPOPEN" repeat the last string the player read. If you talk to the girl in PALLET TOWN she'll say something about raising strong POKEMON, then execute this script, it will say the same thing. If you talk with the man about technology and the PC, the script will say the same thing. Even go so far as to say "Previously on your quest..."
PART D - End result
The best method for implementing this is to learn ASM, and write a simple routine to checklevels there. GAMEFREAK's method would take way too long to decipher fully, and the time could be better spent learning something that could be far more powerfull to know. I still have some work to do on implementation, but then I'll include a patch for FIRERED in the attachment. For now, use JPAN's engine.
SPECIAL THANKS
Nintendo/GAMEFREAK - POKEMON FIRERED VERSION
Forgotten and the VBA team - VisualBoyAdvance Emulator
HackMew - XSE; ASM Tutorials
LU-HO Poke - Advance Map
PokeCommunity - Hosting the ROM hacking scene
JPAN - Helping me learn ASM; ASM Tutorials; getting me started; FireRed Hacked Engine
interdpth - GetLevel Function; Simple ASM routine; LevelCheck routine in POKEMON EMERALD
Darthatron - Getting me started; Fixing the memory address for LASTRESULT
Goals:
1. Figure out how GAMEFREAK checks the levels of the player's POKEMON. - DONE
2. Work out the bugs of the script and implement it. - 90% DONE
3. Write in a simple command (e.x. "checkpokemonlevel") to call the function. - DONE (JPAN's hacked engine)
Any suggestions are both appreciated and encouraged.
After hours of digging through commands, tutorials, FIRERED TRAINER TOWER scripts, and tools, I finally figured it out! This comes in four parts:
PART A - JPAN/pokemonforever27's LevelCheck ASM routine
When Darthatron first suggested I look into JPAN's hacked FIRERED engine, I thought "I'm stumped now, I'll look into it." So I took a look, and that solved part of the problem. A way to do this was implemented, but that still didn't solve the burning question in my head: What is THE way? So I dug more. Eventually, JPAN posted an ASM routine that would store the highest level in LASTRESULT. I then took to learning ASM, and finally got it and the CheckLevel routine learned. This is also when I realized how GAMEFREAK did it.
PART B - GAMEFREAK's Method
GAMEFREAK's method is rather long and drawn out. It consists of checking party pointers in variables and comparing them until all possible combinations have been exhausted. The process is so long, in fact, that trying to read through it all is next to impossible. It takes them over 400 lines of code to make the check! Why do it this way? Well, because they only had to code it once (in the TRAINER TOWER). Since it was only needed once, why go through the extra trouble to make the function? The battles are custom as well, in a similar fashion. There are actually 4 hidden person events that setup the custom battles. I've included images in the attachment so that you can take a look at the script and person events for yourself.
PART C - Mysterious msgbox
The one thing that puzzled me though, even after figuring out their method, is a textbox. You can find it's code in the file "MSGBOX.txt" in the attachment. Confused? I'd be surprised if you weren't. I didn't dig into every command in this one like I did the LevelCheck because that wasn't what I was researching. However, somehow, these commands, when called in the form "msgbox 0x2021D18 MSG_KEEPOPEN" repeat the last string the player read. If you talk to the girl in PALLET TOWN she'll say something about raising strong POKEMON, then execute this script, it will say the same thing. If you talk with the man about technology and the PC, the script will say the same thing. Even go so far as to say "Previously on your quest..."
PART D - End result
The best method for implementing this is to learn ASM, and write a simple routine to checklevels there. GAMEFREAK's method would take way too long to decipher fully, and the time could be better spent learning something that could be far more powerfull to know. I still have some work to do on implementation, but then I'll include a patch for FIRERED in the attachment. For now, use JPAN's engine.
SPECIAL THANKS
Nintendo/GAMEFREAK - POKEMON FIRERED VERSION
Forgotten and the VBA team - VisualBoyAdvance Emulator
HackMew - XSE; ASM Tutorials
LU-HO Poke - Advance Map
PokeCommunity - Hosting the ROM hacking scene
JPAN - Helping me learn ASM; ASM Tutorials; getting me started; FireRed Hacked Engine
interdpth - GetLevel Function; Simple ASM routine; LevelCheck routine in POKEMON EMERALD
Darthatron - Getting me started; Fixing the memory address for LASTRESULT
Goals:
1. Figure out how GAMEFREAK checks the levels of the player's POKEMON. - DONE
2. Work out the bugs of the script and implement it. - 90% DONE
3. Write in a simple command (e.x. "checkpokemonlevel") to call the function. - DONE (JPAN's hacked engine)
Any suggestions are both appreciated and encouraged.
Last edited: