Skip to content

Commit d4b73f6

Browse files
committed
Detailed explanations + pokemon names in uppercase
1 parent c7142e8 commit d4b73f6

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

_posts/2024-10-02-Pokemon-Glitches.md

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The following commands are a huge help when we want to debug our actions, pause
7676

7777
## Pokemon Yellow
7878

79-
In the game you start with one Pokemon, a `Pikachu` at level 2, given by Professor Oak. You also get some $$ from your mother, you should keep it safe because we will need 550$ to buy an `Escape Rope` for one of the glitches below.
79+
In the game you start with one Pokemon, a `PIKACHU` at level 2, given by Professor Oak. You also get some $$ from your mother, you should keep it safe because we will need 550$ to buy an `Escape Rope` for one of the glitches below.
8080

8181

8282
## Long Range Trainer Glitch
@@ -135,16 +135,16 @@ Now we want to modify another value in memory located at `$CD2D` which correspon
135135

136136
At this point in the game you can either go in the grass to find a wild pokemon, but we won't know its SPECIAL stat (unless you print the content of the address in your debugger `ex $CD2D`). Doing the glitch that way will be tedious, and will force us to restart the device every time the value is not the one we want... Or we can initiate a battle against a trainer, they have a fixed pokemon, meaning they always have the same stats.
137137

138-
Let's do it with the first trainer in the GYM, he has a Digglet with a special stat of 14 (`0x0e`). This value will have a direct impact on the next pokemon we will encounter.
138+
Let's do it with the first trainer in the GYM, he has a `DIGGLET` with a special stat of 14 (`0x0e`). This value will have a direct impact on the next pokemon we will encounter (spoiler alert: it will be a `GENGAR`).
139139

140140
![](/images/PokemonGlitches/get-the-pokemon.png)
141141

142-
For Pokemon Red and Blue, there is a map of trainers and the next pokemon you will get. Small warning, the map is huge, [map by ryumaster](https://puu.sh/257S). You will quickly realize that the pokemons are not ordered using the Pokedex ID, for example: Rydhon is the first one, so if you want a specific pokemon you will need the following list:
142+
For Pokemon Red and Blue, there is a map of trainers and the next pokemon you will get. Small warning, the map is huge, [map by ryumaster](https://puu.sh/257S). You will quickly realize that the pokemons are not ordered using the Pokedex ID, for example: RYDHON is the first one, so if you want a specific pokemon you will need the following list:
143143

144144
* [List of Pokémon by index number in Generation I - Bulbagarden](https://bulbapedia.bulbagarden.net/wiki/List_of_Pokémon_by_index_number_(Generation_I))
145145
* [rbydigit.txt - ocf.berkeley.edu](http://www.ocf.berkeley.edu/~jdonald/pokemon/mewglitch_files/rbydigit.txt)
146146

147-
But why is the SPECIAL stat impacting the ID of the next Pokemon ? It lies within the `UNION` and `NEXTU` keywords used in the `raù/wram.asm` file to define how the memory is structured.
147+
But why is the SPECIAL stat impacting the ID of the next Pokemon ? It lies within the `UNION` and `NEXTU` keywords used in the `ram/wram.asm` file to define how the memory is structured.
148148

149149
* **UNION** is a directive that allows you to overlay multiple structures or data definitions in the same memory space.
150150
* **NEXTU** is used to move to the next structure or field within the same union space
@@ -165,7 +165,7 @@ wEngagedTrainerSet = 6
165165

166166
But this is also used for wild Pokemon, the first variable is used to define the **ID**, and the second is the **LEVEL**.
167167

168-
For example, the following data is a Gengar level 35.
168+
For example, the following data is a GENGAR level 35.
169169

170170
{% highlight powershell%}
171171
wEngagedTrainerClass = 14 (0xe)
@@ -190,18 +190,33 @@ In short we can alter the level from a range of 1 to 13. It can be done using th
190190
* Range from 7 to 1 for down modifier (ATK ⬇️, DEF ⬇️, SPEED ⬇️)
191191
* Range from 7 to 13 for up modifier (ATK ⬆️, DEF ⬆️, SPEED ⬆️)
192192

193+
194+
Here is a quick example of downgrading the ATK modifier to 1 using the `Growl` ability several times .
195+
196+
![](/images/PokemonGlitches/set-atk-mod-growl.gif)
197+
198+
199+
Now the memory should look like this, after battling a wild pokemon anywhere between Pewter Gym and the Viridian Forest.
200+
201+
{% highlight powershell%}
202+
wEngagedTrainerClass = 14 (0xe)
203+
wEngagedTrainerSet = 1
204+
# Gengar LVL1
205+
{% endhighlight %}
206+
207+
193208
Quick note: The level can't go below 1 with this technique.
194209

195210
![](/images/PokemonGlitches/gadget-set-level.png)
196211

197212

198213
## Start Battle & Weird Textbox
199214

200-
Now it's time to trigger this battle with our Gengar. Going into the grass and getting attacked by wild Pokemon is not the correct way as it will update the fields `EnemyMonUnmodifiedSpecial` and `MonEnemyAttackMod` in the memory.
215+
Now it's time to trigger this battle with our GENGAR since we have tailored the memory to be the Pokemon #14 at the level 1. Going into the grass and getting attacked by wild Pokemon is not the correct way as it will update the fields `EnemyMonUnmodifiedSpecial` and `MonEnemyAttackMod` in the memory.
201216

202-
Actually it is way easier than that, when we escaped the battle using the « `Escape Rope` », we put the meta-map script ID into an inconsistent state.
217+
Actually it is way easier than that, when we escaped the battle using the « `Escape Rope` », we put the meta-map script ID into an inconsistent state. `Meta-map scripts` are also called `GameProgressFlags`, its a list of events used to execute code on the current maps, for example, on the first map you can't walk into the grass until you advance further into the story, it is disabled later by changing the ID of the meta-map script.
203218

204-
By default the map searches for trainers: `CheckFightingMapTrainers` (0), but we left it with `DisplayEnemyTrainerTextAndStartBattle` (1) when the « ! » mark appeared.
219+
By default the map of the Viridian forest searches for trainers: `CheckFightingMapTrainers` (0), but we left it with `DisplayEnemyTrainerTextAndStartBattle` (1) when the « `!` » mark appeared before we "escape".
205220

206221
![](/images/PokemonGlitches/metaname-script-id.png)
207222

@@ -213,9 +228,9 @@ The textbox you get before the battle is the same ID as the last text box in mem
213228

214229
Depending on which choice you made to generate the next pokemon, it will have one of these values.
215230

216-
* ID: 09: Talk to sign at the PokeCenter
217-
* ID: 02: GYM Trainer talk
218-
* ID: 05: NPC from Pewter City
231+
* **ID: 09**: Talk to sign at the PokeCenter
232+
* **ID: 02**: GYM Trainer talk
233+
* **ID: 05**: NPC from Pewter City
219234

220235
![](/images/PokemonGlitches/textbox-list-map.png)
221236

@@ -228,13 +243,13 @@ Capturing the Pokemon is left as an exercise for the reader. Even if it is a lev
228243

229244
## Experience Underflow
230245

231-
Now we are done with memory manipulations, we have captured our Gengar. Let's talk a bit about **Experience Algorithms**.
246+
Now we are done with memory manipulations, we have captured our GENGAR. Let's talk a bit about **Experience Algorithms**.
232247

233248
In Pokemon Red, Blue and Yellow, there are 6 experience algorithms but only 4 are really used in the code: `Medium Fast`, `Medium Slow`, `Fast` and `Slow`.
234249

235250
![](/images/PokemonGlitches/experience-algorithms.png)
236251

237-
Here is a list of Pokemons belonging to the `Medium Slow` group: Bulbasaur , Ivysaur, Venusaur, Charmander, Charmeleon, Charizard, Squirtle, Wartortle, Blastoise, Pidgey, Pidgeotto, Pidgeot, Nidoran♀, Nidorina, Nidoking, Nidoran♂, Nidorino, Nidoqueen, Oddish, Gloom, Vileplume, Poliwag, Poliwhirl, Poliwrath, Abra , Kadabra , Alakazam, Machop, Machoke, Machamp, Bellsprout, Weepinbell, Victreebel, Geodude, Gravler, Golem, Gastly, Haunter, Gengar, Mew.
252+
Here is a list of Pokemons belonging to the `Medium Slow` group: BULBASAUR , IVYSAUR, VENUSAUR, CHARMANDER, CHARMELEON, CHARIZARD, SQUIRTLE, WARTORTLE, BLASTOISE, PIDGEY, PIDGEOTTO, PIDGEOT, NIDORAN♀, NIDORINA, NIDOKING, NIDORAN♂, NIDORINO, NIDOQUEEN, ODDISH, GLOOM, VILEPLUME, POLIWAG, POLIWHIRL, POLIWRATH, ABRA , KADABRA , ALAKAZAM, MACHOP, MACHOKE, MACHAMP, BELLSPROUT, WEEPINBELL, VICTREEBEL, GEODUDE, GRAVLER, GOLEM, GASTLY, HAUNTER, GENGAR, MEW.
238253

239254
Do you see the problem with the Polynomial Function used for this group ?
240255

@@ -245,15 +260,17 @@ Despite the experience being for an extremely high level, you only need `1 059 8
245260
![](/images/PokemonGlitches/math-experience-underflow.png)
246261
![](/images/PokemonGlitches/python-experience-plot.png)
247262

248-
In short, if your level 1 Pokemon gains less than 54 XP, its current level will be computed from its previous XP, getting level 100 in one battle !
263+
In short, if your level 1 Pokemon gains less than 54 XP, its current level will be computed from its previous XP. Do you recall how much it was ? Our pokemon had over 16 777 162 XP, getting level 100 in one battle !
249264

250265
![](/images/PokemonGlitches/gengar-level-100.gif)
251266
![](/images/PokemonGlitches/gengar-lvl100.mp4)
252267

268+
**Pro tip**: Don't fight with your level 1 Pokemon, it is mostly likely not strong enough (unless its a METAPOD, they don't do damage).
269+
253270

254-
## BONUS 1 - Mew
271+
## BONUS 1 - MEW
255272

256-
These glitches can be used later in the game to get the event exclusive `Mew`. It's basically using the Long Range Trainer glitch to escape the fight on the **Route 24**, then you engage in a battle with the Kid **Route 25** to have the Slowpoke stats in memory.
273+
These glitches can be used later in the game to get the event exclusive `MEW`. It's basically using the Long Range Trainer glitch to escape the fight on the **Route 24**, then you engage in a battle with the Kid **Route 25** to have the Slowpoke stats in memory.
257274

258275
![](/images/PokemonGlitches/mew-glitch.png)
259276

@@ -265,23 +282,25 @@ Earlier in this blog, we discovered that Trainer and Pokemon are the same thing.
265282
* `Special stat < 200` triggers a Pokemon battle
266283
* `Special stat >= 200` triggers a Trainer battle
267284

268-
However you won't find many Pokemon with a special stat over 200. But there is a way to remediate to this problem. The Pokemon `Ditto` have the `Transform` ability which will copy itself into your Pokemon, it will also copy the stats.
285+
However you won't find many Pokemon with a special stat over 200. But there is a way to remediate to this problem. The Pokemon `DITTO` have the `Transform` ability which will copy itself into your Pokemon, it will also copy the stats.
269286

270-
Did you know that Prof Oak is not available in the game story, but he is coded and can be battled using a combination of the previous glitches. His index number is **226**, which is also the default value of Mewtwo SPECIAL stat.
287+
Did you know that Prof Oak is not available in the game story, but he is coded and can be battled using a combination of the previous glitches. His index number is **226**, which is also the default value of MEWTWO SPECIAL stat.
271288

272289
This glitch requires 2 long range trainer because you won’t have the NPC from Pewter City to reset the « NPC is moving » value. Also you need a Pokemon with Growl to set one of the 3 teams attributed to him.
273290

274291
Here are the steps to battle him:
275292

276293
* Fly to **Lavender City**, go to Route 8, trigger the Long Range Trainer
277294
* Fly to **Cerualean City**, go to Route 24, trigger the second Long Range Trainer, but you have to defeat him, to reset the « `NPC is moving` » value
278-
* Fly to **Cinnabar Island**, and go to the Pokemon Mansion and find a `Ditto` (you have to go to a specific room)
279-
* Wait for `Ditto` to copy your Pokemon with SPECIAL at 226
280-
* Then switch to a Pokemon knowing `Growl`, use it 4 times (Blastoise), 5 times (Venusaur), 6 times (Charizard)
295+
* Fly to **Cinnabar Island**, and go to the Pokemon Mansion and find a `DITTO` (you have to go to a specific room)
296+
* Wait for `DITTO` to copy your Pokemon with SPECIAL at 226
297+
* Then switch to a Pokemon knowing `Growl`, use it 4 times (BLASTOISE), 5 times (VENUSAUR), 6 times (CHARIZARD)
281298
* Then run away from the battle, use an `Escape Rope`, then fly back **Lavender City**, go to Route 8 to trigger the battle with `Prof Oak`.
282299

283300
![](/images/PokemonGlitches/prof-oak-stat.png)
284301

302+
![](/images/PokemonGlitches/prof-oak-encounter.gif)
303+
285304

286305
I hope you liked these glitches, here are some saves to have every requirements met in order to reproduce them. Some saves are from a finished run where the long trainers have been re-enabled, use them to get Mew or fight Prof Oak.
287306

1.34 MB
Loading
718 KB
Loading

0 commit comments

Comments
 (0)