Personality value
A Pokémon's personality value is an unsigned 32-bit integer that is created when the Pokémon is first encountered; it is set as soon as the Pokémon appears in the wild, the Pokémon's egg is received from the daycare man or another NPC, or the Pokémon itself is received from an NPC. As an unsigned 32-bit integer, its value can be anywhere between 0 and 4,294,967,295 inclusive, represented as a string of thirty-two 0's and thirty-two 1's in binary, respectively. This value was introduced with the Pokémon data structure overhaul that occurred at the start of Generation III, and is generated using the games' pseudorandom number generator.
For each operation, the portion of the 32-bit value used will be indicated at the beginning of the section by highlighting, unless the full value is used. The integer's full value will be known as p, other values will be declared as px, py, and so on. Much of this article will be discussing values in binary.
Gender
00000000 00000000 00000000 00000000
A Pokémon's gender is determined by the lowest eight digits (a byte) of p in binary form; essentially, p % 256
. This value will, from here on out, be known as pgender.
In a Pokémon species's base stat structure, there is a byte called the gender threshold with a value between 00000000
and 11111111
. For genderless Pokémon such as Magnemite, the value of this byte is 11111111
. For female only Pokémon such as Nidoran♀, the value of this byte is 11111110
. For male only Pokémon such as Nidoran♂, the value of this byte is 00000000
. Pokémon with both genders occupy the rest of the spectrum. For these Pokémon, if the value of pgender is greater than that of the base stat value, the Pokémon is male, otherwise it is female.
Base stat value | Gender ratio | ||
---|---|---|---|
Binary | Decimal | Male | Female |
11111111
|
255 | Genderless | |
11111110
|
254 | 0% | 100% |
11011111
|
223 | 12.5% | 87.5% |
10111111
|
191 | 25% | 75% |
01111111
|
127 | 50% | 50% |
00111111
|
63 | 75% | 25% |
00011111
|
31 | 87.5% | 12.5% |
00000000
|
0 | 100% | 0% |
Ability
If p is even, that Pokémon has the first ability for its species. If it's odd, it has the second. If a species has only one ability while p is odd, it gets the only ability it can. Pokémon transferred from Generation III to Generation IV that can get one of the new abilities will retain the ability they had in Generation III; however, if they are evolved and their personality value is odd, they will get the new ability upon evolution. In this way, it is possible for a Porygon2 to have the ability Download, despite its pre-evolution having the ability Trace, even though it came from the Generation III games.
Nature
A Pokémon's nature is determined by p % 25
.
The number acquired as the remainder corresponds to the personality as follows:
p % 25 | Nature |
---|---|
0 | Hardy |
1 | Lonely |
2 | Brave |
3 | Adamant |
4 | Naughty |
5 | Bold |
6 | Docile |
7 | Relaxed |
8 | Impish |
9 | Lax |
10 | Timid |
11 | Hasty |
12 | Serious |
13 | Jolly |
14 | Naïve |
15 | Modest |
16 | Mild |
17 | Quiet |
18 | Bashful |
19 | Rash |
20 | Calm |
21 | Gentle |
22 | Sassy |
23 | Careful |
24 | Quirky |
Shininess
00000000 00000000 00000000 00000000
- The red value will be represented as p1, while the blue value will be represented as p2.
Whether a Pokémon is Template:Shiny2 or not depends on the values of the Trainer ID number, secret ID number, and personality value. There is an 8 in 65536 chance (0.00012207% or 2-13) of a Pokémon being shiny (which simplifies to 1/8192).
Variables E and F are declared to hold the values that result.
A bitwise exclusive or (xor) operation (such as a xor b = c) is equivalent to saying "If each bit of a ≠ b, c is true." In other words, 11010111 xor 01101010 = 10111101. Each xor in the operation is a bitwise xor.
E = IDTrainer xor IDSecret
F = p1 xor p2
E xor F < 8 , then Shiny
Example
As an example, let's take a trainer whose Trainer ID is 24294 and whose Secret ID is 38834.
IDTrainer = 24294 = 0101111011100110 in binary.
IDSecret = 38834 = 1001011110110010 in binary.
This trainer encounters a Pokémon whose personality value is 2814471828.
p = 2814471828 = 1010011111000001 0110111010010100 in binary.
p1 = 1010011111000001
p2 = 0110111010010100
The E value is 0101111011100110 xor 1001011110110010
E = 1100100101010100
The F value is 1010011111000001 xor 0110111010010100
F = 1100100101010101
E xor F = 0000000000000001, which is less than eight. Therefore, this Pokémon is shiny.
Spinda's spots
00000000 00000000 00000000 00000000
Spinda has four spots: two on its face, and one on each of its ears. Each of the four bytes represents the coordinates of the spot on Spinda's face or ears. The first four digits of each byte represents the x-coordinate of the top left of the spot when translated into decimal notation, while the last four represent the y-coordinate of the top left of the spot when translated into decimal. There are 4,294,967,296 different spot variations.
Unown's letter (from Gen. III)
00000000 00000000 00000000 00000000
pletter = 00000000
Unown's letter (ever since Generation III) is taken from the modulus of the combination of the least significant 2 bits of each byte in p. With A representing 0, and each letter thereafter representing the following number value (? as 26 and ! as 27), the letter can be determined by:
up = pletter % 28
Wurmple's evolution
00000000 00000000 00000000 00000000
The value in red will be known as pw; it is essentially p % 65536
.
Wurmple's evolution does not depend on time of day, despite what many guides say. In fact, the evolution is determined by taking pw % 10
. If the remainder is less than 5, Wurmple will become a Silcoon, and if it is greater than or equal to 5, it will become a Cascoon.