Essentials Docs Wiki

The Essentials wiki has moved and is now at: Essentials Engine wiki

This wiki will no longer be updated.

READ MORE

Essentials Docs Wiki
Advertisement
For how an encounter method is defined and used, see Adding new encounter methods.
For wild Pokémon that are encountered in fixed locations, see Event encounters.
For specific Pokémon that roam between maps, see Roaming Pokémon.
For encountering Pokémon while fishing, see Fishing encounters.
For wild encounters caused by Rock Smash or Headbutt, see Obstacles.

This page 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[]

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 and optionally a version number. For example:

[002] # Lappet Town
Water,2
    60,TENTACOOL,14,19
    30,MANTYKE,15,16
    10,REMORAID,14,16
OldRod
    100,MAGIKARP,16,19
GoodRod
    60,BARBOACH,17,18
    20,KRABBY,15,16
    20,SHELLDER,16,19
SuperRod
    40,CHINCHOU,17,19
    40,QWILFISH,16,19
    15,CORSOLA,15,18
    5,STARYU,15,17
#-------------------------------
[005] # Route 1
Land,21
    40,PIDGEY,11,14
    40,RATTATA,11,14
    9,PIDGEY,11,13
    9,RATTATA,11,13
    1,PIDGEY,14
    1,RATTATA,14
LandNight,21
    39,RATTATA,10,14
    30,HOOTHOOT,10,13
    20,SPINARAK,8,12
    9,HOOTHOOT,10,14
    1,HOOTHOOT,14
    1,RATTATA,15
#-------------------------------
[005,1] # Route 1
Land,21
    40,PIDGEY,15,18
    40,RATTATA,14,18
    10,SENTRET,13,17
    5,PIDGEY,14,16
    5,RATTATA,13,16
LandNight,21
    40,RATTATA,14,18
    30,HOOTHOOT,14,17
    20,SPINARAK,12,16
    10,CLEFAIRY,11,15
#-------------------------------
[050] # Rock Cave
Cave,5
    20,MAGNETON,14,16
    20,MAGNETON,14,17
    20,NOSEPASS,14,15
    20,NOSEPASS,13,14
    10,BURMY,14,16
    10,GEODUDE,13,15

Anything after a "#" in a line is a comment and is ignored by the game. The comments are only there to make the file clearer. Similarly, some lines are indented, but this is just cosmetic and has no effect on the game; the indents are also only there to make the file easier to read.

Map 005 (Route 1) in the example above has two versions of its encounter table, with sections named [005] and [005,1]. See below for more information on encounter versions.

In a map's section are one or more sets of wild encounters. Each set is for a different encounter type. Each set is written out as follows:

Line Description
Encounter type (and probability) This line begins with an encounter type. The possible encounter types are defined in the script section EncounterType, and are:

The names of the encounter types should be fairly self-explanatory. When generating a wild encounter, the "Land", "Cave" and "Water" ones will first try the encounter type listed last in their row and then work backwards (skipping ones that don't match the current time of day) until it finds defined encounters of that encounter type for the current map. "BugContest" works like "Land" but only during a Bug Catching Contest.

Most of these encounter types also require a probability number after the encounter type (separated by a comma from the encounter type). For the "Land", "Cave" and "Water" ones and "BugContest", this number is the percentage chance of an encounter of that type happening with each step. For "RockSmash", this is the percentage chance of an encounter of that type happening when Rock Smash is used to break a rock. The other encounter types do not need a probability, as the chances of their encounters happening are determined elsewhere in the scripts.

Encounter slot Each encounter type can have any number of encounter slots. Each slot is for a particular species of Pokémon that can be encountered via that encounter type. An encounter slot's line is three or four comma-separated elements as follows:
  1. An encounter chance
  2. A Pokémon species
  3. A level
  4. (Optional) A second level higher than the first level

If the second level is defined, the two numbers define a range of levels (inclusive) that the species can be found at. Each level in that range has an equal chance of being chosen.

The encounter chance is the relative chance of that encounter slot being chosen for a wild encounter instead of any other slot for the same encounter type. The encounter chances for all slots for an encounter type do not have to add up to 100, but if they did, a slot's chance would end up being a percentage which you may find easier to work with.

The Pokémon species (e.g. "UNOWN") may instead be a specific form of a species (e.g. "UNOWN_12").

Note that multiple encounter slots for a given encounter type can contain the same species of Pokémon. You can use this to make some levels of a species more or less likely than other levels (e.g. making Pidgey commonly level 2-4, but rarely level 5).

Encounter versions[]

Map 005 (Route 1) in the example above has two versions of its encounter table, with sections named [005] and [005,1]. If a version number is not given, it is treated as 0.

The value of $PokemonGlobal.encounter_version determines which encounter table versions are used. By default, this is 0, but it can be changed during a game. The game will first try to use the encounter table for a map whose version number is the same as $PokemonGlobal.encounter_version. If that map does not have an encounter table for that version number, the game will instead use the default encounter table for that map (i.e. version number of 0/not written).

Double wild battles[]

Main article: Partner trainer

All wild Pokémon battles will be single battles. However, if the player has a partner trainer, all wild Pokémon battles will be double battles instead. Additionally, if the encounter is on a tile with terrain tag 10 (TallGrass), all wild Pokémon battles have a 30% chance of being double 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).

Modifying wild Pokémon[]

Main article: Editing a Pokémon

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 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, decide on one or more conditions under which a Pokémon should have its attribute(s) altered. In this example, the condition is Game Switch 42 being ON, but it could instead be the map ID, the weather, the terrain tag of the tile you're standing on, the number of Gym Badges the player has, or even an attribute of the Pokémon being encountered (such as its species or gender). There are many more possible conditions. Make sure your conditions apply only when you want them to.

Secondly, look in the script section Overworld_EncounterModifiers. In there are a couple of examples of the code below. You may choose to add your own copies of this code into this script section, or into a new script section to keep better track of your edits.

The basic code is as follows:

EventHandlers.add(:on_wild_pokemon_created, :learn_hidden_power,
  proc { |pkmn|
    pkmn.pbLearnMove(:HIDDENPOWER) if $game_switches[42]
  }
)

This example will cause all wild Pokémon to know the move Hidden Power, as long as Game Switch 42 is ON when the encounter occurs.

Advertisement