Trainer data structure (Generation II)
|
This article is incomplete. Please feel free to edit this article to add missing information and complete it. Reason: How is each Trainer structure called from the list? |
The Trainer data structure in Pokémon Gold and Silver Versions and Pokémon Crystal Version is the format used by the game to store Trainers Pokémon parties. All Trainers are in the same list and use the same base structure, with some controlled variations described below. In Gold & Silver this list begins at memory address 0x0399C2, and in Crystal it begins at 0x039A1F. Unlike most other data structures, Trainer entries can vary in size. One byte is designated to indicated which structure type is used.
The Structure
| Trainer Data | ||||
|---|---|---|---|---|
| Section | Type 0 | Type 1 | Type 2 | Type 3 |
| Name string | 1-8 bytes | |||
| String terminator | 0x50 | |||
| Structure Byte | 0x00 | 0x01 | 0x02 | 0x03 |
| Level | 1 byte | |||
| Species index number | 1 byte | |||
| Item index number | - | - | 1 byte | 1 byte |
| Moves by index number | - | 4 bytes | - | 4 bytes |
| Entry terminator | 0xFF | |||
Name
Trainer names are stored as encoded string of up to 8 bytes. Name strings are terminated by a single byte set to 0x50. This prevents characters like "B" (which is encoded as 0x01) from being interpreted incorrectly. The rival's name is represented by a single byte set to 0xE6.
Structure Byte
This byte indicates which structure format will follow and thus what features the Trainer can possess. Regardless of the structure type, all trainers will have a minimum of 2 bytes per Pokemon to indicate their level and species.
Structure 0x00 only allows a Trainer's Pokémon to have the default moveset for their level and no items. Most Trainers use this structure.
Structure 0x01 allows for a Trainer's Pokémon to have custom moves, typically TMs or moves they can learn at a lower level. The players rival, all Gym Leaders, the Elite Four, the Champion, Red, and some typical Trainers use this structure.
Structure 0x02 allows for a Trainer's Pokémon to have Held items but only the default moveset for their level. Few Trainers use this structure.
Structure 0x03 allows for held items and custom movesets. Almost no Trainers use this structure.
Pokémon
For each Pokémon in their team, a Trainer will have one byte for the Pokémon's level and one byte for the Pokémon's index number, in that order. Type 0x01 Trainers have 4 extra bytes per Pokémon for their movesets. Each move is denoted by its index number. Blank move slots are represented with 0x00. Type 0x02 Trainers instead have one extra byte per Pokémon for the index number of their held item. Type 0x03 Trainers have all 5 extra bytes per Pokémon, with the item preceding their moveset.
Terminator
This is a single byte set to 0xFF which tells the processor to stop reading data.
Related articles
| This game-related article is a stub. You can help Bulbapedia by expanding it. |
| |||||||||||||||||||||||||||||||||
|
This data structure article is part of Project Games, a Bulbapedia project that aims to write comprehensive articles on the Pokémon games. |

