Most Generation PRNG Help / Information

Thanks! Regarding the two extra frames, what do you mean by that? Sorry, got confused. ^^;

Click to expand...

Let's say the ivs and nature you want are on frame 30; you would need to advance to frame 32 to get the correct pokemon. But like I said, quite a few months ago and so I'm not so sure if the newer reporters account for this.

I just did some research and learn some stuff. Although this may not be very useful, I thought, I'd share it with you.

I wanted to know how the pickup-stuff works in-detail. Originally, I planned to change the function so it would give me items more often (I already patched my Pokeradar and VS Seeker to faster charging methods - using the sun instantly instead of running 50 steps).
Checks for pickup are done at the end of a battle. As the PRNG is cycled like crazy during battle, it seems impossible to precalc or preset the value for those checks.

For the record: I used an english Pokemon Diamond, the simple debugger from free iDeas and four Lv100 Pickup-Slaves.

First, I needed to find the pickup-function. As it needs to call the PRNG I searched for any place in the game that might call 0x0201B9EC (the random function). Those turned out much too many.

So I breakpointed into that function near the end of battle and searched for a savestate in which changes to the seed change the pickup results:
I found a rather small margin: when the screen starts fading to black, it's too late. "wild pokemon fainted" is too early, "own Pokemon gained exp" is too early but not by much. I think it was about 70-80 frames after the exp message that the pickup-results were frozen.
Luckily, I found a state in which I could manipulate the pickup-results by manipulating the seed - so the checks must be done later.

Next, I breakpointed the PRNG and checked where it returns to. It's to be expected that one of them does the pickup-check after it fetches a random number.
I got lots of 222F026. It seems like this is a "do nothing but still cycle like crazy"-function for battle. I also found myself in 2239272 four times and in 2239280 two times. As I got four pickup-slaves with two picking up items (for the seed I savestated), this was a good candidate.

The call to the PRNG from 2239272 is followed by a division by 0xA (ten decimal); the remainder is kept (number between 0 and 9). It is checked against 0, if it is non-zero, the function is done. The interesting thing only happens at zero, which is in (about) ten percent of all cases - the pickup chance stated in literature.
I manipulated the division to always have zero remainder (divide by 1) and all of my pickup-slaves collected stuff.

Naturally, the "which item was found"-part of the function only is called on success. This is the call that returns to 2239280. The random number is divided by 0x64 (100 dec) and again, the remainder is used further - allowing a simple compare to the limits/percentages.
I tried to follow that function any further but got stuck in some strange loop. Instead of iterating just some offsets (like the columns of the pickup-table), it iterated a lot more (does it check on level, too?). I hoped to find a spot where I could force a specific item on the pokemon - maybe even change the pickup-tables - but then gave up.
Instead, I tried to find out which number (remainder of division) resulted in which item:

(I didn't check every number. I just assumed that 0x05 to 0x17 are the same as 0x00 and 0x1D. For each item change, a range was tested. eg. 0x30,0x31,0x32,0x33)

This is strange in two ways:
First of all, PP Up and Max Elixir have the same number of values, thus should have the same percentage. Yet, tables (bulbapedia, smogon) often list one of them with 5% and the other with 3%. Of course, it's possible that the chances are different on other levels but I highly doubt that. Gen5 tables seem to already be corrected to "4%+4%". Is there reason to assume that Gen4 is different?

Also, TM26 is the item that arrives at the Lv91-100 tier, yet has a smaller number. All other items are "shifted in from the right when upgrading pickup level tiers". Of course, this is merely cosmetical.

That thread starts with "reasearch for RNG abuse" and I don't think you can abuse the PRNG for pickup (the blob about mad cycling during battle).
Still "research" seems more fitting than the general help. I copied it there (should I delete the original here?) and added something on the "about n percent").

That thread starts with "reasearch for RNG abuse" and I don't think you can abuse the PRNG for pickup (the blob about mad cycling during battle).
Still "research" seems more fitting than the general help. I copied it there (should I delete the original here?) and added something on the "about n percent").

Regards,

TCC

Click to expand...

You should definitely be fine; XD and Gen 2 RNG info was posted there, but it's certainly not possible on hardware. (atm)

What... it's entirely possible. Just practice hitting the seed on an old save file on the cart, then you can shoot for it on the new save. You can always trade to check if you keep getting the same wrong result.

Hello, I am new to this forum as well as RNG. I have followed Hozu's guide on RNG manipulation of egg PIDs to get a shiny charmander in emerald (I am not concerned about good IVs, I just want the shininess).

Please keep in mind that I am using vba, and the only cheat I've used is the gameshark SID finder.

Initially, I was stuck at the calibration step no 7 as I could not figure out which was the calibration value from eepid.exe. However with trials and errors, I found out that my calibration value is 21 (I first started with 20 as I have not caught the latios in my game, and added 1 to it following Hozu's advice about vblank and after that I started finding my eggs' PIDs in the RNGreporter list therefore I assumed 21 as my value for subsequent tries)

I have both charmander parents under my OT after a few trading and breeding, and made my female hold everstone, did the SRs and timed the 255th step and finally had an egg that has a shiny PID (2510th frame below)

and I used RSEdecoder to confirm it's PID and it's shininess

however, after hatching it, it turns out that my charmander is not shiny. The nature and gender is correct, and IV wise, I do not know how to have its exact IV as of now so I cannot confirm that it's the exact same charmander as the one in RSEdecoder and RNGreporter. I am confused and would appreciate some enlightenment as to why this happened to me. Thank you very much!

What... it's entirely possible. Just practice hitting the seed on an old save file on the cart, then you can shoot for it on the new save. You can always trade to check if you keep getting the same wrong result.

Click to expand...

I wasn't talking about starter RNG being impossible (I did it myself :P), I meant that there's no way to verify your seed or even check later (unless you're willing to play up until the GTS or are able to trade, as you mentioned).

Emulators tend to have a different calibration value due to inaccuracies in the emulation.

Click to expand...

Thank you for the fast response! Does that mean that 21 might not be my true calibration value even with PIDs that match those in RNGreporter list? If so, would there be a way to find out, or perhaps would you please elaborate on step 7? Because I've tried the spinda method but I was stuck because I could not interpret the result that eepid.exe give clearly;

Thank you for the fast response! Does that mean that 21 might not be my true calibration value even with PIDs that match those in RNGreporter list? If so, would there be a way to find out, or perhaps would you please elaborate on step 7? Because I've tried the spinda method but I was stuck because I could not interpret the result that eepid.exe give clearly;

Any help would be appreciated :)

Click to expand...

You are saved inside of the Day-Care building on the 254th step, correct? And you're not saved on the carpet of the building inside yes? Since walking outside does not count as a step...

Yes! I saved at my 254th step on the carpet, but I took my 255th step to the right (not straight outside) and only after that would I then go outside to check if the old man had the egg. Will the calibration value change halfway anyway? I have no clue of why RNGreporter and RSEdecode showed that the egg PID is the shiny PID but it doesn't hatch shiny though its nature and gender matched. By the way I tried another shiny frame, some 15000 frame into the game, got the egg PID confirmed by RSEdecode and it didn't hatch shiny as well, unfortunately... I was thinking of catching the latios first before trying again, do you think that'll work?

EDIT: I DID IT! Shiny charmander hatched. I was reading up about cloning and decided to clone rare candies so I can check its exact IV for further confirmation, and after cloning rare candies I flew to fallarbor (had the crazy idea that it might not work if I try to hatch it at the mauville-verdanturf LOL) so I just flew there and walked around and when it hatched, it came out shiny! I hope this is not purely coincidental and will try another 1 or 2 tries. Thank you for the help, Hozu!

EDIT 2: A few more tries yield positive results. All shiny PID eggs hatched shiny. I wonder what caused the problem, and perhaps flying to other areas, opening up PC, or cloning items had anything to do with it? Thank you very much anyways! :D

I have an odd question that I hope I can explain correctly. If it's correct, then that'd be cool.

Suppose I want to RNG an egg on Emerald, so that it is shiny on my FireRed cartridge. For that to work, I would need to search for a shiny egg frame that is possible with the TID/SID combo from FireRed. Once I find one, I would hit my frame on Emerald and trade the egg to FireRed and hatch it there. It would then be shiny.