Some grass surfing glitch (Spanish and Italian Red/Blue) technical details
Posted by: Torchickens
Date: 2015-08-29 17:28:10
It allows one to encounter Pokémon from the water encounter table, apparently using the grass encounter rate; and by encountering a Trainer, the data in the water encounter table is overwritten, allowing people to encounter Pokémon they normally wouldn't be able to encounter such as 'M (00) and even Mew. The Pokémon available depend on the Trainer.
This glitch seemingly does not work in the English and German versions, as no Pokémon ever appeared for me (however, this may have been down to bad luck). French versions give grass encounters.
The steps for this glitch are:
1) Encounter a Trainer.
2) Surf in the grass (via the Surf down glitch) in a place that doesn't have water encounters.
3) Turn in the grass so you do not dismount your Pokémon until you encounter a wild Pokémon. Often you will dismount the Pokémon. If this happens, reset the game and try again.
The glitch enables you to encounter water encounter table Pokémon (in contrast with how the old man trick gives grass encounter table Pokémon). These are based on the last Trainer you encountered in the session before you saved.
I do not know if it has been documented how exactly the Trainer affects the encounters, so I decided to investigate.
The addresses D8A9 (D8A4 in English versions) and beyond control the water encounter rate (D8A9) and water encounter levels/Pokémon (D8AA+).
It turns out that this area is used for Trainer's Pokémon data as well. The size of this data is of no fixed length; so more data will get written to later addresses if the opponent has e.g. 5 Pokémon compared to 2 Pokémon.
Fortunately, this database is documented under "Opponent Trainer's Pokémon" on the Datacrystal Pokémon Red/Blue article.
Here D8A9 is enemy Pokémon 1's index number, D8AA/D8AB is enemy Pokémon 1's current HP, D8AC is an undocumented address, D8AD is apparently the foe's status, D8AE is type 1, D8AF is type 2 and so on.
If we encounter the Jr Trainer we are facing here:
[img]http://i2.minus.com/ioKN7CuIYWQfU.png[/img]
Then he has a level 20 Squirtle and the data from D8A9 starts B1 00 32 00 00 15 15 2D 21 27 91 37 E4 or:
$B1: Squirtle
$00 $32: 50 current HP
$00: Unknown byte
$00: No status
$15: Type 1 is Water
$15: Type 2 is Water (note that single-typed Pokémon are internally two types of the same value)
$2D: Unknown byte
$21: Move 1 is Tackle
$27: Move 2 is Tail Whip
$91: Move 3 is Bubble
$37: Move 4 is Water Gun
$E4: Trainer ID byte 1; the same as the player (mine is 58602 and if you convert that into hexadecimal, the first byte is $E4. $E4 also applies to an ID between 58368 ($E400) and 58623 ($E4FF)
$EA: Trainer ID byte 2
$00: Experience byte 1
According to this post, the water Pokémon data in English Red/Blue has the same size as the grass Pokémon data (21 bytes), so the data for it should finish at D8BD (Pokémon 1's Attack EV byte 2). IIMarckus says there are 7 level/species pairs for grass and water Pokémon.
Hence from that data we can apply this:
*Water encounter rate = B1 (gets reset to 00 after returning, but water encounter rate in Spanish and Italian Red/Blue for grass surfing).
*Water Pokémon 1 level = 0
*Water Pokémon 1 species = Missingno. (hex:32)* - *if you beat the Pokémon this forces the data to become 0 corresponding to 'M (hex:00)
*Water Pokémon 2 level = 0
*Water Pokémon 2 species = 'M (hex:00)
*Water Pokémon 3 level = 21
*Water Pokémon 3 species = Mew (hex:15)
*Water Pokémon 4 level = 45
*Water Pokémon 4 species = Growlithe (hex:21)
*Water Pokémon 5 level = 39
*Water Pokémon 5 species = Marowak (hex:91)
*Water Pokémon 6 level = 55
*Water Pokémon 6 species = Scientist (hex:E4)
*Water Pokémon 7 level = 234
*Water Pokémon 7 species = 'M (hex:00)
It seems like some manipulable variables for encountering Pokémon are the first enemy Pokémon's current HP byte 1 (if the data does not change after losing to the Trainer), its moves 1-4 (with move 1 and 3 controlling species), the second type (which allowed for Mew with this Jr. Trainer) and the Trainer ID byte 1 (you could possibly keep resetting a new game until this value becomes something useful such as Mewtwo, hex:83 - however, you would have to rely on lots of luck). If the water encounter table actually supports more than 7 level and species pairs, then we may be able to encounter a few more Pokémon such as one based on the Pokémon's last experience byte (total experience modulo 256).
Paco81 has taught that instead of surfing in the grass, you can surf on a rock in the Unknown Dungeon to get the same encounters.
The grass encounter rate in Unknown Dungeon is lower compared to Route 24 ($0A instead of $19), but the trick is useful because when you are on your Pokémon in the grass north of Cerulean City, taking one step will put you off the Pokémon and it is difficult to keep turning around in one grass tile without taking a step. When you are on this rock you can move right and down (but not left because that can dismount you on a walkable part of the rock) without fear of dismounting.
Video of the trick in Route 24:
https://www.youtube.com/watch?v=2jI9LeehZ8E
(click)
Video of the trick used to get Mew:
https://www.youtube.com/watch?v=Qu_t4FSlkt4
(click)
In English Red and Blue, if memory serves right, in the link-up coast exploit the water encounter table becomes corrupted, so this means that possibly one could get different Pokémon with the grass surf glitch that are not based on the last NPC trainer.
Note that if you go to a place with water encounters, the water encounter table gets overwritten.
The last Trainer may be Champion Blue or an Elite Four Trainer, meaning that you do not necessarily need to encounter a Trainer that wasn't used up. With Champion Blue, the data stays even after the credits sequence.
This glitch can be done with blacking out against the Trainer as well as winning against them. If you lose before taking down a Trainer's first Pokémon, then the current HP byte 2/water encounter 1 species address can remain as a value other than hex:00 ('M 00).
I have made some notes about this glitch (as well as the old man glitch) in another post, which you may be interested in reading. http://forums.glitchcity.info/index.php/topic,7332.msg198917.html#msg198917