Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Generation I Glitch Discussion

Text box matching for Trainer-Fly glitch - Page 1

Text box matching for Trainer-Fly glitch

Posted by: ISSOtm
Date: 2015-04-13 14:02:42
Hello everyone, ISSOtm here !

Today, the question that was brought up to my attention was "How does the text box matching method of the Trainer-Fly glitch work ?".

After a bit of research, it appears that when you encounter a Trainer, the following happens (all memory addresses are taken from Pokémon Blue) :

This address ($D059) is an instant encounter. As soon as the overworld script reads a non-zer value, the game triggers the corresponding encounter. But what's interesting, is that the Trainer-Fly glitch actually is built on this.
As soon as you enter the map flown from (which probably has its map script pointer changed ?), the last text box in memory pops up, then the encounter begins.
If looking at this sequence with a memory point of view, it gives the following :


Question 1 : During a TFly glitch, why is the value picked up from $CFFC ?
Answer : I don't know. I'm looking for that in the disassembly, see that later.

Question 2 : May this be used for ACE ?
Answer : I don't know either… It would mean a text box (with an invalid ID, I presume) runs code in player-controllable RAM. I'm looking both in the disassembly and testing on BGB. Stay tuned !
That would require $CFFC to hold an incorrect value… is that possible (like with Super Glitch ?)

Re: Text box matching for Trainer-Fly glitch

Posted by: luckytyphlosion
Date: 2015-04-14 17:48:18
Quickly looked in bgb debugger, $CFFC is the high byte of the last enemy Pokemon.

However, $CFFC is the Special Value from the Pokemon Structure, and NOT the Special Value used to generate the Trainer-Fly encounter.

I wouldn't know why $CFFC is written to $D058, since it's "wPartyGainExpFlags" according to the disasm.

Re: Text box matching for Trainer-Fly glitch

Posted by: ISSOtm
Date: 2015-04-15 03:18:22
According to DataCrystal, CFFC-CFFD - Special (enemy)

But yeah, changing this value doesn't change the encounter.
Which one is used for the TFly encounter ? I cannot find it.

Re: Text box matching for Trainer-Fly glitch

Posted by: luckytyphlosion
Date: 2015-04-16 21:29:02
It should be $cd2d, which is wEngagedTrainerClass in the disasm. Note that the above value, wEnemyMonUnmodifiedSpecial, is only ds 1, which means the total special value is overlapped with wEngagedTrainerClass.

Re: Text box matching for Trainer-Fly glitch

Posted by: ISSOtm
Date: 2015-04-21 06:52:52

It should be $cd2d, which is wEngagedTrainerClass in the disasm. Note that the above value, wEnemyMonUnmodifiedSpecial, is only ds 1, which means the total special value is overlapped with wEngagedTrainerClass.

Makes sense (including for the "modulo 256" constraint). My bad :P

I'm looking for text boxes that may cause code to be executed in player-controllable RAM (I mean party/boxed Pokémon, Daycare Pokémon, and bag/PC items data. Maybe in-battle Pokémon data and Pokédex flags too ? It seems trickier anyway.)

Re: Text box matching for Trainer-Fly glitch

Posted by: Torchickens
Date: 2015-04-21 09:48:11
Cool. If you can find such a script source, I'd appreciate it if you can post it in this thread. :)