PBS file "trainertypes.txt"
The PBS file "trainertypes.txt" lists all the defined trainer types in the game. Each line in this file is one separate trainer type.
Every line in this file follows the same format. Firstly, here are some examples:
1,POKEMONTRAINER_Leaf,Pokémon Trainer,60,,,,Female,, 7,BEAUTY,Beauty,56,,,,Female,, 18,HIKER,Hiker,32,,,,Male,, 51,COOLCOUPLE,Cool Couple,72,,,,Mixed,48, 59,LEADER_Brock,Gym Leader,100,gymleader,,,Male,, 71,CHAMPION,Champion,100,elite,,,Male,,Each line is structured as follows, with commas separating each part:
Part | Information | Description |
---|---|---|
1 | ID number | This number must be different for each trainer type. It must be a whole number between 0 and 65535. You can skip numbers (e.g. the sequence 23,24,25,197,198,199,... is allowed). The order in which trainer types are numbered is not important. |
2 | Internal name | This is how the scripts refer to the trainer type. Typically this is the trainer type's name, but written in all capital letters and with no spaces or symbols. The internal name is never seen by the player. |
3 | Display name | The name of the trainer type, as seen by the player. Multiple trainer types can have the same display name, although they cannot share ID numbers or internal names. |
4 | Base money | The amount of money earned from defeating a trainer of this type. The base money value is multiplied by the highest Level among all the trainer's Pokémon to produce the actual amount of money gained (assuming no other modifiers). Must be a number between 0 and 255.
Optional. If undefined, the default is 30. |
5 | Battle BGM | The name of a background music (BGM) file in the folder "Audio/BGM" (excluding its file extension). The music that plays during battles against trainers of this type. Typically only defined for Gym Leaders, Elite Four members and rivals.
Optional. If undefined, the default BGM is used. |
6 | Victory BGM | The name of a background music (BGM) file in the folder "Audio/BGM" (excluding its file extension). The victory background music that plays upon defeat of trainers of this type.
Optional. If undefined, the default victory BGM is used. |
7 | Intro ME | The name of a music effect (ME) file in the folder "Audio/ME" (excluding its file extension). The music that plays before the battle begins, while still talking to the trainer.
Optional. If undefined, the default ME is used. |
8 | Gender | The gender of all trainers of this type. Is one of:
Optional. If undefined, the default is "Mixed". |
9 | Skill level | The skill level of all trainers of this type, used for battle AI. Higher numbers represent higher skill levels. Must be a number between 0 and 255.
Optional. If undefined, default is equal to the base money value. |
10 | Skill codes | A text field which can be used to modify the AI behaviour of all trainers of this type. No such modifiers are defined by default, and there is no standard format. See the page Battle AI for more details.
Optional. If undefined, the default is blank. |
There is no difference between a trainer type used by many trainers (e.g. Bug Catcher), and a trainer type unique to just one NPC (e.g. Gym Leaders). They are all defined in exactly the same way.
It is important to note that the player also has a trainer type, and it is defined in exactly the same way as any other trainer type. Player characters are defined in the PBS file "metadata.txt" to have trainer types. They do not need to be the first trainer types defined in the PBS file "trainertypes.txt", although it may help developers to keep track of them if they are.
Each trainer type must have the following graphics, placed in the "Graphics/Characters" folder with the following names:
trainerXXX.png
- The trainer type's battle sprite. "XXX
" is either the internal name of the trainer type, or its ID number padded to 3 digits (e.g. "018
" is the Hiker trainer type).trcharXXX.png
- The trainer type's overworld charset. "XXX
" is as above.Certain trainer types will also require back sprites. These include all trainer types which are used by player characters, as well as all trainer types which have NPC trainers who team up with the player and fight alongside them (i.e. partner trainers). Back sprites are also placed in the "Graphics/Characters" folder, with the following name:
trbackXXX.png
- "XXX
" is as above.The back sprite can either be a square picture (e.g. 128x128 pixels), or it can contain 5 such square pictures arranged horizontally (e.g. 640x128 pixels). The first frame will be the regular back sprite, and the next four depict a throwing animation in order.
An individual trainer begins with its definition. This means that it is listed in the PBS file "trainers.txt", so that it can be recognised by the game as an individual trainer.
The PBS file "trainers.txt" lists all the defined individual trainers in the game. Each section in this file is one separate individual trainer, where a section begins with a line containing the internal name of a trainer type and ends when the next section begins.
The first three lines of each section are consistent, and are always present. After those, there are one to six additional lines, each of which defines a Pokémon owned by that trainer.
Firstly, here are three examples:
CAMPER Liam 5 DIGLETT,10 BONSLY,11 MAGIKARP,12 TEDDIURSA,10 SENTRET,14
TEAMROCKET_M Grunt,1 1 WEEPINBELL,21
LEADER_Brock Brock 2,FULLRESTORE,FULLRESTORE GEODUDE,12,,DEFENSECURL,HEADSMASH,ROCKPOLISH,ROCKTHROW,0,M,,,,20 ONIX,14,SITRUSBERRY,HEADSMASH,ROCKTHROW,RAGE,ROCKTOMB,0,M,,shiny,,20,,Rocky,,19
The line information is as follows:
Line | Content |
---|---|
1 | The internal name of the trainer's type, as defined above. |
2 | The trainer's name (e.g. Dave).
Multiple individual trainers can share the same name and trainer type. In that case, each of them must also have a unique ID number (between 0 and 255), which is written on this line after the trainer's name and after a comma. When creating the trainer's event, you should include the ID number in the appropriate way to show which specific trainer you want to use. ID numbers are useful for rematches, where they represent different versions of the same trainer changing over time, and for creating groups of "Grunts" (multiple separate trainers with the same name and appearance, e.g. "Team Rocket Grunt", where "Team Rocket" is the trainer type and "Grunt" is the name). Note that there are rules placed on the usage of ID numbers for rematch trainers. |
3 | There are two main parts to this line, with each part separated by a comma:
The Pokémon count is necessary, but the items are all optional. If this trainer does not have any items, the line will simply consist of a single number (no commas). |
4, etc. | There are a number of lines here, each one corresponding to a single Pokémon owned by this trainer. The total number of Pokémon lines is the Pokémon count number in line 3.
Each Pokémon line has up to 17 parts (only the first two, species and level, are necessary), with each part separated by a comma:
|
Note that both the number of lines per section (i.e. per trainer), and the lengths of the lines describing individual Pokémon (i.e. how many commas there are in it), vary from trainer to trainer.
The EVs of a trainer's Pokémon depend on its level. They are each automatically set to 1.5 times its level, up to a maximum of 85.