Jump to content

Recommended Posts

Posted (edited)

Having trouble adjusting the info (to my liking) of this japan wish ralts egg. I'm relatively new to PKHex, Pokefinder 2.5.4 (4.2.1 just keeps crashing), and RNG Reporter (can't access some of the more basic options / roadblocked). The Egg initially starts / comes from a Gen III Ruby Event.

I'm trying to find/ apply the needed info without getting errored, but from days worth of research and testing I've gotten nowhere really fast. It so far appears to be either a): not done before or b): not possible to do.

I have gotten as far as 1 illegal hatch on a physical firered cartridge for a shiny ralts with ability synchronize and retaining wish. However, the 1 legal hatch I had wasn't shiny while retaining the above matching info, except shininess, and any changes to the legal one for adjusting said issue is quickly met with the red triangle.

I know i can change the nickname, TID, and SID just by hatching (not sure of OT), and the egg is as is from it's original distribution.

My goal is to get the following on a legal event wish ralts egg (unhatched) in Leafgreen (US) if possible / hatched if needed:

  • TID - 58482
  • SID - 28734
  • OT - Lucylle (unless it can be changed later)
  • Nickname - doesn't matter (can be changed later)
  • Still Retaining the Move Wish & Ability Synchronize
  • Timid Nature
  • Shiny
  • All while remaining "Legal"

Lastly, IV's aren't Top priority, but the higher the much better, if not even 6IV. Attached is the pkhex file of the Ralts at hand.

 

Thanks to anyone for help, advice, and results should they come.

 

0280 - タマゴ - 2738129F374A.pk3

Edited by Lucylle
  • Lucylle changed the title to Legality issue for ralts wish egg? Help Requested
Posted

There isn't any tool written to search these events for a valid PIDIV for your specs, but that doesn't prevent anyone from writing one.

Here's a LINQPad script using PKHeX.Core to iterate through all possible seeds matching your criteria. Note that there are only 2^16 seeds, and with Ralts+Wish being 1:8 (2^3) chance, and shiny (1:8192, aka 2^13) there'll usually only be 1 result for a given TID/SID/gift choice, usually 0-2 shiny results for a given request (ignoring Pichu).

Spoiler
for (uint i = 0; i <= ushort.MaxValue; i++)
{
    // Get the result from the table weight.
    // Ralts is the 3rd (0,1,2,3) species in the table, and we want it to have Wish.
    var w32 = WeightedTable3.GetRandom32(i);
    var result = PCJPFifthAnniversary.GetResultPCJP(w32);
    if (result is not { Index: 3, Wish: true})
        continue; // not Ralts w/ Wish, ignore.
        
    // Above rand32() used 2 calls; skip to the right frame.
    // Generate PID, check if shiny, then generate IVs.
    var seed = LCRNG.Next2(i);
    var start = seed;
    var a16 = LCRNG.Next16(ref seed);
    var b16 = LCRNG.Next16(ref seed);
    var pid = (a16 << 16) | b16;
    
    const uint TID = 58482;
    const uint SID = 28734;
    const uint ID32 = (SID << 16) | TID;
    
    bool isShiny = ShinyUtil.GetIsShiny(ID32, pid, 8);
    if (!isShiny)
        continue; // not shiny, ignore.
        
    var rand1 = LCRNG.Next16(ref seed) & 0x7FFF;
    var rand2 = LCRNG.Next16(ref seed) & 0x7FFF;
    var iv32 = (rand2 << 15) | rand1;
    
    var ivHP = iv32 & 0x1F;
    var ivATK = (iv32 >> 05) & 0x1F;
    var ivDEF = (iv32 >> 10) & 0x1F;
    var ivSPE = (iv32 >> 15) & 0x1F;
    var ivSPA = (iv32 >> 20) & 0x1F;
    var ivSPD = (iv32 >> 25) & 0x1F;
    
    // Dump result.
    $"BACD Seed: {i:X4} => {result}".Dump();
    $"Generate Seed: {start:X8} => {pid:X8} | {ivHP:00}/{ivATK:00}/{ivDEF:00}/{ivSPA:00}/{ivSPD:00}/{ivSPE:00} | {(Nature)(pid%25)}".Dump();
}

 

Punching in the result from the script, you get a legal result inside PKHeX.

image.png

  • Like 1
Posted

Last question, for reference to future views using this as a starting point. What would some need to have to start there own process when starting a similar encounter?

 

And thank you for such amazing help, and great layout!

Posted

You'd need to know the details about how the encounter is created, and how to bruteforce the entire range of results. That's what those search programs (and this script) do. Writing the code is pretty straightforward if it's focused on checking one type of result.

  • Like 1
Posted

What would an added line for the outcome to be female look like?

 

bool isFemale = FemaleUtil.GetIsFemale(ID32, pid, 8); if (!Female)

          continue; // not female, ignore.

 

?

Posted

Gender is determined from PID and the Species' gender ratio, which is stored in the "personal info" for the game.

var ratio = PersonalTable.E[Species].Gender;
var gender = EntityGender.GetFromPIDAndRatio(pid, ratio);
if (gender != 1) // Female
    continue;

for ralts:
var ratio = PersonalTable.E[(int)Species.Ralts].Gender;

For your specific case, the only (1) result is a male. You'd have to hatch it on a different save file (TID/SID) which would be an entirely different PID-IV (nature) spread.

You can potentially remove the constraint of shininess to get more results, and add the gender constraint (and even an attack IV = 0 constraint) or whatever other constraints you want to filter down the list, and calculate what TID/SID combination would make that spread shiny.

  • Like 1
Posted (edited)

definitely a lot to learn there! I would gladly remove atk iv constraint due to it not being needed. Do you have recommended place to turn to for learning into this, and where can i access .core of PKHex? Already semi-familiar with PLCs and such, and again great thanks for the help here.

Edited by Lucylle
Posted
20 minutes ago, Lucylle said:

definitely a lot to learn there! I would gladly remove atk iv constraint due to it not being needed. Do you have recommended place to turn to for learning into this, and where can i access .core of PKHex? Already semi-familiar with PLCs and such, and again great thanks for the help here.

https://www.linqpad.net/

https://www.nuget.org/packages/PKHeX.Core, but some logic might only be available on the current working code (continuous improvements!). NuGet has integrations to Visual Studio, however you can always download `nupkg`'s manually and just change the extension to .zip and get the .dll that way.

https://github.com/kwsch/PKHeX

https://visualstudio.microsoft.com/vs/community/

PKHeX.Core is essentially the backend API that the GUI uses to do all the calculations. Unlike ladder logic, it's the usual code programming (like structured text? but so much less ugly!)

The only real documentation is the source code itself, which (biased take, since I'm the primary author) isn't too bad. There's just a LOT, but understanding the terminology will get you 99% of the way there when looking for things.

  • Thanks 1
  • 4 weeks later...
Posted
1 hour ago, Degustibus00 said:

hi guys, how i can set this ralts with wish, calm, NO SHINY, and 5ivs? i try to rng manipulate ma but u find many problems.

Adapt the script to search whatever criteria you want. Keep in mind there are only 2^16 seeds, so you need to consider if it is statistically possible. 5 flawless IVs is 1:2^25, which means a spread probably won't exist.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...