Methods 3-5
Prerequisite
Having read Methods 1-4 and VBlanks.How PID rerolls work in-game
Before generating a wild Pokémon's PID, the game chooses the nature it wants. It then generates random PIDs until it finds one with that nature. Each rejected PID is discarded, and generating another is called a PID reroll. Here's a simplified example of the game logic:- Choose the wanted nature.
- Generate the 1st half of a PID with one RNG call.
- Generate the 2nd half with another RNG call, then combine the halves.
- Check whether the PID has the wanted nature. If it doesn't, return to step 2.
- Keep the matching PID, create the Pokémon, then generate its IVs.
Pokémon Wild Encounter (Without a VBlank)
Suppose the game wants an Adamant Pokémon. The first two PIDs don't match, but the third does:| Step | RNG Advances Used | Result |
|---|---|---|
| Generate 1st PID | 1, 2 | Wrong nature: discard PID |
| Generate 2nd PID | 3, 4 | Wrong nature: discard PID |
| Generate 3rd PID | 5, 6 | Adamant: keep PID |
| Generate Def, Atk, HP IVs | 7 | First group of IVs |
| Generate SpD, SpA, Spe IVs | 8 | Second group of IVs |
VBlank during PID rerolls
Each PID attempt takes CPU cycles to generate both halves and check the resulting nature. If the game needs many retries, a VBlank may occur while it is still searching for a valid PID. When this happens, PID generation pauses while the VBlank advances the RNG by 1. Generation then resumes where it stopped, but the next RNG call now returns a different value. This changes which RNG values are combined into PIDs. If the VBlank separates the halves of a PID that passes the game's checks, the result is Wild-3. If the game rejects that PID, or the VBlank occurs between attempts, it continues trying new pairs of RNG values. A later accepted PID can then produce Wild-5.Wild-3: VBlank between the halves of the accepted PID
Wild-3 occurs when a VBlank separates the two halves of the PID that the game keeps.| Step | RNG Advance Used |
|---|---|
| Generate 1st half PID | 1 |
| VBLANK: Advance RNG | 2 |
| Generate 2nd half PID | 3 |
| Check PID | PID has wanted nature (No RNG call) |
| Generate Def, Atk, HP IVs | 4 |
| Generate SpD, SpA, Spe IVs | 5 |
Wild-5: VBlank before a later PID attempt
Wild-5 occurs when a VBlank consumes an RNG advance during the reroll process, and the game later accepts a PID made from two consecutive advances. For example, suppose the first PID is rejected, then a VBlank occurs before the next attempt:| Step | RNG Advances Used | Result |
|---|---|---|
| Generate 1st PID | 1, 2 | Wrong nature: discard PID |
| VBLANK: Advance RNG | 3 | |
| Generate 2nd PID | 4, 5 | Wrong nature: discard PID |
| Generate 3rd PID | 6, 7 | Wanted nature: keep PID |
| Generate Def, Atk, HP IVs | 8 | First group of IVs |
| Generate SpD, SpA, Spe IVs | 9 | Second group of IVs |
Important
If a VBlank occurs between the halves of a PID, but that PID is rejected, generation continues with new pairs. The later accepted Pokémon can therefore be Wild-5. A VBlank between PID halves only produces Wild-3 when that PID passes the game's checks.
| Step | RNG Advances Used | Result |
|---|---|---|
| Generate 1st half of 1st PID | 1 | |
| VBLANK: Advance RNG | 2 | |
| Generate 2nd half of 1st PID | 3 | Wrong nature: discard PID |
| Generate 2nd PID | 4, 5 | Wrong nature: discard PID |
| Generate 3rd PID | 6, 7 | Wanted nature: keep PID |
| Generate Def, Atk, HP IVs | 8 | First group of IVs |
| Generate SpD, SpA, Spe IVs | 9 | Second group of IVs |
Optimizing Wild-3 and Wild-5
There are 25 natures, so each random PID has a 1/25 chance of matching the wanted nature. The game therefore needs 25 PID rerolls on average to generate a valid PID. Synchronize changes how the wanted nature is chosen, but the generated PID still has to match that nature. The average remains 25 PID rerolls, whether Synchronize activates or not. In Emerald, Cute Charm can greatly increase the number of rerolls because the PID must match both the wanted nature and the required gender. To maximize retries, use a lead whose opposite gender is rare in the encountered species. For example, when male Cute Charm activates when encountering Relicanth (1/8 chance of being female), it requires in average 200 PID rerolls. This longer search gives a VBlank much more time to interrupt the reroll process, greatly increasing the chance of Wild-5. However, more retries don't give the same improvement to Wild-3. A VBlank must land in the 80-cycle gap between PID halves, and that particular PID must pass all checks. With Cute Charm in the Relicanth example, there are about 200 PID rerolls, but an interrupted PID has only about a 1/200 chance of being valid. The extra opportunities are offset by the lower acceptance chance, so the overall chance of Wild-3 stays approximately the same.Credits
- RainingChain for the article.