============Shiny Eggs.(Note: This portion of the guide assumes that you already know how to trade between two save files. It's also quite complicated, especially since I'm not the greatest at explaining technical stuff. I really, really don't know anything about computers... honestly.)
Shiny Egg RNG is really just an extension of the previous post, and I'm sure at least one person other than me wanted to know how to do this. This post is going to be really "talky," because not only do I want to teach people how to do this, but I want to run everyone through how
I figured this out.
Smogon actually has a Guide on how to RNG Shiny Egg PIDs on Pokemon Emerald, but this doesn't apply to us seeing as Touhoumon Purple has that "fixed RNG" patch. As consequence of not being able to use a custom seed in the 3rd generation Time finders, we are, as they say, shit out of luck
in that regard. So we're gonna have to get a little creative here. We need to understand how Shininess is determined.Smogon has a well-written Guide on how the game generates Shinies
, but I'll try to summarize it as best as I can. Shininess is determined based on a combination of PID and Trainer ID/SID. So, because we an see the Egg's PID via Lua Scripting when it's been generated, if the Egg has a desirable Gender, Nature, and Ability, then we only need the correct Trainer ID/SID in order to hatch it Shiny. That's right. Since we can't hatch this egg Shiny, we're going to have to create the Trainer who can
Since RNG Reporter doesn't support Emerald ID's, it seems as though we are again, as they say, shit out of luck
. I was pretty butt-frustrated at this point. Screw this, we're gonna figure this out manually!
My research lead me to tasvideos.org, where, much to my surprise, I learned everything about Emerald ID's that I need to in order for this to work.
Trainer ID number (Emerald)
The trainer ID is determined in two separate parts: the visible ID and the secret ID.
The visible ID is determined after you leave the naming screen for your character. The game creates an initial seed with the same value at that point as well. It does so by taking the bottom half of the value at address 0x4000104 at the time.
Address 0x4000104 is an entropy byte, which continually increases and is affected by execution at every step. It is unpredictable. It begins running when you enter the naming screen and stops when you leave, when the visible ID is determined.
The secret ID is determined shortly before the character sprite disappears into the black background, after the professor dismisses you.
When the game sets your secret ID, it cycles the RNG 2 times on that frame.
aaaaxxxx secret ID: aaaa
Here's what I was totally not expecting: The Trainer ID and the Secret ID are not written at the same time! One thing I wasn't really too keen on finding out was that the Trainer ID was "unpredictable." I was about ready to throw in the "shit out of luck"
towel again, until I read the bit where the game sets your Secret ID shortly after the final A input needed to get to the inside of the truck. Thanks to the Lua Script showing us the RNG seeds in the Output Console, we are able to effectively manipulate our Secret ID. Our Secret ID is all we need to get in order for our Egg to hatch Shiny.
With all that out of the way, let's get started on actually manipulating a Shiny egg!
-----------------------------------------------------------------------------------------------------[5:08:47] +DoctorShanks: Taking the first suggestion on what I should breed as Shiny for the RNG guide/demonstration/whatever post.
[5:09:01] @Rhetco: suwak
You heard the guy. We're RNGing a Shiny Suwako to close out this guide. As I've mentioned earlier in this post, RNGing a Shiny Egg is pretty much just an extension of RNGing ordinary Eggs, with a few extra steps:
1: Create a new save in a different folder.
2: Manipulate Trainer ID in new save to hatch Egg Shiny.
3: Trade Egg to new save using VBA Link
7: a shiney
Obviously, Step 2 is the bulk of the work, but I'm here to walk you through it!
Follow the Egg Manipulation guide in the post above this one, and generate an egg with desirable stats that you wish to hatch Shiny. Once, the egg has been generated, write down the PID of the egg
, and then manipulate its stats normally. Once you take the egg, make a Save State, then run the egg through the incubator. If the egg has the stats you want, then load that save state I just told you to make, and save the game normally. Delete the Save State.
For reference, the PID of this egg that I have generated in the very small screenshot above is 59803E83
Make a new save in a different folder now. For simplicity's sake, name your character and get to the above screen on the right where the professor asks you to confirm your name as quickly as possible. Now, pause the game and read on.
Open up the Memory viewer under Tools > Debug > Memory Viewer, and go to address 0x4000104. It is at that address which we are able to see the TID that the game has given us. If you click the Decimal Display checkbox at the bottom of the Memory Viewer window, then you will see your TID at the address 0x4000104. For this example, I seem to have been given a TID of 59410, which translates to E812 in Hexadecimal. Now, un-pause the game and get to the dialogue shown in the screenshot below.
Once you are on this screen, pause the game once again and make a new Save State. One more A Input will eventually assign an SID to our new Trainer, but we don't want that to happen just yet! Instead, we need to manipulate our SID, and this is where things get a little tricky.
So we have 3 out of 4 pieces of the information required to hatch our egg Shiny: The first four numbers of the Egg's PID, which we shall refer to as the High PID, the last four numbers of the Egg's PID, which we shall refer to as the Low PID, and the Trainer ID. These numbers are 5980, 3E83, and E812
respectively. In order to figure out what SID we need, we first need to convert these three numbers to Binary. This can be done using a calculator with a Programmer mode (the one that probably came with your PC should do just fine).
If you opened the guide I linked to containing the information regarding how the game determines Shininess, then you would know that in order for shininess to occur, that the ones in the first thirteen columns need to add up to either 0, 2, or 4, and never 1 or 3. With this in mind, we can fabricate our own SID by adding zeroes and ones that will force the sum of the first thirteen columns to be either 0, 2, or 4.
HID: 0101100110000 | 000
LID: 0011111010000 | 011
TID: 1110100000010 | 010
| 000 - 111
= : 2222422220020
As a result, we have written an SID of 1000111100010000 to 1000111100010111, which is 8F10 - 8F17
in Hexadecimal, or 36624 - 36631
in Decimal. This means that if we can manipulate a Secret ID of 36624 to 36631, then our Egg will be Shiny!
Now, open up the Emerald RNG Suite Lua Script. Run the script, and run the game on Turbo mode for around 10,000 frames
. When approximately (or exactly, preferably) 10,000 frames have elapsed, pause the game, hover your mouse over the Output Console, Right Click > Select All > Copy, and paste that information in a Notepad.
On any of these frames, the first four hexadecimal digits could be our Secret ID if we wanted, but we're obviously looking for the digits that will make our egg Shiny. Do a CTRL+F search for your SID Range in Hexadecimal. If you don't see your desired Secret ID in the first four digits of any of these RNG seeds (relatively unlikely), then simply advance for another 10,000 frames and repeat the process.
Once you've found your Secret ID in the Notepad, it's entirely up to you to figure out the exact Frame in which that particular seed occurs on. You can use the location of the scroll-bar in the Notepad to aid you in this task. You can also clear the Output Console by closing and re-opening it, and do searches every 1,000 frames, for example. And you can also do Frame-by-Frame searches by pausing the game and advancing with "CTRL+N" or the "\" key. It's completely up to you; find it however you're comfortable doing it.
After narrowing it down, I found out that my Target RNG Seed occurs on Frame 43502. Once you've found what Frame your RNG Seed occurs on, load the closest Save State you have (with about 100+ frames worth of leeway), and open the "Emerald Egg Tracking RNG Suite." Using this Lua Script, we can see the difference between the RNG Frame and the Timer Value, and no matter how long you hold the spacebar down, this number will never change, at least until it writes our SID. However, we're not ready to write our SID yet; we still need to do a Calibration!
Calibrate as you would expect: Pause the game, load the state, advance to the next frame while holding A, and slowly advance the frame until the exact frame in which the difference value increases by one.
What is happening is that the game is rolling the RNG twice in order to assign us our SID. On that exact Frame in which the difference increases by one is the Frame that our SID is given to us. My difference value was 15, and on the Frame it hit 16, the first four digits in Hexadecimal of the pRNG seed would be my SID.
Calculate how many frames it took since the Frame you pressed A to the Frame in which the game wrote your SID, and calibrate by subtracting the Timer Value on the Frame where the game writes your SID by the Timer Value when you pressed the A button +1. The +1 is necessary since the game rolls the RNG Twice to write your SID. For example, my Target Frame is 43502, and I calibrated 76+1 frames to write the SID. 43502 - 77 = 43425. So I loaded a close Save State, then I advanced the frame to 43425 while paused, and finally, I advanced to the next frame while holding down A. As you can see in the screenshot above, when the difference increased by 1, the first four digits of the pRNG Frame were 8F11. Of course, this corresponds to the SID we need in order to hatch our Shiny Egg, but let's get in game just to be sure...
The Egg RNG Suite has a feature in which it tells us the TID/SID of the first puppet in our party. As expected, we manipulated an SID of 36625, which should hatch our Egg as a Shiny! The next step is to simply advance to the point in the game where we are allowed to Trade. This doesn't take as long as you might think, since all we need to do is get the Tohodex.
This guide assumes that you know how to trade between two save files. You will need to use VBA Link, so you'll have to rename your main save and your dummy save. I personally renamed my main save as the .sa1 file, and my dummy save as the .sa2 file.
The next step is to obviously Trade your Shiny Egg To-Be over to your dummy save file, then run around manually until your egg hatches since we obviously don't have the incubator at this point in the game. I like to do this in Littleroot, since it looks nice on the puppet's summary screen.
And that's that! If you have any questions, feel free to drop me a line in Shoddy, or in this Thread, or on my dumblr account. If I missed anything important, I'll be sure to fix this guide up and add a note in the OP.