1. Welcome to Wi-Fi! Please remember to read the rules and do NOT create a new thread for simple trades or Friend Safari codes.

Most Generation PRNG Help / Information

Discussion in 'Wi-Fi' started by mingot, Mar 16, 2009.

  1. Buckert

    Buckert

    Joined:
    Jun 22, 2010
    Messages:
    1,921
    Why have I never thought of this? Thanks a lot mate, will try this for sure tomorrow!
  2. Fishaman P

    Fishaman P

    Joined:
    Sep 29, 2010
    Messages:
    138
    I'm no expert a theoretical expert in FrLg, but I believe the frames start counting after you hit "Continue". Also, there's a 1-frame window to skip the journal entirely, so that could help.

    Since it seems you have a lot of GBA RNG questions, you could start a PM conversation with me; Gen 3 is my specialty :toast:
  3. Cereza

    Cereza Tastes Like Candy

    Joined:
    Jan 17, 2011
    Messages:
    1,258
    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.
  4. TCCPhreak

    TCCPhreak

    Joined:
    Mar 1, 2009
    Messages:
    23
    On Pickup in Diamond (possibly all Gen4)

    Hello,

    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:
    Code:
    0x00 -> 0x1D Revive (30 values, so about 30%)
    0x1E -> 0x27 Candy (10 values, so about 10%)
    0x28 -> 0x31 Dusk Stone (10 values)
    0x32 -> 0x3B Shiny Stone (10 values)
    0x3C -> 0x45 Dawn Stone (10 values)
    0x46 -> 0x4F Full Restore (10 values)
    0x50 -> 0x59 Max Revive (10 values)
    0x5A -> 0x5D PP Up (4 values)
    0x5E -> 0x61 Max Elixir (4 values)
    0x62 TM26
    0x63 Leftovers
    
    (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.

    Regards,

    TCC
  5. Hozu

    Hozu RNGenius
    is a Contributor to Smogon

    Joined:
    Feb 10, 2011
    Messages:
    1,323
    Wow, this is good information. I'm not sure if 4th gen Pickup was worked out or not, but it would be a good idea to post it in the RNG Research thread.
  6. TCCPhreak

    TCCPhreak

    Joined:
    Mar 1, 2009
    Messages:
    23
    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
  7. Fishaman P

    Fishaman P

    Joined:
    Sep 29, 2010
    Messages:
    138
    You should definitely be fine; XD and Gen 2 RNG info was posted there, but it's certainly not possible on hardware. (atm)
  8. PrimordialHydra

    PrimordialHydra

    Joined:
    Mar 21, 2013
    Messages:
    17
    Can the Sinnoh starters be RNG'd?
  9. Psiiionic

    Psiiionic

    Joined:
    Nov 15, 2011
    Messages:
    218
    Yeah but they are difficult to do since no way to tell your frame and NPCs advance it erratic better to breed them.
  10. PrimordialHydra

    PrimordialHydra

    Joined:
    Mar 21, 2013
    Messages:
    17
    Alright. Thanks for the info. Orn another note, does anyone know how many SR's it would take on average to get an Adamant Chimchar with decent stats?
  11. Fishaman P

    Fishaman P

    Joined:
    Sep 29, 2010
    Messages:
    138
    That depends on what you call decent.
    Say you mean all IVs are 16+.

    1/25 chance of Adamant * (1/2 * 1/2 * 1/2 * 1/2 * 1/2 * 1/2) chance of 16+ IVs = 1/1600 chance, and those IVs aren't even close to perfect.

    EDIT: Oh, and Psiiionic is wrong about the NPCs advancing the frame; there are no NPCs present when you get your starter, and I speak from experience.
  12. Hozu

    Hozu RNGenius
    is a Contributor to Smogon

    Joined:
    Feb 10, 2011
    Messages:
    1,323
    He's not wrong for Platinum, but for D/P there are no NPCs.
  13. PrimordialHydra

    PrimordialHydra

    Joined:
    Mar 21, 2013
    Messages:
    17
    Thanks for the update guys. So it technically isn't impossible to RNG them, it's just difficult due to a lack of reliable frame/seed checking?
  14. Fishaman P

    Fishaman P

    Joined:
    Sep 29, 2010
    Messages:
    138
    No no, if it weren't reliable, many people would still do it.

    There's no way at all without save shenanigans or hax.
  15. Hozu

    Hozu RNGenius
    is a Contributor to Smogon

    Joined:
    Feb 10, 2011
    Messages:
    1,323
    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.
  16. lonelyshinobi

    lonelyshinobi

    Joined:
    Apr 25, 2013
    Messages:
    3
    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)

    [​IMG]


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

    [​IMG]


    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!
  17. Hozu

    Hozu RNGenius
    is a Contributor to Smogon

    Joined:
    Feb 10, 2011
    Messages:
    1,323
    Emulators tend to have a different calibration value due to inaccuracies in the emulation.
  18. Fishaman P

    Fishaman P

    Joined:
    Sep 29, 2010
    Messages:
    138
    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).
  19. PrimordialHydra

    PrimordialHydra

    Joined:
    Mar 21, 2013
    Messages:
    17
    Any idea how many frames are advanced/ can be advanced that early on? For example, one seed I was looking at had a frame of 41. Is it possible to hit that?
  20. lonelyshinobi

    lonelyshinobi

    Joined:
    Apr 25, 2013
    Messages:
    3
    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;

    [​IMG]



    Any help would be appreciated :)
  21. Colossus

    Colossus

    Joined:
    Jan 17, 2012
    Messages:
    240
    I'm trying to RNG a Yanma, but I have problems doing so. As the date changes, so does the swarm, and as the Yanma I'm RNGing is only available during it....any suggestions?
  22. Hozu

    Hozu RNGenius
    is a Contributor to Smogon

    Joined:
    Feb 10, 2011
    Messages:
    1,323
    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...
  23. lonelyshinobi

    lonelyshinobi

    Joined:
    Apr 25, 2013
    Messages:
    3
    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
  24. Timey

    Timey

    Joined:
    Aug 27, 2012
    Messages:
    76
    How does Rotom/Dialga RNGing work? I assume Rotom is the same as stationary pokemon, but I'm not sure about Dialga due to all of the stuff that happens before you battle it.
  25. Hozu

    Hozu RNGenius
    is a Contributor to Smogon

    Joined:
    Feb 10, 2011
    Messages:
    1,323
    Dialga would be stationary... I'm pretty sure you're able to save immediately before encountering it.

    For Rotom, you would want a seed that is during night time. Or you could wait until the clock reaches night before advancing, but that is far more time-consuming and possibly unreliable.

Users Viewing Thread (Users: 0, Guests: 0)