Main Menu





Search Wiki


Luck manipulation (Generation III)
 Page | Discussion | View source | History

From Glitch City Laboratories

Revision as of 10:25, 11 November 2019 by Sherkel (talk | contribs) (Tired...actually, I really hope I'm not dreaming.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This article is incomplete. Please feel free to add any missing information about the subject. It is missing: a ton of stuff.


The RNG for all of the handheld games in Generation III is based upon a single 32-bit value, either changing it or running it through a formula every frame. This will be referred to as the seed.

Every frame, the seed is iterated through a linear congruential generator. The multiplier is $41C64E6D, and the increment is $6073. Outside of battle, this iteration happens once; however, when in battle, it happens roughly twice per frame. Curiously, it does not iterate at all in Battle Frontier battles, except during calculations for damage and opponent move selection.

With this knowledge, one can obtain any desired Pokémon simply by timing inputs, provided they know their initial seed. While the RNG controls countless events ranging from NPC movement to critical hits, this is its only common use, as desirable RNG outcomes in battle need to be routed frame-by-frame.

Manipulating the RNG provides access to any possible PID without the need of a game-altering device. The PID of any given Pokémon both contains its nature and determines whether or not it is shiny if obtained on a save file with a specific ID and secret ID.

To determine whether a Pokémon is shiny, the xor of the upper and lower 16 bits of the PID are compared to the xor of the player's ID and secret ID. If the difference is less than 7 (including 0), this leads to 8 out of every 65536 random combinations being shiny, or 1 out of every 8192.

While both the PID and IVs are calculated using the RNG seed in a wild encounter, the two aren't intrinsically connected further than that. (For instance, after an IV spread of all 31s (FFFFFFFF) is generated, the seed will be FFFFFFFF two frames later.) A bred Pokémon can legally have any combination of IVs and PID, even ones not within the 4294967296 usual possibilities.


In short, how much the calculation is altered by other factors.{clarify}

... in Generation III ...

  • Method 1 (Stationary encounters and gifts)
  • Method H-2
  • Method H-4 [1]
  • Method 4
  • Method 2

Notes for each game

Ruby and Sapphire

When the internal battery is dead, the initial seed in these games is always $5A0. This makes the process for manipulating it identical to Emerald in this case.

When playing one of these through the emulator in Pokémon Box, Rayquaza's stats are generated by Method 4 as opposed to Method 1. This presumably applies to other stationary encounters as well.

When the internal battery is alive, the seed is determined by the UID of the time stored in the internal clock.{clarify} It takes roughly two days after the battery has been disconnected or run dry for the real time clock to stop working, but the value it's stuck at has no bearing on initial seeding.[2]

FireRed and LeafGreen

The game is seeded by the AGB's Timer0, defined in hardware and thus theoretically unpredictable without 16.7 MHz precision. However, timing A presses very specifically can make the results correlate surprisingly well.


Emerald's initial seed is always 0. This makes calculating the time to any given wild or bred IV spread straightforward, as the player can simply let the LCG run idly for however many frames are required. While the possibility of only one initial seed would restrict many possibilities due to wait time on intended hardward, the Battle Video exploit can be used to set it to any given value once it rolls around the first time, eliminating wait times up to 828 days long.

Memory locations

Game Region Seed address
Ruby/Sapphire USA 0x03004818
Ruby/Sapphire PAL 0x03004828
Ruby/Sapphire JPN 0x03004748
FireRed/LeafGreen USA 0x03005000
FireRed/LeafGreen PAL 0x03004F50
FireRed/LeafGreen JPN 0x03005040
Emerald USA 0x03005D80
Emerald PAL 0x03005D80
Emerald JPN 0x03005AE0


  1. Kaphotics, Bond697, and OmegaDonut from Project Pokémon [clarification needed]
  2. The New Order of Breeding
  3. Smogon University
  4. Hozu from Smogon for the anecdote about Box
This article or section is a stub. You can help Glitch City Laboratories wiki by expanding it. RB 234 fs crop.png