Jump to content

pid Are PIDs changed from Gen 5 to Gen 6?

Recommended Posts

A pokemon is shiny in gens 3-5 iff:

((PID >> 16) ^ (PID & 0xFFFF) ^ TID ^ SID) < 8

And for gens 6+ iff:

((PID >> 16) ^ (PID & 0xFFFF) ^ TID ^ SID) < 16

Since shinyness (or lack thereof) is retained from gen 5 to gen 6, I assumed that the games use the old formula for pokemon originating from older games. However, just to test it, I made a .pk3 with TID = SID = 0 and PID = 0xF. In gen 3-5 this should be non-shiny but in gens 6+ it should be shiny (had it originated from those gens). But when I converted the .pk3 to .pk6 the PID was automatically changed from 0x0000000F to 0x8000000F. This has it retain its non-shinyness but at the cost of changing its PID.

This behavior is supposed to model what happens in bank, right? Does that mean bank actually modifies PIDs across gen 5-gen 6? Is there a formula for this? Does it just reroll until it gets a valid PID?


Edited by Prof. 64
Link to post
Share on other sites

Are PIDs changed from Gen 5 to Gen 6?

Mostly (as in very very high percentage) no.

In a very low chance scenario, yes (and TL;DR: it's as Delta Blast Burn says)
[I understand you (OP) may understand how this works; do note I'm also breaking this down for other readers]
Explainer (wall of text and semi-technical jargon alert):


Gen 3 to Gen 5 requires the xor'd value of < 8 to be shiny.

When people say "xor'd value" here, they're referring to the result of this:

PID [lower 16 bits] xor PID [higher 16 bits] 
xor Full Trainer ID [higher 16 bits] (TID in older games) 
xor Full Trainer ID [lower 16 bits] (SID in older games)

where xor refers to the "exclusive or" operation.
(do remember in gen 6 and above, TID/SID is determined differently. However, the shiny calculation doesn't use TID xor SID for those aforementioned games, but rather FTIDH xor FTIDL)

The value obtained from this mathematical formula, for each mon, can range from 0 to 65535. As PID and Full Trainer ID doesn't change on a mon, the xor'd value also won't change.

From Gen 6 onwards, the requirement for shiny changed, meaning the required xor'd value is instead < 16.

Now imagine, a mon with a xor'd value of 15.
Gen 3-5:
Value of 15 greater than shiny threshold (<8) -> Thus not shiny.
Gen 6 and above:
Value of 15 is within the shiny threshold (<16) -> Thus shiny.

Based on the example above, you can see a non-shiny becoming a shiny.
This example illustrates the following: any mons that had the xor'd value of 8 to 15 in Gen 3-5 weren't shiny then, but would transform into a shiny in Gen 6 onwards (since the xor'd value threshold is increased by those games, and the xor'd value on the mon would not change).

Given how a non-shiny transforming into a shiny goes against the canon so far set by TPCi/GF, they made these cases change their PID;
the PID for those cases would flip the most significant bit (the bit is flipped from 1 to 0, or from 0 to 1).
This causes the xor'd value to also change, to be no longer 8 to 15. The result for the xor'd value would be larger than 15, thus maintaining their non-shininess. This has a 8/65536, or 1/8192 chance of happening. As low as original shiny odds.

You can read more about shiny Pokemon here: https://bulbapedia.bulbagarden.net/wiki/Shiny_Pokémon

  • Like 2
Link to post
Share on other sites
1 hour ago, Prof. 64 said:

I see, and since Gen 6+ doesn't use the PID for anything but shinyness, that bitflip is harmless. This clears it up completely then, thanks!

Well, PKHeX accounted for the bitflip for certain PIDIV combinations.

But from a player standpoint, if they never read up on hacking and anything technical, they'll never come across the phrase PID.
and even if they did, there is no way to view the PID without hacking. So it doesn't really harm anyone per se.

Link to post
Share on other sites

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...