Advertiser Content

Pokeemerald Custom Evolution Methods

Started by The Law January 24th, 2019 6:15 AM
  • 1139 views
  • 6 replies

The Law

Critical, but well meaning

Male
Seen 1 Week Ago
Posted July 13th, 2019
13 posts
305 Days
In this tutorial we'll be looking into making custom evolution methods. Some of these are from Gen IV and onwards, but I will also show you a custom evolution method I made myself.

Every method will use the following files.
include>pokemon.h
src>pokemon.c
src>data>pokemon>evolution.h


Table of Contents:
-Level with certain gender
-Level up with move
-Level up at certain location
-Level with held item at certain time of day
-Level up with another Pokémon in party
-Item as a certain gender
*More to come*

Bugs:
-If you find any bugs leave a comment on this thread, or contact me on discord @TheLaw#9999

The Law

Critical, but well meaning

Male
Seen 1 Week Ago
Posted July 13th, 2019
13 posts
305 Days
Level with certain gender


Step 1: defining our evolution method
Navigate to line 395 in include>pokemon.h
You should see the following:


Line 410 & 411 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_LEVEL_MALE & EVO_LEVEL_FEMALE

Code for copy pasting:
#define EVO_LEVEL_MALE 0x0010 // Pokémon levels up with a specific gender
#define EVO_LEVEL_FEMALE 0x0011 // Pokémon levels up with a specific gender

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:
  1. 0x0010
  2. 0x0011
  3. 0x0012
  4. 0x0013
  5. 0x0014
  6. 0x0015
  7. 0x0016
  8. 0x0017
  9. 0x0018
  10. 0x0019
  11. 0x001a
  12. 0x001b
  13. 0x001c
  14. 0x001d
  15. 0x001e
  16. 0x001f
If you still need more evolution methods. Start from the top of the list, and replace 1 with 2.

Step 2: call on the right data
Navigate to src>pokemon.c we need to go far down to line 5729 where we find this:

We add a u8 gender = GetMonGender(mon); here. This it to check what gender our mon has.

Further down we add the specific condition for this evolution method. Make a new line after 5809 and paste the following code:

case EVO_LEVEL_MALE:
if (gEvolutionTable[species][i].param <= level && (gender) == 0)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_FEMALE:
if (gEvolutionTable[species][i].param <= level && (gender) == 254)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;



This tells the game that we want it to check for the pokemons gender and level. If the level and gender matches, it will trigger the evolution.

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_LEVEL_MALE, 36, SPECIES_CHARIZARD}},

Now our Charmeleon will evolve at level 36, if it is a male. The level can always be changed to something else.

The Law

Critical, but well meaning

Male
Seen 1 Week Ago
Posted July 13th, 2019
13 posts
305 Days
Level with move


Step 1: defining our evolution method
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_MOVE

Code for copy pasting:
#define EVO_MOVE 0x0011 // Pokémon levels up while knowing the specified move

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:
  1. 0x0010
  2. 0x0011
  3. 0x0012
  4. 0x0013
  5. 0x0014
  6. 0x0015
  7. 0x0016
  8. 0x0017
  9. 0x0018
  10. 0x0019
  11. 0x001a
  12. 0x001b
  13. 0x001c
  14. 0x001d
  15. 0x001e
  16. 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 we need to go far down to line 5812.

We now add the specific condition for this evolution method.

case EVO_MOVE:
if (MonKnowsMove(&gPlayerParty[i], gEvolutionTable[species][i].param) == TRUE)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;

The game now checks if we have a certain move, and if it meets the condition we set.

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_MOVE, MOVE_FLAMETHROWER, SPECIES_CHARIZARD}},

Now our Charmeleon will evolve if it knows the move Flamethrower. The move can be changed to any other move in the game.

The Law

Critical, but well meaning

Male
Seen 1 Week Ago
Posted July 13th, 2019
13 posts
305 Days
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:
  1. 0x0010
  2. 0x0011
  3. 0x0012
  4. 0x0013
  5. 0x0014
  6. 0x0015
  7. 0x0016
  8. 0x0017
  9. 0x0018
  10. 0x0019
  11. 0x001a
  12. 0x001b
  13. 0x001c
  14. 0x001d
  15. 0x001e
  16. 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][i].param) == mapGroup && EVO_MAP_NUM(gEvolutionTable[species][i].param) == mapNum)
targetSpecies = gEvolutionTable[species][i].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

The Law

Critical, but well meaning

Male
Seen 1 Week Ago
Posted July 13th, 2019
13 posts
305 Days
Level with held item at certain time of day


OBS!!! If evolution is cancelled, the held item is still consumed.

Step 1: defining our evolution method
Now navigate to line 395 in include>pokemon.h
You should see the following:


Line 410 & 411 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_HELD_ITEM_DAY & EVO_HELD_ITEM_NIGHT

Code for copy pasting:
#define EVO_HELD_ITEM_DAY 0x0011 // Pokémon levels up during the day while holding the specified item
#define EVO_HELD_ITEM_NIGHT 0x0012 // Pokémon levels up during the night while holding the specified item

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:
  1. 0x0010
  2. 0x0011
  3. 0x0012
  4. 0x0013
  5. 0x0014
  6. 0x0015
  7. 0x0016
  8. 0x0017
  9. 0x0018
  10. 0x0019
  11. 0x001a
  12. 0x001b
  13. 0x001c
  14. 0x001d
  15. 0x001e
  16. 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

We now add the specific condition for this evolution method.

All parameters are already available to us from the start so go ahead and add the code:

case EVO_HELD_ITEM_DAY:
RtcCalcLocalTime();
if (gLocalTime.hours >= 0 && gLocalTime.hours < 12 && gEvolutionTable[species][i].param == heldItem)
{
heldItem = 0;
SetMonData(mon, MON_DATA_HELD_ITEM, &heldItem);
targetSpecies = gEvolutionTable[species][i].targetSpecies;
}
break;
case EVO_HELD_ITEM_NIGHT:
RtcCalcLocalTime();
if (gLocalTime.hours >= 12 && gLocalTime.hours < 24 && gEvolutionTable[species][i].param == heldItem)
{
heldItem = 0;
SetMonData(mon, MON_DATA_HELD_ITEM, &heldItem);
targetSpecies = gEvolutionTable[species][i].targetSpecies;
}
break;

Add this at line 5814. It should looks like 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_HELD_ITEM_DAY, ITEM_FIRE_STONE, SPECIES_CHARIZARD}},

Now our Charmeleon will evolve if it levels up during the day holding a firestone. It can be changed to night, and another item can be used.

The Law

Critical, but well meaning

Male
Seen 1 Week Ago
Posted July 13th, 2019
13 posts
305 Days
Level up with another Pokémon in party


Step 1: defining our evolution method
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_SPECIES

Code for copy pasting:
#define EVO_SPECIES 0x0011 // Pokémon levels up while a specific Pokémon is in the party.

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:
  1. 0x0010
  2. 0x0011
  3. 0x0012
  4. 0x0013
  5. 0x0014
  6. 0x0015
  7. 0x0016
  8. 0x0017
  9. 0x0018
  10. 0x0019
  11. 0x001a
  12. 0x001b
  13. 0x001c
  14. 0x001d
  15. 0x001e
  16. 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

We now add the specific condition for this evolution method.

First we need to add an int j;

You can add it right below int i;

Then insert this:

case EVO_SPECIES:
for (j = 0; j < PARTY_SIZE; j++)
{
u16 checkSpecies = GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL);
if (checkSpecies == gEvolutionTable[species][i].param)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
}
break;

Add this at line 5814. It should looks like 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_SPECIES, SPECIES_CHARMANDER, SPECIES_CHARIZARD}},

Now our Charmeleon will evolve if it levels up with a Charmander in the party. The specific mon can be changed.

The Law

Critical, but well meaning

Male
Seen 1 Week Ago
Posted July 13th, 2019
13 posts
305 Days
Item as a certain gender


Step 1: defining our evolution method
Now navigate to line 395 in include>pokemon.h
You should see the following:


Line 410 and 411 were 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_SPECIES

Code for copy pasting:
#define EVO_ITEM_MALE 0x0011 // Specified item is used on male Pokémon
#define EVO_ITEM_FEMALE 0x0012 // Specified item is used on female Pokémon

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:
  1. 0x0010
  2. 0x0011
  3. 0x0012
  4. 0x0013
  5. 0x0014
  6. 0x0015
  7. 0x0016
  8. 0x0017
  9. 0x0018
  10. 0x0019
  11. 0x001a
  12. 0x001b
  13. 0x001c
  14. 0x001d
  15. 0x001e
  16. 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

We now add the specific condition for this evolution method.

This time we are not adding code to the same case as before. YOu might not have noticed it, but we have been adding code to case 0. This time we have to add to case 3. Case 3 holds the evolution method for using an item. So insert the following code:

case 3:
for (i = 0; i < EVOS_PER_MON; i++)
{
if ((gEvolutionTable[species][i].method == EVO_ITEM
&& gEvolutionTable[species][i].param == evolutionItem)
|| (gEvolutionTable[species][i].method == EVO_ITEM_MALE
&& gEvolutionTable[species][i].param == evolutionItem && (gender) == MON_MALE)
|| (gEvolutionTable[species][i].method == EVO_ITEM_FEMALE
&& gEvolutionTable[species][i].param == evolutionItem && (gender) == MON_FEMALE))
{
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
}
}
break;

The code should look exactly like what you have above. I have included the regular use item to evolve method in the code to make it less messy.

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_ITEM_MALE,ITEM_FIRE_STONE, SPECIES_CHARIZARD}},

Now our Charmeleon will evolve if it is a male and a fire stone is used on it. Do keep in mind for this evolution method, you can only use items that already work as evolutionary items such as the evolution stones. If you want to add your own custom stone, you'll have to wait to check out my guide on how to edit items.
Advertiser Content