Pokémon SDK Wiki

Release a roaming Pokémon

PSDK has a system allowing to encounter roaming Pokémon, this system relies on a proc that gives the information to where the Pokémon should be each time it's called.

Define the roaming Pokémon proc

All the roaming Pokémon proc are stored inside PFM::Wild_RoamingInfo::RoamingProcs. This constant is an Array associating a proc_id (Integer) to a Proc.

Here's an example :

PFM::Wild_RoamingInfo::RoamingProcs[proc_id] = proc do |infos|
    # The Pokemon will be in Grass
    infos.zone_type = 1
    # With terrain tag 0 (RMXP tileset)
    infos.tag = 0
    # We assign a random map
    maps = [25, 46, 35, 27]
    if (infos.map_id == $game_map.map_id && infos.spotted) || infos.map_id == -1
      infos.map_id = (maps - [infos.map_id]).sample
      infos.spotted = false

In the previous example, you should replace proc_id by a number, 5 for example.

The condition in this proc is split in two parts :

This condition can be customized, for example :

if infos.map_id != $game_map.map_id || infos.spotted || infos.map_id == -1
    infos.map_id = (maps - [infos.map_id]).sample
    infos.spotted = false

Will allow the roaming Pokémon to change map if the player isn't in the same map or if it has been encountered.

Release a roaming Pokémon

Write the following command in an event to release a roaming Pokémon :

$wild_battle.add_roaming_pokemon(chance, proc_id, pokemon_hash)

The paramaters are :

Example :

$wild_battle.add_roaming_pokemon(5, 0, id: 151, level: 20)

This command release a level 20 Mew with one out of 5 chance to encounter it in the map defined by the proc 0.