| RNG Manipulation of Egg PIDs
IntroductionPokémon that have been RNG abused in Ruby/Sapphire/Emerald are not nearly as common as those RNG abused in 4th and 5th gen due to the difficulty. Shiny RNG abused Pokémon from Ruby/Sapphire/Emerald have historically been the product of emulators or the trading of Eggs, which would require the use of external devices. The aim of this guide is to bring shiny Egg RNG abuse to the retail cart players of Emerald. This guide assumes that you know how to do Egg IV RNG abuse. If not, take a look here. Additional Programs
Helpful InformationAn oddity with the Emerald PRNG: Part of the functions that display the screen is a function called VBlank. The main purpose of it is to clear the screen to prepare for the next video frame, but it makes one call to the PRNG for no reason. This is why the PRNG is tied to video frames. If the VBlank is called during the middle of the generation of a Pokémon, it causes oddities like Methods 2 and 4, split spreads, and alternate inheritance. It may also increase the total calibration value by 1 on occasion. This is what makes Everstone use inaccurate at times. It is believed that the closer you are to the end of the video frame interval of ~1/60th of a second when the functions to generate a Pokémon/Egg PID/Egg IVs, the more likely this will occur. Egg generation chances: There are two separate things that affect the Egg generation chance. They are matching Pokédex number and non-matching Trainer ID numbers. If both are true, the Egg has a 70% chance to generate. If one of the two are true, the Egg has a 50% chance to generate. If neither are true, there is only a 20% chance for it to generate. This means that your Gengar and Gastly of the same Trainer ID have a 20% chance to generate an Egg, but two Gengar of the same Trainer ID have a 50% chance. How often the game checks to generate an Egg?: When the player character takes the 255th step after depositing both parents in the Daycare, and every 255 steps thereafter. For the purposes of this guide, it is not important to know how the Egg is generated after one takes a different Egg from the old man. The game takes 16 frames after you press the D-Pad to move in the direction the player character is facing to generate an Egg on the 255th step. About Egg PIDs: There are two parts to the egg PID—one is determined by the PRNG like usual, and the other is determined by a timer. The timer advances once every video frame. The PRNG advances by 1 for every timer advancement plus all other advancements (NPCs, encounters, battle, drawing the environment, etc). The drawing of the environment will become useful as you'll see later on, as it can change the difference between the PRNG and the timer. CalibrationAnecdotal evidence suggests that the base calibration value is 19, or 20 with Latios/Latias roaming. However, it would still be a good idea to test it for yourself. As noted earlier the PRNG and the timer are not totally synchronized. One must find out how far apart they are by generating an Egg in an area that does not advance the PRNG, and figure out the PID of that Egg. Here is what you must do to figure out your calibration:
The calibration value can be affected by what's going on in the game. One thing that may affect it is the presence of a roamer. This will be your base calibration value. Finding a Shiny PID![]() Most of the screen should be fairly obvious, but here are the less obvious ones:
Once you find a shiny spread you're willing to accept, do another search for all possible Eggs that are near your shiny PID with the given number of redraws. In this example, I will pick the Impish spread at the top. So, adjust Reporter to display any valid Egg PID and have the min/max redraws set to that of the Egg PID you wish to use. ![]() The target frame is 4726, with the nearest non-shiny Eggs being possible on frames 4721 and 4730. Having a spread with possible Eggs far vs. close to the desired PID has advantages either way. With close Eggs, you can get more Eggs to confirm the frame you actually hit so you can adjust your timer accordingly. With no close Eggs, you'll immediately know when you did or didn't get your desired PID, but if you miss you won't know the frame you hit. Setting up the TimerUsing only in-game means this will be quite time-consuming. You will have to test the ability to hit your shiny PID using Spinda breeds, with at least the minimum breeding percentage of the breed you will be doing. Set up your timer using the frame that has your shiny Egg PID and take the 255th step when the timer runs out. If the old man has an Egg, go hatch it and determine the PID. If the Spinda comes out shiny then congratulations, you hit your shiny spread. Go start your actual project. If not, then adjust your timer according to the frame you actually hit. If the old man did not have an Egg try again. If he consistently does not have an Egg, adjust the timer slightly and repeat (pick either direction based on whether you think you're early or late). If you get a PID that that isn't in the search result, first add one to the base calibration and run the search again. The reason for this is the aforementioned VBlank function. If you haven't found your PID, then you probably miscounted the amount of redraws you did. Run searches with increased/decreased amount of redraws, etc. When it comes to your actual project, you will have to save before picking up the Egg if you intend to abuse the Egg IVs as well. This means each time you don't get the desired PID you will have to take the parents out of the Daycare, redeposit them, walk 254 steps, save, and repeat. Once you have your shiny Egg, you may proceed to do RNG abuse for your Egg IVs. Sometimes, when doing Egg IV abuse you will hit split frames or alternate inheritance when you don't want to. Usually, waiting around and making another save can fix this, especially for split spreads. However, it might not, so you may have to generate another shiny Egg unfortunately. RNGing an Egg to be Hatched on a Different Save FileSince the PID is generated separately from the IVs, and there is no way to guarantee the IVs without hatching the Egg, you may wonder how this is even possible. Well, normally it's not, but by taking advantage of the cloning glitch in a strange way it is. Once you have your Egg PID verified (check gender and nature) and you have the game saved prior to taking the Egg, you take it, save, then hatch it. If the IVs are what you want then reset, trade the Egg, and hatch it. If they're not, go do the cloning glitch, except you don't do anything with the PC, and you TURN OFF THE GAME during the "presave" part (when there's no dialogue on screen). This will CORRUPT the current save, which loads the previous save of you being in front of the Daycare man and him holding the Egg. MAKE SURE YOU SAVE AGAIN PRIOR TO DOING ANYTHING ELSE. Otherwise you risk losing your save completely. Then repeat the process until you get the desired IVs. |