Back to Page
Revision 5 (current)
Edited by CasualPokePlayer on 9/6/2020 6:42 AM
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.
%%TOC%%
* G/S = Gold/Silver
* C = Crystal
* RNG = Random Number Generator
!! 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 [https://pastebin.com/EjAW76cx|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)
* When both Pokémon have the same speed, and both moves have the same priority, the one going first is decided when the attack is selected in the menu.
* When using Quick Claw (1/4 chance to go first if slower, all other things being equal), the chance is determined when the attack is selected.
** Priority overrides the Quick Claw effect; the Quick Claw is only used if both moves have equal priority.
* Paralyze effect (unable to move) is determined just before the attack is attempted, and confusion effect (self-damage) is determined after "(Pokémon) is confused!"
(Overworld)
* Some things like the direction that a randomly looking trainer looks, as well as people movement, can be manipulated.
* Wild Pokémon encounters are determined when you step into a patch of grass.
(Pokémon personal stats)
* Personal stats (DVs) for the starter Pokémon are determined when you obtain the Pokémon, specifically when the "(player) received Pokemon!" textbox is closed. Shininess is linked the DVs.
* Personal stats for wild Pokémon are determined on encounter.
(Pokerus)
* Essentially a "virus" for Pokemon, this ends up being helpful for the host, doubling the Stat Exp. (essentially the EVs of Gen 1-2) it obtains in battle. This however has a glaring restriction, your Pokemon cannot contract Pokerus until you visit Goldenrod City, leaving the player locked out of Pokerus for the early game.
!! 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”.
# The base damage is calculated (if critical hit, it is considered) and placed in D142.
# If attack is super-effective or not-very-effective or such, multiply D142 appropriately.
# If a multiplying factor such as Rage is involved, multiply D142 appropriately.
# If any other factors, multiply D142 appropriately.
# Random reduction factor, multiply D142 by a random number between 217 and 255, and integer divide by 255.
## The number before this step is the max damage possible and is only achieved rarely (if the random number is 255).
# If miss, set D142 to 0.
# The value in D142 now is the damage inflicted.
# 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:
*Gold: https://raw.githubusercontent.com/pret/pokegold/symbols/pokegold.sym
*Silver: https://raw.githubusercontent.com/pret/pokegold/symbols/pokesilver.sym
*Crystal 1.0: https://github.com/pret/pokecrystal/blob/symbols/pokecrystal.sym
*Crystal 1.1: https://github.com/pret/pokecrystal/blob/symbols/pokecrystal11.sym
*Crystal AU: https://github.com/pret/pokecrystal/blob/symbols/pokecrystal_au.sym
And of course, the actual disassemblies for the games:
*G/S: https://github.com/pret/pokegold
*C: https://github.com/pret/pokecrystal
----
[1] Credit goes to primorial#soup who found the memory addresses.