# tutorial [Tutorial][HGSS] Restoring the evolution by location's code

## Recommended Posts

So today we're going to restore the missing code needed to evolve some Pokémon by leveling them up in a specific location.

More specifically Eevee into Leafeon, Eevee into Glaceon, Magneton into Magnezone and Nosepass into Probopass.

As it is, there's currently no way to obtain those evolutions on a retail card without trading them to DPPt.

This is the code for the location-specific evolution (this comes from Platinum btw):

```07 4B 00 22 19 88 88 42 04 D1 50 1C 41 00 04 48
40 5A 70 47 92 1C 1B 1D [b][u]YY[/u][/b] 2A F3 D3 00 20 70 47
[b][u]XX XX XX XX[/u][/b]```

XX XX XX XX is the offset for the following data :

```81 01 1A 00 CB 00 19 00 CF 00 18 00 D0 00 18 00
D1 00 18 00 D2 00 18 00 D3 00 18 00 D4 00 18 00
D5 00 18 00 D6 00 18 00 D7 00 18 00 D8 00 18 00
D9 00 18 00 DA 00 18 00 DB 00 18 00 DC 00 18 00
DD 00 18 00 FE 01 18 00 FF 01 18 00 48 02 18 00
49 02 18 00```

Format is MM MM EE EE

• MM MM is the map number
• EE EE is the evolution method

For example the first 4 bytes are read like this:

• 81 01 => 01 81 => map 385 which is Route 217 (oustide)
• 1A 00 => 00 1A => evolution method 26 which is used to evolve Eevee into Glaceon

Ergo if you level up Eevee on Route 217, it will evolve into Glaceon.

YY is the total of map-related evolution, times 2.

Map-related evolutions are 4 bytes long each, the total is 84 bytes long.

84 / 4 = 21

Then multiply by 2.

21 × 2 = 42

42 is 2A in hex, thus in Pokémon Platinum YY is equal to 2A.

This is what the routine looks like:

As surprising as it may be, the function still exists in HGSS, or rather the leftovers.

Judge by yourself:

No wonder you can't trigger location-specific evos at all.

So how are we going to restore the code ?

Step 1:

Open Pokémon HG or SS with CrystalTile2.

Step 2:

Decompress the arm9 by right-clicking and then selecting Extract(U).

Step 3:

We're going to search for a place to fit in the new code, a place with enough unused FF FF should do the trick.

Why not for example the address 0×11025C ?

Step 4:

Copy and paste this string:

```07 4B 00 22 19 88 88 42 04 D1 50 1C 41 00 04 48
40 5A 70 47 92 1C 1B 1D [b][u]12[/u][/b] 2A F3 D3 00 20 70 47
[b][u]C8 02 11 02[/u][/b]```

Step 5:

We need to paste the new map-data too.

But wait a second, none of Leafeon, Glaceon, Magnezone or Probopass are listed in the Johto Dex!

To alleviate that issue, map-specific evolution are going to be Kanto-only.

• Eevee into Leafeon : Virdian Forest (that one is a given)
• Eevee into Glaceon : Seafoam Islands except the Gym part (again, a given)
• Magneton into Magnezone and Nosepass into Probopass : Route 10 and Power Plant (reasoning being that Power Plant used to be home to Magnemite and Magneton)

That makes for 9 maps in total, thus 36 bytes in total, hence why YY in this code is equal to 12.

Copy and paste this string at address 0×1102C8 (thus XX XX XX XX is equal to C8 02 11 02 which is 021102C8 in little-endian):

```92 00 1A 00 C5 01 1A 00 C6 01 1A 00 C7 01 1A 00
C8 01 1A 00 93 00 19 00 12 00 18 00 84 01 18 00
D3 01 18 00```

Step 6:

A problem arises, there are 3 routines who use a Branch linking to the map-evo function, thus we have to modify the pointers:

Go to address 0×3CE04 and change FEFC02FC into D3F02AFA.

Go to address 0×51E5C and change E9F7D6FB into BEF0FEF9.

Go to address 0×81E6E and change B9F7CDFB into 8EF0F5F9.

This is only for English versions for now, I will eventually update with offsets for all regions.

Step 7:

Save your modified arm9 and close the Hex editor.

Step 8:

Reinsert the arm9 into your ROM.

Now you won't need to transfer the aforementioned Pokémon to DPPt with this trick, so go and evolve that Eevee / Magnemite / Nosepass.