Skip to content

Encounters

Wild creatures come from pbs/encounters.txt, in the PBS format. A section is a map ([001]) or a map and a version ([001,1]); under it, each way of meeting creatures names its table, the chance of a meeting on a step, and slots of chance,SPECIES,lowest level,highest level. From the sample:

[001] # the town and its field
Land,21
40,SPROUTAIL,2,4
30,BUDSHELL,2,4
20,GUSTREL,3,4
10,EMBERKIT,4
LandNight,21
60,BUDSHELL,2,4
39,GUSTREL,2,4
1,LULLAPIR,10
Water,2
100,RIPPLET,5,10

Land,21 is a 21 % chance of a meeting on each step of grass. The section’s numbers are tied to map folders by pbs/map_ids.toml (1 = "town"), because the PBS format numbers maps and PokeLoom names them. The game plays version 0 of each map’s tables today; choosing another version is planned (plan 25, Y13).

Where Table How
Tall grass Land A step onto a grass cell
A cave floor, a sandy waste Cave, else Land A step onto a cell marked on the map’s encounter layer in Tiled
Water Water A step while surfing
A cracked rock RockSmash The rock smash field move, when something is under it
A tree Headbutt, HeadbuttSecond, HeadbuttSpecial The talk button facing a tree of the map’s headbutt.toml
A rod OldRod, GoodRod, SuperRod A cast (below)

Grass needs no mark: its cell behaviour is enough. The encounter layer marks other ground where creatures live. See Maps.

A table’s name may add a condition, a part of the day and a day of the week, in that order: LandNight, LandSwarm, LandRadioANight, LandTuesday, LandNightSaturday.

  • Part of the day. Morning, Day, Afternoon, Evening, Night, by the game’s clock. Morning, afternoon and evening without a table of their own fall back to Day; any part falls back to the plain table.
  • Day of the week. On that day such a table comes before the plain ones.
  • Swarm. swarm town in a script puts the day’s swarm on a map; its Swarm tables replace the plain ones there. One map at a time, saved.
  • Radio. radio 1 or radio 2 switches every map to its RadioA or RadioB tables; radio 0 turns it off. The swarm comes first.

These are the conditional slots of the generation-4 remakes, kept as data so any game can use them (decision 244).

The trees are listed beside the map, in maps/<map>/headbutt.toml. The sample’s hill:

trees = [
{ cells = [[20, 19], [21, 19], [20, 20], [21, 20]] },
]

Facing one of a tree’s cells and pressing the talk button runs on headbutt, the map’s or else the shared file’s. An ordinary tree is rich, poor or empty by the player’s identifier and the tree’s place among the map’s trees, as in the remake; a tree marked special = true uses HeadbuttSpecial. The sample’s hook asks, then rolls:

on headbutt {
lock
if yesno("Something stirs up in this tree.\nGive it a shove?") {
closetext
shake 2, 16
wait 20
if encounter(headbutt) < 0 {
say "Needles fall. Nothing else."
}
}
release
}

encounter method rolls the map’s table once, as a step would, and fights what comes; -1 means nothing came.

A game fishes when game.toml has [world.fishing]. A rod is cast into the water the player faces, from the bag (an item of rods) or from a script (fish oldrod). The cast plays out in steps: the line goes out, a wait, the bite, a window to press A, and rounds to win before the creature is landed. Each step’s timing is a key, so each reference game’s numbers are data (decision 265). The sample’s weir keeper gives a reed rod that casts as the old rod:

[world.fishing]
rods = ["REEDROD", "", ""] # old, good, super
cast_sound = "splash"
cast_sound_at = 20
[007] # the weir pool behind the hill
OldRod,100
80,RIPPLET,5,8
20,BILLOWFIN,10,12

With bite = 0 (the default) the rod’s table’s rate decides whether anything bites. GoodRodNight and SuperRodSwarm tables work as the step tables do. The player’s fishing sheet is fish in graphics/sprites.toml. Every key is in the game.toml reference.

A fruit tree is an actor whose sheet’s rows are its looks, and two script calls on saved numbers: fruitstage (0 just picked to 4 ripe) and pickfruit. The craftsman who turns fruit into balls by the next day is craftorder, craftstate and craftcollect. The sample’s hill has a nut tree and a ball maker:

on talk fruit_tree {
lock
if pickfruit(NUT_TREE, EMBERNUT, 2) > 0 {
face fruit_tree, up
say "You picked two Ember Nuts."
} else {
say "The tree is bare. Nuts grow\nback on it overnight."
}
release
}

What the party’s first creature does to the wild roll, and how roaming creatures move, follow one game’s rules, chosen with wild in [rules]: "emerald", "platinum", "heartgold", "black2" or "modern" (the default). Each preset was read from its game’s code, with its quirks (decision 268).

  • The lead. Its ability changes how often creatures come, which ones (Static and Magnet Pull favour their types), their level, whether much weaker ones come at all, their nature and their gender. A held Cleanse Tag lowers the rate, and a Shiny Charm gives extra shiny draws under the rules that have it. Abilities are named by identifier; a game’s own abilities have no effect here.
  • Roamers. roamerstart slot, SPECIES, level sets a creature roaming from route to route (maps of kind = "route"), moving as the player changes maps. It runs after the first turn, keeps its health between meetings, and is saved. roamer(state, slot) and the other roamer questions read it; roamerend slot ends it. The region map marks each roamer’s route.

A repellent is an item with FieldEffect = Repel,100: weaker creatures stay away for 100 steps. It does not stop a meeting the player starts (a rod, a tree, encounter).

wildbattle LULLAPIR, 10 # one creature; the value is the outcome
wilddouble BUDSHELL, 6, GUSTREL, 6

The outcome is 0 lost, 1 won, 2 ran, 3 caught. Planned (plan 25, N9): options for a scripted battle such as no running away or no shiny.

Every wild creature, however it was met, passes through the on wildmon(method, map) editing hook before its battle. The hook can change any field or call the meeting off. A route where every creature is shiny, in that map’s file:

on wildmon(method, map) { pendset shiny, 1 }

See Scripts and events for what editing hooks may do.

  • Planned (plan 46): visible encounters, creatures that walk on the map and start a battle on contact, set per map with [wild.visible].
  • Planned (plan 46): encounter information: script questions about any map’s tables, a dex area page, a “here” screen of the current map’s creatures, and searching for a seen species with a chain.
  • Planned (plan 46): level scaling of wild creatures and trainers as a setting ([rules.scale]). Today the same is a few lines in an on wildmon or on trainerparty hook.
  • Planned (plan 25): the step roll’s parameters (rate scale, grace steps after a battle) as settings, so an import keeps its game’s pace.
  • Listed in plan 25 and not scheduled: shaking grass and chains, honey trees and hidden grottoes, wild doubles in dark grass.