TASVideos

Tool-assisted game movies
When human skills are just not enough

Game Resources / G Bx / Pokemon Gen 2

The purpose of this page is to document all known tricks of the Pokemon generation 2 games on Game Boy Color, which include Gold, Silver, and Crystal.

Table of contents [expand all] [collapse all]

Luck Manipulation

Gen 2, like Gen 1, revolves its RNG around the rDIV. The rDIV is essentially a 16-bit CPU cycle counter, with only the upper 8 bits able to be seen. The exact function is also fairly similar: take the rDIV, then add it to hRandomAdd, then subtract it to hRandomSub. This is done every time Random is called, and an equivalent function is also done at Vblank. For all intents and purposes, hRandomSub is the main RNG byte used for randomness, with hRandomAdd secondary (and rarely used). In G/S, hRandomAdd is at 0xFFE3, and hRandomSub is at 0xFFE4. In C, hRandomAdd is at 0xFFE1, and hRandomSub is at 0xFFE2.

Luck manipulation primarily revolves around a function called PrintLetterDelay. This function is responsible for delaying text, notably making it so with FAST text, each character is delayed so text is printed at 1 frame per character. This 1 frame per character speed is also done if A or B is held, but this results in a different amount of cycles used. This can often be used to offset Random calls, by simply pressing A/B on the 1 or 2 frames before the Random call happens. It should be noted that you can hold down A/B while text is printing for a while to get a minor effect on RNG, but this should be cautioned, as often any "major effects" end up actually being the result of a Vblank leak, which ends up almost the same if you just had a frame of delay when manipulating (emphasis on almost, the differences can sometimes prove useful).

In G/S only, whether or not you press a button before a lag frame (e.g. decompressing sprites, loading new maps, etc.) can have a substantial affect on RNG.

Trainers choose their move before the player does (before the FIGHT/PKMN/PACK/RUN menu appears). Most trainers have AI, with the trainer class dictating the level of AI they have (with the exception of Gym Leaders and the Elite 4, who all have individual levels of AI). In general, more complicated AI results in more Random calls, which results in greater variance when abusing PrintLetterDelay. As a minor note, unlike trainers, wild Pokemon choose their move after the player chooses theirs. More specific info on AI can be found here.

When catching Pokémon, the frame you enter the PACK and when you select USE on the Pokeball will highly greatly affect RNG, with PrintLetterDelay minorly affecting the catch roll. Walking around in the grass with different paths has a mild influence; the desired type of Pokémon is not likely to change, but its DVs are likely to change. Pressing A at certain points can sometimes affect RNG, most notably when loading in a randomly moving sprite.

When attacking, the game does most of the calculations (and random calls) happen after the "(pokemon) used (move)" textbox is printed, first to roll a critical hit, then it does a damage roll, then it does an accuracy roll (if needed), then it does an effect roll (if needed). There are a few things to watch out for:

(Game Mechanics)

(Overworld)

(Pokémon personal stats)

(Pokerus)

Useful memory addresses (GS)[1]

D0F5-D0F6: DVs of current opponent. This is used to determine the DVs of wild Pokémon that you want to catch.

D0FF-D10C: Stats of current opponent. Each value is two-byte big-endian in the following order: current HP, total HP, attack, defense, speed, special attack, special defense. The current HP is the most important.
(Note: Focus on D100, D102, ... instead of D0FF, D101, ...)

D141-D142: Amount of damage (big-endian) that an attack is about to do. How this address works is rather convoluted. Calculations begin after the dialog “X used attack”.

  1. The base damage is calculated (if critical hit, it is considered) and placed in D142.
  2. If attack is super-effective or not-very-effective or such, multiply D142 appropriately.
  3. If a multiplying factor such as Rage is involved, multiply D142 appropriately.
  4. If any other factors, multiply D142 appropriately.
  5. Random reduction factor, multiply D142 by a random number between 217 and 255, and integer divide by 255.
    1. The number before this step is the max damage possible and is only achieved rarely (if the random number is 255).
  6. If miss, set D142 to 0.
  7. The value in D142 now is the damage inflicted.
  8. If it would knock out Pokémon, set to current HP of that Pokémon (after HP bar begins to decrease).

Note that not all these values appear, but the base damage, max damage, and damage inflicted will usually appear on a frame-by-frame basis.
(Note: Focus on D142 instead of D141)

D151: General purpose temporary variable. Notably, if using Magnitude, the Magnitude number appears here right after “X used attack” appears.

In-game time:
D1EC: Hours
D1ED: Minutes, one byte
D1EE: Seconds, one byte
D1EF: Frames, one byte

D9BC/D9EC: One-byte values for the overworld step count (mod 256). Useful for going through dark tunnels without having to mash the arrow buttons.

DA02-DA03: X-Y coordinates of character on overworld map. Going right increases X and going down increases Y.

DA3F-DA40: DVs of first Pokémon in party. This is for your starting Pokémon.

For other RAM and ROM addresses, check out the symbols files provided by the pret disassemblies:

And of course, the actual disassemblies for the games:


[1] Credit goes to primorial#soup who found the memory addresses.


Combined RSS Feed
GameResources/GBx/PokemonGen2 last edited by CasualPokePlayer on 2020-09-06 06:42:48
Page info and history | Latest diff | List referrers | View Source