This article describes Pokémon trading, specifically trading with an NPC (not another player).
Setting up an NPC to trade Pokémon with is relatively straightforward. The NPC event should have two pages to it, the first containing code like in the example on the right. The second page depends on Self Switch A being ON, and typically contains a brief dialogue to the effect of "I hope you're treating my Pokémon well!".
The event works as follows:
- The player is asked whether they want to trade Pokémon, having been told what the trade is (e.g. player's Rattata for NPC's Haunter).
- The player chooses a Pokémon in their party. If the chosen Pokémon is a Rattata (and not an egg or Shadow Pokémon), its party index is stored in Global Variable 1 (and its name in Global Variable 2).
- The trade is performed. This includes an animation of the Pokémon being swapped. The received Pokémon replaces the traded-away Pokémon. If the received Pokémon would evolve, it does so.
- Self Switch A is turned ON.
The received Pokémon will always have the same level as the traded-away Pokémon. All Pokémon received in a trade should have a nickname. In the example on the right, the received Haunter is nicknamed "HaHa".
After the trade, if the received Pokémon can evolve due to being traded, it will do.
This is the method that makes the trade. It has a number of parameters, which are as follows:
|The index in the party of the player's old Pokémon (to be traded away). This should be chosen beforehand.|
|The species of the new Pokémon that the player will receive. This should be announced by the NPC beforehand (or not, if you want a blind trade).
This may be a predefined Pokémon instead of a species. This allows you to create and modify a Pokémon beforehand (e.g. set its gender/shininess) before trading it to the player. This must be done if the changes would affect the Pokémon's sprite (as the sprite is shown during the trading animation), or if you want it to hold an item that would make it evolve because of the trade (or an Everstone which will prevent such an evolution).
|The nickname of the new Pokémon that the player will receive. This cannot be changed by the player afterwards.|
|The name of the original trainer of the Pokémon that the player will receive (i.e. the name of the NPC).|
|Optional. The gender of the original trainer of the Pokémon that the player will receive (i.e. the gender of the NPC). By default, this is 0 (male). Set this to 1 to make the original trainer female.
This affects the colour of the text used to display the original trainer's information in the Pokémon's summary screens.
The original trainer's ID for the foreign Pokémon will be randomly generated during the trade.
A full example of using this def is as follows:
This is the same as the example above, except it makes the original trainer (Andrea) female.
Modifying the foreign Pokémon
As well as predefining the Pokémon to be received in the trade, and modifying it then, you may also/instead want to modify it after the trade. The foreign Pokémon's party index number will still be stored in Global Variable 1, so add into the event immediately after the trade something like the following:
This example will give the received Pokémon its Hidden Ability. You can modify the Pokémon in whichever way you like, although shininess, form and gender should be defined beforehand (see above) in order for the correct sprite to be shown in the trading animation. See the article Editing a Pokémon for all the aspects of a Pokémon you could change.
- You can make the trade requirements more specific than just requiring a Pokémon of a particular species. Why not require the player's Pokémon to be a particular gender, or nature, or have good EVs?
- Alternatively, you can make the trade less specific, or at least different. Why not require the player to hand over an egg, or a Pokémon in the Water 2 breeding category, or any Fire-type Pokémon?
- You can change the level of the foreign Pokémon if you predefine it before the trade and give it a different level. The trade itself will not change its level if it was predefined.