Wild Encounters

This article describes **wild Pokémon encounters**. This includes how to set up random encounters (e.g. long grass, caves), and how to modify encounters based on various factors (e.g. location).

## Setting wild encounters for a map Edit

The PBS file "encounters.txt" lists all the wild Pokémon encounters for each map. Each map has its own section, which begins with that map's ID number. The section is laid out in the following order:

 2
 3
* **Land** - For long grass. Pokémon will appear only while walking in the grass.
* **LandDay** - Same as "Land", but for encounters between 6am and 8pm. If defined, overrides the "Land" encounter type during that time.
* **LandNight** - Same as "Land", but for encounters between 8pm and 6am. If defined, overrides the "Land" encounter type during that time.
* **LandMorning** - Same as "Land", but for encounters between 6am and noon. If defined, overrides the "Land" and "LandDay" encounter types during that time.
* **BugContest** - Same as "Land", but for when the player is in a Bug Catching Contest. If undefined, "Land" is used instead.
* **Cave** - For caves and other maps where wild encounters can occur anywhere, as long as the player is walking.
* **Water** - For surfing.
* **RockSmash** - For when the player smashes a breakable rock.
* **OldRod** - For when the player uses the Old Rod.
* **GoodRod** - For when the player uses the Good Rod.
* **SuperRod** - For when the player uses the Super Rod.
* **HeadbuttLow** - For when Headbutt is used on a tree. These Pokémon are rare to find in a Headbutt encounter.
 Pokémon to encounter
1. A Pokémon species.
2. A level.
3. A second level. Optional. Must be higher than the first level.

If the second level is defined, the two numbers define a range of levels that the species can be found at (inclusive). If that line is chosen for the wild encounter, then there is an equal chance of the wild Pokémon being any of those levels.
The position of a species within the list determines the rarity of that species (higher up means more common). The list must contain a specific number of lines, depending on the encounter type. See the table below for the encounter probabilities and list lengths for each encounter type.

There can be multiple encounter types and lists of Pokémon to encounter in a map's section. However, a map's section cannot have more than one of the same encounter type.

The "Cave" encounter type cannot be defined if one of "Land", "LandMorning", "LandDay", "LandNight" or "BugContest" is also defined.

Each encounter type must have a specific number of lines (entries). Each line in that list has a probability assigned to it, which states how likely it is for that line to be chosen to define an encounter. These probabilities are in relation to each other within the same encounter type, e.g. a line with a value of 20 is twice as likely to be chosen as a line with a value of 10.

The table below lists each encounter type, along with the number of lines and the probabilities of each line (in order) for each of those encounter types.

LandMorning
LandDay
LandNight
Cave
BugContest
 Water
RockSmash
 OldRod
 GoodRod
 SuperRod
 HeadbuttLow
HeadbuttHigh

These are the default values. The probabilities sum to 100 in each case, which means they can also be seen as percentages. They don't *have* to sum to 100, but the default ones do for convenience.

You can have the same species in several different lines in a defined encounter type. For example, putting Rattata in the first three lines of the "Land" encounter type means that there will be a 50% chance of encountering a Rattata: (20 + 20 + 10) / 100.

### Examples Edit

```
019
25,10,10
Land
SENTRET,12,15
PIDGEY,12,15
RATTATA,12
RATTATA,12
RATTATA,13
RATTATA,13
RATTATA,14
RATTATA,14
RATTATA,15
RATTATA,15
RATTATA,16
RATTATA,17

```

This example sets the encounters for map number 019. The probability of an encounter in tall grass is 2.5 times higher than an encounter while surfing or walking in a cave (although the cave probability is ignored here because this map has Land encounters and therefore cannot have Cave encounters). There is one encounter type (Land), and the listed Pokémon (Sentret, Pidgey and Rattata) can be encountered at the given levels. The chances of encountering a Pokémon are as follows:

* Sentret - 20%
* Pidgey - 20%
* Rattata - 60%

The chances of encountering a Pokémon at a given level are more complicated, as this chance includes not only the probability of choosing the line(s) naming that species, but also the probability of choosing a particular level in the ranges given. For example, there are four possible levels Sentret can have (12, 13, 14 or 15), and the 20% chance of choosing a Sentret for the encounter is divided evenly between each of these possible levels (i.e. 5% chance of encountering a level 12 Sentret).

These probabilities can easily become very complicated.

```
011
25,10,10

PIDGEY,16
PARAS,16
PARAS,16
RATTATA,17
RATTATA,18
PIDGEY,17
RATTATA,19
RATTATA,18
PIDGEY,19
RATTATA,18
PIDGEY,20
RATTATA,20

MAGIKARP,2
GOLDEEN,3
POLIWAG,3
FEEBAS,3
FEEBAS,3

MAGIKARP,2
GOLDEEN,3

MAGIKARP,2
GOLDEEN,3
POLIWAG,3

MAGIKARP,2
GOLDEEN,3
POLIWAG,3
FEEBAS,3
FEEBAS,3

```

This example shows how multiple encounter types are defined. The encounter types here are "Land", "Water", "OldRod", "GoodRod" and "SuperRod" (highlighted).

## Double wild battles Edit

*Main article: Partner trainer*
All wild Pokémon encounters will be single wild battles, unless the player has a partner trainer. If they do, then all wild Pokémon encounters will be double wild battles instead.

In a double wild battle, Poké Balls cannot be used if both wild Pokémon are active. They can only be used if exactly 1 wild Pokémon is active (i.e. the other has fainted).

After a double wild battle, all the player's party Pokémon will be fully healed (ostensibly by the partner).

## Modifying wild Pokémon Edit

It is possible to modify many attributes of a wild Pokémon (e.g. make it shiny, choose its gender, change its stats, moveset, etc.). See the article Editing a Pokémon for information on which attributes can be changed. The method described below is the best way of editing a wild Pokémon.

Firstly, define a Global Switch that will cause one of these modifications (e.g. making the Pokémon shiny). Then, in the script section **PokemonEncounterModifiers** (which exists specifically for this kind of code), enter something like the following:

```
  pokemon=e[0]
  if $game_switches[31]
    pokemon.makeShiny
  end
}

```

This example will cause all wild Pokémon to be shiny, as long as Global Switch 31 is ON when the encounter occurs. You can modify the cause and effects of these modifications however you want.

The factor that these modifications depend upon does not necessarily have to be a Global Switch. It can be almost anything you can think of: location, encounter type, weather, type of tile the player is standing on, a property of the Pokémon itself, etc. (e.g. you can have all fished Pokémonknow the move Aqua Jet, or all Unown in a certain map be a particular form).