- For being able to battle the same trainer multiple times, see Rematches.
This page describes the phone application of the Pokégear. The phone allows the player to store the phone numbers of various trainers and other important people, and to call them and receive calls from them at any time.
The phone screen
The phone screen is displayed by code in the script section PScreen_Phone.
The background image for the phone screen is called "phonebg.png" and is located in the folder "Graphics/Pictures". If this image doesn't exist, the background is black.
Registering someone is the act of adding their phone number to your phone. A new contact will be added to the end of the contact list, which cannot be rearranged. There is no limit on the length of your contact list.
Registering a trainer
The easiest way to allow a trainer to be registered is to include multiple "Battle" comments in its event - see the page Trainers for more information on trainer event comments. The total number of these comments is the number of times the player can battle them (including the first time), and thus the number of versions of that trainer you should define. In addition, the comment "
RegSpeech" is what the trainer will say just before the player registers them (something like "Can we swap phone numbers?").
This is all you need to do - when the game is compiled, the event will be set up appropriately. See the page Rematches for what that event will look like.
Registering a special contact
To register a non-trainer (e.g. Professor Oak, Mom), you will need to use the following script:
The first number (3) is a unique identifying number for this contact, which determines which phone call messages are used (see below). Next is the display name of the contact. The second number (27) is the ID number of the map where this NPC is; the map name is shown in the contact list.
NPC contacts also need overworld charsets of themselves, to be displayed in the contact list. These charsets are in the folder "Graphics/Characters", and are called "phoneXXX.png", where "XXX" is the identifying number padded to 3 digits. For convenience, the event itself can also use the same charset.
The conversations shown when calling these contacts also need to be defined for each contact, as they will all be different. See below for how to define them.
Phone calls with trainers
These conversations will be the same regardless of whether the player calls the trainer, or the trainer randomly calls the player.
These calls can either be idle chatter, or a request for a rematch battle. All phone calls are arrangements of up to three different kinds of dialogue:
|The first part of all phone calls. The rest of a phone call is one of the below three options.|
|These two bits of dialogue are always used together.|
|Generics||This is a complete phone call in itself, minus the "Greetings" part.|
|BattleRequests||A phrase which declares that the caller is ready for a rematch.|
The possible dialogues for each of the above dialogue types are defined in the PBS file "phone.txt". Each dialogue type has its own section, and each possible dialogue is written on a separate line (see the page Messages for how they can be formatted).
Dialogue can reference several things, such as the caller's name and location. To do this, include the following in the dialogue where you want those things to appear:
|Code||What it is|
| ||The caller's name.|
| || A random Pokémon belonging to the caller (as of the last time they were battled).
Don't use this if the caller is not a trainer with Pokémon.
| || A random Pokémon that can be encountered in the map the caller is in.
Don't use this if the caller is not an NPC standing in a map (this usually means special NPCs such as Professor Oak and other non-trainers).
| || The name of the map the caller is standing in.
Again, don't use this if the caller is not an NPC standing in a map.
Frequency of calls
The time interval between two phone calls is between 20 and 40 minutes, not including time when messages are being displayed or the player is being forced to move via a move route. The caller is chosen at random from the list in the phone (of people who can call the player).
You cannot be called by someone if you are on the same map as them.
Phone calls with special contacts
Each special contact in your phone can be called at any time by choosing them from the phone. They will never call the player, though.
The messages shown when calling a special contact are written in a Common Event whose ID number is the special contact's identifying number (3 in the example above). These messages include the "ringing" and "click!" at the beginning/end of the call.
As these conversations are defined in a Common Event, it is easy to allow them to be interactive (e.g. to allow Professor Oak to ask whether the player wants him to comment on the Pokédex progress), and allows for them to be rather complex and context-sensitive (e.g. depending on the time of day, or on the player's progress through the game).
The numbers in the phone are stored in the array
$PokemonGlobal.phoneNumbers. Each element of this array is an array in itself, listing various values specific to that contact. The length and contents of a contact's array depends on whether the contact is a trainer.
For trainer contacts:
|0||Is visible|| This is either TRUE or FALSE. If this is TRUE, then the contact is displayed in the phone list (so the player can call them).
It is important that the contact's details remain stored even if the contact is "deleted", as these details determine aspects of the rematches. "Deleting" a contact simply makes it not appear in the contact list, and the contact is unable to call the player or count down to a rematch (although a contact already set up for a rematch can still be fought).
|1||Trainer type|| The trainer type of the contact (e.g. 14, |
Remember that all trainer contacts must have an associated defined trainer, even if that trainer is never battled.
In the contact list, this is the first part of the displayed name, e.g. the "Camper" in "Camper Andrew".
|2||Trainer name|| The name of the contact.
Remember that all trainer contacts must have an associated defined trainer, even if that trainer is never battled. However, such a situation is unlikely to ever occur.
In the contact list, this is the second part of the displayed name, e.g. the "Andrew" in "Camper Andrew".
|3||Time to next battle|| When the trainer is registered, and each time the player defeats them in a rematch, this value is set to |
This value will hit 0 between 8m 20s and 16m 40s after the trainer was last defeated (not including time spent displaying messages, etc.).
|4||Can battle|| This is one of the following values:
This value is reset to 0 after the player defeats the trainer and then to 1 once its "Time to next battle" (above) has been set to a value. It is set to 2 when the "Time to next battle" hits zero. It is changed from 2 to 3 after the contact calls the player to tell them they are ready for a rematch.
If this value is 2, when the contact calls the player (or vice versa), they will tell the player they are ready for a rematch. If this value is 3, when the contact calls the player (or vice versa), there is only a 50% chance they will remind the player they are ready for a rematch - the other 50% of the time they will say the usual random dialogue.
Note that the contact does not need to have called the player before they can be rebattled, as the rematch is set up as soon as its "Time to next battle" hits zero.
|5||Next battle's trainer version|| This number is the version of the trainer that the player will battle next (0 is the original battle, 1 is the first rematch, etc.). This is increased by 1 after each time the player defeats the trainer.
This value cannot be increased beyond a maximum number, which is the number of "
|6||Map ID|| The ID of the map the event is on. If this is defined, then the contact's location (the name of the map with this ID) is displayed in the phone screen.
If the player is on the same map as the contact, or are both in different regions, they cannot call or be called by that contact.
|7||Event ID|| The ID of the trainer's event on the map mentioned above.
If this is defined along with the map ID, and if the "Is visible" value is TRUE, then their event's Self Switches will be altered to allow rematches when they become available. This value has no other effect.
For non-trainer contacts ("special" contacts):
|0||Is visible||This is either TRUE or FALSE. If this is TRUE, then the contact is displayed in the phone list (so the player can call them).|
|1||Identifying number||A number unique to each contact. It is used to determine which charset to show in the contact list, and which Common Event contains the phone messages for this contact.|
|2||Display name||The full display name of the contact (e.g. "Professor Oak").|
|3||Map ID|| The ID of the map corresponding to this contact. It is only used to show the contact's location in the contact list.
The contact can always be called regardless of location, and you may want to add in appropriate messages to the contact's Common Event depending on the player's location (i.e. the NPC telling the player to just go up and talk to them instead of calling them).
When the player receives a phone call from a trainer, it is from a randomly-chosen trainer out of all the ones that can call the player. Possible callers are those that are on a different map to the one the player is currently on, but are in the same region as the player.
The time between successive received phone calls (
$PokemonGlobal.phoneTime) is set to a random amount of time between 20 and 40 minutes, and is counted down except when messages are being displayed or the player is being forced to move by a move route. When this time hits 0, a call from a trainer will be generated.
- The phone doesn't necessarily need to be a Pokégear app. You can just as easily make a phone item.
- Let the player turn their phone on and off, thus allowing or forbidding trainers to call them.
- You could forbid random calls from trainers at certain times, e.g. plot-intensive parts of the game.
- Let the player delete contacts from the phone. The majority of the code required to allow this already exists.
- You could create a text message system that is also usable by the phone (or the Pokégear). At a very basic level, this would work something like Mail items.