Level up at certain location
Step 1: defining our evolution method
At the top add the following lines of code:
#define EVO_MAP_GROUP(map) (map >> 8) //Code to add
#define EVO_MAP_NUM(map) (map & 0xFF) //Code to add
It should now look something like this:
Now navigate to line 395 in
include>pokemon.h
You should see the following:
Line 410 was added by me.
This is where you will be adding your define for your evolution method.
The name does not matter, but to keep things tidy and organized we will name it
EVO_MAP
Code for copy pasting:
#define EVO_MAP 0x0011 // Pokémon levels up in a specific map
Do note that the text after // is a comment, and is not necessary. Our compiler won't use this, and it's only there for your sake really.
The hex value at the back is important too, it just counts up by one though so if you are familiar with hex this isn't an issue. If you aren't, every evolution method you add needs to have the following values:
- 0x0010
- 0x0011
- 0x0012
- 0x0013
- 0x0014
- 0x0015
- 0x0016
- 0x0017
- 0x0018
- 0x0019
- 0x001a
- 0x001b
- 0x001c
- 0x001d
- 0x001e
- 0x001f
If you still need more evolution methods. Start from the top of the list, and replace 1 with 2.
Step 2: Setting conditions
Navigate to
src>pokemon.c At the top add the following to the list of #include:
#include "constants/maps.h"
This is to ensure we can call upon the maps and define them.
We now add the specific condition for this evolution method.
case EVO_MAP:
if (EVO_MAP_GROUP(gEvolutionTable[species]
.param) == mapGroup && EVO_MAP_NUM(gEvolutionTable[species].param) == mapNum)
targetSpecies = gEvolutionTable[species].targetSpecies;
break;
Add this at line 5814. It should looks like this:
Lastly, we need to call on the parameters for the map. So go to line 5730 and add these 2 lines:
u8 mapGroup = gSaveBlock1Ptr->location.mapGroup;
u8 mapNum = gSaveBlock1Ptr->location.mapNum;
And end up with this:
Step 3: Apply the method to a Pokémon
Our last stop is src>data>pokemon>evolution.h
In here we find a list of all pokemon that evolve and what method they use to evolve with as well what the condtion is. From level to items.
The last step in our journey to apply an evolution method is simply choosing a Pokémon and changing it evolution method. In this case I will Charmeleon:
The code looks like this for our dear Charmeleon:
[SPECIES_CHARMELEON] = {{EVO_LEVEL, 36, SPECIES_CHARIZARD}},
and to apply our new method we simply change it to this:
[SPECIES_CHARMELEON] = {{EVO_MAP, MAP_ROUTE101 SPECIES_CHARIZARD}},
Now our Charmeleon will evolve if it levels up on route 101. The location can be changed to any you want. For a list of maps to use go to include>constants>maps.h