• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script: Visible Overworld Wild Encounter

Can you add new types of overworld spawns?

I assume that you use Pokemon Essentials V19.1 and Visible Overworld Wild Encounters Plugin Version V19.1.0.3.

If you want to include overworld versions for the default encounter types then you can simply include the plugin "Different Spawn And Normal Encounters - Overworld Encounters Add On" to your project. You can find it at https://github.com/VisibleOverworldWildEncounters/Visible-Overworld-Wild-Encounters

If you want to include your own new custom encounter types (for instance "desert") then you have to do the following:
  1. At first, you have to add your custom encounter type as usual to your project. If you are not familiar with that then you find an explaination in the following spoiler section
    Spoiler:
  2. Overwrite the method encounter_type_on_tile of class PokemonEncounters in the Visible Overworld Wild Encounters Plugin to make overworld encountering work. Probably, encounter_type_on_tile needs to be something like this
    Code:
      def encounter_type_on_tile(x,y)
        time = pbGetTimeNow
        ret = nil
        if $game_map.terrain_tag(x,y).can_surf_freely
          ret = find_valid_encounter_type_for_time(:Water, time)
        else   # Land/Cave (can have both in the same map)
          if has_land_encounters? && $game_map.terrain_tag(x, y).land_wild_encounters
            ret = :BugContest if pbInBugContest? && has_encounter_type?(:BugContest)
            ret = find_valid_encounter_type_for_time(:Land, time) if !ret
          end
          # here the desert encounter is added ---
          if !ret && has_encounter_type?(:desert) && $game_map.terrain_tag($game_player.x, $game_player.y).battle_environment == :Desert
            ret = find_valid_encounter_type_for_time(:Desert, time)
          # --------------------------------------
          if !ret && has_cave_encounters?
            ret = find_valid_encounter_type_for_time(:Cave, time)
          end
        end
        return ret
      end

If you want new custom encounter types (such as "desert") where you have different pokemon for spawning and for instant battle then
  1. install the plugin "Different Spawn And Normal Encounters - Overworld Encounters Add On" from https://github.com/VisibleOverworldWildEncounters/Visible-Overworld-Wild-Encounters
  2. add your custom encounter types to your project as it is written in the spoiler section above.
  3. Add corresponding Overworld encounter types for all your custom encounter types. This might be something like this
    Code:
    GameData::EncounterType.register({
      :id             => :OverworldDesert,
      :type           => :desert, # or an already existing type such as :land or :cave if the encounter does not happen on a new area
      :trigger_chance => 21,
      :old_slots      => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1]
    })
    plus additional encounter types per time such as OverworldDesertDay, OverworldDesertNight, ...
  4. Overwrite the method encounter_type_on_tile of class PokemonEncounters in the "Different Spawn And Normal Encounters - Overworld Encounters Add On" plugin (and not in the "Visible Overworld Wild Encounters" Plugin) to make different overworld encountering work. Probably, encounter_type_on_tile needs to be something like this
    Code:
      def encounter_type_on_tile(x,y)
        time = pbGetTimeNow
        ret = nil
        if $game_map.terrain_tag(x,y).can_surf_freely
          ret = find_valid_encounter_type_for_time(:OverworldWater, time)
          ret = find_valid_encounter_type_for_time(:Water, time) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN
        else   # Land/Cave (can have both in the same map)
          if has_land_encounters? && $game_map.terrain_tag(x, y).land_wild_encounters
            ret = :OverworldBugContest if pbInBugContest? && has_encounter_type?(:OverworldBugContest)
            ret = :BugContest if pbInBugContest? && has_encounter_type?(:BugContest) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN
            ret = find_valid_encounter_type_for_time(:OverworldLand, time) if !ret
            ret = find_valid_encounter_type_for_time(:Land, time) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN
          end
          # here the desert encounter is added ---
          if !ret && has_encounter_type?(:desert) && $game_map.terrain_tag($game_player.x, $game_player.y).battle_environment == :Desert
            ret = find_valid_encounter_type_for_time(:OverworldDesert, time)
            ret = find_valid_encounter_type_for_time(:Desert, time) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN
          # --------------------------------------
          if !ret && has_cave_encounters?
            ret = find_valid_encounter_type_for_time(:OverworldCave, time)
            ret = find_valid_encounter_type_for_time(:Cave, time) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN
          end
        end
        return ret
      end
 
Last edited:
is there a way to possibly make it so that pokemon evolve when spawned in if they're a high enough level? i'm running this on 19.1 and havent found an operational way to implement this so far-
 
is there a way to possibly make it so that pokemon evolve when spawned in if they're a high enough level? i'm running this on 19.1 and havent found an operational way to implement this so far-

Try this [EDIT: Updated code for PEv20]
Code:
EventHandlers.add(:on_wild_pokemon_created_for_spawning, :evolve_high_leveled_spawning_pokemon, proc { |pkmn| 
  next if !pkmn || pkmn.egg?
  new_species = pkmn.check_evolution_on_level_up
  next if new_species.nil?
  # Evolve Pokémon if possible
  pkmn.species = new_species
  pkmn.calc_stats
  pkmn.ready_to_evolve = false
  # See and own evolved species
  moves_to_learn = []
  movelist = pkmn.getMoveList
  movelist.each do |i|
    next if i[0] != 0 && i[0] != pkmn.level   # 0 is "learn upon evolution"
    moves_to_learn.push(i[1])
  end
  # Learn moves upon evolution for evolved species
  moves_to_learn.each do |move|
    # Pokémon already knows the move
    next if pkmn.hasMove?(move)
    # Pokémon has space for the new move; just learn it
    if pkmn.numMoves < Pokemon::MAX_MOVES
      pkmn.learn_move(move)
      next
    end
    # Pokémon already knows the maximum number of moves; try to forget one to learn the new move
    forgetMove =  rand(Pokemon::MAX_MOVES) 
    pkmn.moves[forgetMove] = Pokemon::Move.new(move)   # Replaces current/total PP
  end
})

Simply copy and paste this code at the bottom of the visible overworld wild encounter script.

This code checks if the level of a spawning pokemon is high enough to start evolution and triggers it, without showing an evolution scene. So, the evolved pokemon will spawn. If you want to change this code more for your liking then I recommand to read the spoiler section about "instructions on how to make your own Add-On or to modify an already existing script to make it work with the visible overworld wild encounter script. This includes modifying a pokemon on spawning but not on battling again, by using the events OnStartBattle, OnWildPokemonCreate and OnWildPokemonCreateForSpawning" in the main post https://www.pokecommunity.com/posts/10472596

If you want that pokemon can evolve not only into there next evolution form but also in even higher forms, then use a loop around the block of code, i. e.
Code:
EventHandlers.add(:on_wild_pokemon_created_for_spawning, :evolve_high_leveled_spawning_pokemon, proc { |pkmn| 
  loop do
    next if !pkmn || pkmn.egg?
    new_species = pkmn.check_evolution_on_level_up
    break if new_species.nil?
    # Evolve Pokémon if possible
    pkmn.species = new_species
    pkmn.calc_stats
    pkmn.ready_to_evolve = false
    # See and own evolved species
    moves_to_learn = []
    movelist = pkmn.getMoveList
    movelist.each do |i|
      next if i[0] != 0 && i[0] != pkmn.level   # 0 is "learn upon evolution"
      moves_to_learn.push(i[1])
    end
    # Learn moves upon evolution for evolved species
    moves_to_learn.each do |move|
      # Pokémon already knows the move
      next if pkmn.hasMove?(move)
      # Pokémon has space for the new move; just learn it
      if pkmn.numMoves < Pokemon::MAX_MOVES
        pkmn.learn_move(move)
        next
      end
      # Pokémon already knows the maximum number of moves; try to forget one to learn the new move
      forgetMove =  rand(Pokemon::MAX_MOVES) 
      pkmn.moves[forgetMove] = Pokemon::Move.new(move)   # Replaces current/total PP
    end
  end
})
 
Last edited:
Does anyone else's spawning take a long time? It seems to take at least 20-30 seconds upon walking onto the route.

Also, it seems to make the map connections screen lag very bad. Not completely sure why.

Edit- One more thing! How can I make certain Pokemon appear only on water or sand?
 
Last edited:
Does anyone else's spawning take a long time? It seems to take at least 20-30 seconds upon walking onto the route.

Also, it seems to make the map connections screen lag very bad. Not completely sure why.

Edit- One more thing! How can I make certain Pokemon appear only on water or sand?

There are multiple settings in the overworld encounters script and add-ons that let you change the spawning rate. Moreover you can change the encounter chance for your maps as usual, see the Pokemon Essentials Manual for more details. And the spawning rate depends on how much grass is on your road. Clearly, less grass means less tiles a pokemon can spawn at.

What do you mean by "map connection screen"? And how did you open it, so I may reproduce your issue myself. Have you tried to remove this script and test it again and does the lag still remain? The lag my come from a different script.

You add water pokemon as usual, see the Pokemon Essentials Manual for more details.

If you want pokemon to spawn on specific tiles such as sand, then read the spoiler section
  • How to add your own new custom overworld encounter types (such as "desert")
in the Modifications section of the main post https://www.pokecommunity.com/posts/10472596/
 
I'm happy with the spawning rate for the maps, it's just that the initial spawn takes awhile.

I go through the debug menu to get the the map connections. I will try removing the script and see if it "fixes" it.

Also, thank you!!
 
I'm happy with the spawning rate for the maps, it's just that the initial spawn takes awhile.

As we all know, it is annoying to run into the next wild battle just a few steps after your last one.
That's why Pokemon Essentials implements an encounter chance that is low after a wild battle and increases each step. So, it might suppress 8 pokemons to spawn, before a new pokemon encounters.
This is totally fine for normal encounters. Unfortunately, this might result in your mentioned odd behaviour for spawning encounters, since the encounter chance will be reset after a battle and not after a pokemon has spawned.
So, it will take long for the first pokemon to spawn, and then it will be fast and gets even faster the more steps the game player makes, until the game player runs into a pokemon and triggers a battle.

How to stop this? There are multiple ways.

  • The easiest way is to reset the encounter chance back to zero every time a pokemon spawned.
    This can be archieved with the following code snipped (simply copy and paste it at the bottom of your visible overworld wild encounter script)
    Code:
    EventHandlers.add(:on_wild_pokemon_created_for_spawning, :reset_step_count,
      proc { |pkmn|
        $PokemonEncounters.reset_step_count
      }
    )
    With this solution, the spawning rate will be always similar to the spawning rate of the first pokemon. If this is to long for you, then you can increase the encounter rate in the classical encounter settings for your maps and encounter types as usual.
  • You can use TrankerGold's Add-On "Fixed Spawn Probability" for the Overworld Encounter Plugin. It gets rid of the variable encounter probability and sets a fixed one, which you can set yourself in the variable VISIBLE_ENCOUNTER_PROBABILITY the settings section in the code of that Add-On
    With this Add-On the spawning probability will be the same on every map and on every encounter type, whether it is grass, cave of water.
  • You can make our own encounter chance explicitly for spawning encounters, that increases by step (but maybe faster as the original encounter chance) and resets to zero when a pokemon spawns. This can be archieved by the "Own Minimum Spawn Chance - Overworld Encounters Add On", which can be found on github.
    With this code all pokemon, whether the first one or the later ones will have the same average spawning time.
    Moreover, you can set the variable MAX_ENCOUNTER_REDUCED = 0 in the plugin, then all pokemon will have the usual spawn probability as you set it for the maps and encounter types (default grass 21%, Cave 5%, water 2%) in your Pokemon Essentials project. I.e. the spawn probability is as high as it was previously for all pokemon except the first one.
    Setting this variable MAX_ENCOUNTER_REDUCED larger than zero will increase the average spawning time of all pokemon simultanously.

I would prefer the last way, where I set MAX_ENCOUNTER_REDUCED = 0 or MAX_ENCOUNTER_REDUCED = 1 or MAX_ENCOUNTER_REDUCED = 2 (and increase the default spawning chances in Pokemon Essentials, since 2% is pretty low for water encounters).
EDIT: Updated code for PEv20.

I go through the debug menu to get the the map connections. I will try removing the script and see if it "fixes" it.
Also, thank you!!

I also have checked the map connection screen. And indeed, the screen always needs quite a long time to start, whether with or without the visible overworld wild encounter screen. So, I would say that this lag does not come from the visible overworld wild encounters script. I would have been surprised too, if the lag would come from the script.
 
Last edited:
* Visible Overworld Wild Encounters Version 20.0.0.4 for PEv20 and PEv21 - by derFischae (Credits if used please) *

UPDATED TO VERSION 20.0.0.4 FOR POKEMON ESSENTIALS V20 and V21.

This script is for Pokémon Essentials v20, v20.1, v21 and v21.1 (for short PEv20 and PEv21).

As in Pokemon Let's go Pikachu/Eevee or Pokemon Shield and Sword wild encounters pop up on the overworld, they move around and you can start the battle with them simply by moving to the pokemon. Clearly, you also can omit the battle by circling around them.

FEATURES
  • Easy Install as Plugin
  • see the pokemon on the overworld before going into battle
  • no forced battling against overworld encounters
  • Supports individual sprites for shiny, female and alternative forms
  • plays the pokemon cry while spawning
  • Overworld pokemon will despawn after some steps
  • you can have instant wild battle and overworld spawning at the same time and set the propability of that in percentage
  • In caves, pokemon don't spawn on impassable Rock-Tiles, which have the Tile-ID 4
  • In water, pokemon won't spawn above other tiles, which made them stuck or walk on ground
  • See "advanced features" and "additional features by add-ons" below for more (e.g. additional animations...)

INSTALLATION
Installation as simple as it can be.
  1. Add Graphics: Either get the resources from Gen 8 Project (broken link removed)
    and install the "Graphics/Characters" folder in your game file system.
    Or you watch in the following spoiler section
    Spoiler:
  2. Add Script: Follow this link https://github.com/VisibleOverworldWildEncounters/V20 and copy the folder "Visible Overworld Wild Encounters - Script" to your "/plugins/" folder.
  3. [Optional] Change Settings: Open the script file in the folder and change the parameters in the settings section therein as you like. Details descriptions about the parameters can be found there as well.
  4. [optional] Install Add-Ons (the folders under "/optional/" in the github repository): There are a lot of Add-Ons and parameter settings for your personal optimal solution. So, Copy Add-Ons in your "/plugins/" folder and edit parameters in settings of that Add-Ons to your liking. Some Add-Ons are incompatible to each other and some Add-On and parameter combinations can produce lag, e.g. a high spawning rate without a spawning cap, or e.g. "NO_OF_CHOSEN_TILES=0" (or too high) when having other scripts like Pokemon Following. So, do not simply include all folders.
  5. Enjoy!

HERE IS THE LINK TO THE VISIBLE OVERWORLD WILD ENCOUNTER SCRIPT AND ADD-ONS
https://github.com/VisibleOverworldWildEncounters/V20

ADVANCED FEATURES
  • Set the size of the area around the player where pokemon can spawn
  • Choose whether encounters occure on all terrains or only on the terrain of the player
  • Allow or forbid water pokemon to spawn on border
  • Set movement of overworld pokemon depending on its properties
  • Choose whether you can battle water pokemon while not surfing or not
  • set steps a pokemon remains on map before despawning depending on pokemon properties
  • You can check during the events :on_wild_species_chosen, :on_wild_pokemon_created, :on_calling_wild_battle ... if you are battling a spawned pokemon with the global variable $PokemonGlobal.battlingSpawnedPokemon
  • You can check during the events :on_wild_species_chosen and :on_wild_pokemon_created if the pokemon is created for spawning on the map or created for a different reason with the Global variable $PokemonGlobal.creatingSpawningPokemon
  • If you want to add a procedure that modifies a pokemon only for spawning but not before battling then you can use the Event :on_wild_pokemon_created_for_spawning

ADDITIONAL FEATURES BY ADD-ONS
  • Additional Animations Add-On
    • manage different appear animations of overworld spawning encounters depending on encounter type and pokemon properties
    • Play animations while PokeEvent is visible on screen, such as a shiny animation
    • See also Animation Resource by TrankerGolD for aggressive encounters, water encounters, and shiny encounters https://www.pokecommunity.com/posts/10395100/
      Spoiler:
  • Aggressive Encounters Add-On
    • introduces aggressive encounters, which are pokemon that chase the player after spawning
    • aggressive encounters may only start to chase if the player comes them to close
    • set the move speed, move frequency and move type of aggressive pokemon
    • aggressive ecounters are restricted to player movements
    • add animations to aggressive encounters. See Additional Animations -Add On and TrankerGolD's animations for aggressive encounters
      at https://www.pokecommunity.com/posts/10395100/ to include spawning animations in your game
  • Different Spawn And Normal Encounters (like in Pokemon Sword/Shield) Add-On
    • Introduces Overworld Encounter Types you can set in your encounters.txt PBS-file.
    • This allows you to define different encounters for overworld spawning and instant battling on the same map.
  • Reroll Spawn Tile Add-On
    • stabilizes the probability of spawning on maps with low grass by choosing another tile if the previous random chosen one does not allow spawning
    • set the maximal number of tiles chosen for spawning in parameter NO_OF_CHOSEN_TILES
    • be careful, it might produce lag with other scripts
  • Restrict Movement Add-On
    • Overworld spawned Grass/Water/Sand/etc encounters move only on Grass/Water/Sand tiles and not leave there terrain
    • You can activate and deactivate the restriction by setting the parameter RESTRICT_MOVEMENT in the settings section of this add-on
  • Max Spawn Add-On
    • Define a maximal limit of spawned pokemon on the overworld at the same time.
    • After reaching that limit MAX_SPAWN no pokemon will spawn until another pokemon despawned.
  • Additional Despawn Methods Add-On
    • Choose to remove PokeEvent distanced on screen from the player with REMOVE_DISTANCED
    • The distance (steps) is edited in DISTANCE_VANISH and DISTANCE_VANISH_SHINY
    • Remove by time chronometer with REMOVE_PROLONGED
    • Use your own overworld spawn chance in VISIBLE_ENCOUNTER_PROBABILITY
  • Own Minimum Spawn Chance Add-On
    • The Spawn probability of the first encounter and later ones are similar.
    • Spawning does not interact with the encounter chance for normal encounters.
    • Increase the average spawning time of pokemon by setting MAX_ENCOUNTER_REDUCED larger than zero in the settings section of this script
  • Fixed Spawn Probability Add-On
    • Define your own overworld spawn chance in Percentage
    • Spawn chance becomes independent from the default PEv20 encounter chance calculator
  • Variable Spawn/Normal Encounter Proportion During Game Add-On
    • You can change the percentage between overworld spawning and normal encounters in story driven events during playthrough
    • You can get and change the current instant battle probability by using getInstantChance and setInstantChance(value) in an event on the map.
  • Automatic Spawning Add-On
    • Choose whether pokemon spawn automatically or only while moving the player
    • Set the speed of automatic spawning
  • Randomized Spawning Add-On
    • It will randomize overworld encounters
  • Ditto Transform Add-On
    • Like in Pokemon Go, transformable Pokemon such as Ditto get the overworld appearence of different species
    • Choose in settings if completely random, set by a list of candidates or set by the map encounters
  • Remove Poke Events on load/save/transfer Add-On
    • Remove overworld encounters on load/save and on map transfer
  • Overworld Lavender Town Ghosts Add-On
    • Shows ghost sprite for overworld encounters
    • full functionality when using additionally the original Lavender Town Ghosts Plugin https://www.pokecommunity.com/threads/lavender-town-ghosts-v18-1.441236/
    • You need to put a graphic, named "ghost.png", in your "/Graphics/Characters/" folder of your project. This graphic is not provided here, but maybe you can easily find some resource, for example search for "shiny missingNo [Ghost Form]".


MODIFICATIONS OF THIS SCRIPT
  • How to add your own new custom overworld encounter types (such as "desert")
    Spoiler:
  • instructions on how to make your own Add-On or to modify an already existing script to make it work with the visible overworld wild encounter script. This includes modifying a pokemon on spawning but not on battling again, by using the events :on_wild_species_chosen, :on_wild_pokemon_created, :on_calling_wild_battle and :on_wild_pokemon_created_for_spawning
    Spoiler:

HELP AND MORE

About Normal Encounters And Overworld Encounters
  • Umm... Do normal encounters still work? Like that still you can have wild encounters
    Spoiler: Answer
    Go to the settings section of the visible overworld wild encounter script. There, you have to set INSTANT_WILD_BATTLE_PROPABILITY larger than 0 and lower than 100, for example
    Code:
     INSTANT_WILD_BATTLE_PROPABILITY = 50
  • Anyway to make a special encounter table for ow spawns? Like I'm using both random and overworld, but what if i wanted to have only certain pokemon spawn overworld or certain pokemon spawn in grass like SW/SH
    Spoiler: Answer
    Install the add on "Different Spawn And Normal Encounters - Overworld Encounters Add On"
  • How does this work with roaming pokemon?
  • I would like to make an exception for the legendary Pokémon. I wish they would not appear in overworld mode but only in the grass. (I use this method because I have both type of wild encounter in my game. Normal encounter and overworlds encounter as you mentioned in INSTANT_WILD_BATTLE_PROPABILITY
    Spoiler: Answer
    Install the add on "Different Spawn And Normal Encounters - Overworld Encounters Add On" and uncomment and modify the method "pbRoamingMethodAllowed(roamer_method)" in that add-on as discribed therein. Also update the roamer-methods of your legendaries in the settings section of Pokemon Essentials.
  • Can you add new types of overworld spawns?
    Spoiler: Answer
    Read the spoiler section of "How to add your own new custom overworld encounter types (such as "desert")" in the modifications section.
  • How can I make certain Pokemon appear only on water or sand?
    Spoiler: Answer

    You add water pokemon as usual, see the Pokemon Essentials Manual for more details.
    If you want pokemon to spawn on specific tiles such as sand, then read the spoiler section "How to add your own new custom overworld encounter types (such as "desert")" in the Modifications section
About Good Spawning Rate
  • What's a good spawn rate for this code? I don't want too many Pokemon on the field, but I don't want it to take forever to spawn an individual Pokemon.
    Spoiler: Answer

    There are multiple settings in the overworld encounters script and add-ons that let you change the spawning rate. Moreover you can change the encounter chance for your maps as usual, see the Pokemon Essentials Manual for more details. And the spawning rate depends on how much grass is on your road. Clearly, less grass means less tiles a pokemon can spawn at.
  • Lynker said:
    Does anyone else's spawning take a long time? It seems to take at least 20-30 seconds upon walking onto the route.
    I'm happy with the spawning rate for the maps, it's just that the initial spawn takes awhile.
About Modifying Overworld Spawning Pokemon
  • How did you randomize it?!
    Spoiler: Answer
    Install the add on "Randomized Spawning - Overworld Encounters Add-On"
  • ChefBeenan said:
    Hello, I added your script to my plug-ins folder and then I added the randomizer add-on and noticed it spawned roamings aswell even in my first route, is their a way to disable roaming pokemon in the overworld, that way I can handpick them and make events for them later in my game instead of people catching them right away.
  • I want that all overworld pokemon are shiny.
    Spoiler: Answer
    Place the following code at the bottom of your visible overworld wild encounters script
    Code:
    EventHandlers.add(:on_wild_pokemon_created_for_spawning, :aggressive_pokemon_spawn, proc { |pkmn|
      pkmn.shiny = true
    })
  • I'm still confused how to activate the add on always shiny via event.
    Spoiler: Answer
    Read https://www.pokecommunity.com/posts/10435604/
    Note that the code snippets are for PEv19.1
  • Is there a way to possibly make it so that pokemon evolve when spawned in if they're a high enough level?
  • Mindbender said:
    Is there any way to make this plugin work with the weather encounters: (broken link removed) ?
    They run fine together, however they won't work on the same map. The best I can do is have some of the weather encounters appear as wild encounters and not as on map, and some encounter types, like caves, work bring in any weather encounters.
    Spoiler: Answer
    Read https://www.pokecommunity.com/posts/10544092/
    And if you use (or want to use) the visible overworld wild encounters Add-On "different encounters for overworld spawning and original encountering on the same map", then read https://www.pokecommunity.com/posts/10544925/
About Spawn Animations And Appearence
About Move Independent Spawning
  • is there a way to modify the script so that instead of working when the player makes a step, making this working based on time? For example calling the "step function" every second in time. It would look more realistic in my opinion, so that you can stand in the same spot and the Pokémon keep on spawning and despawning.
    Spoiler: Answer
    Install the add on "Automatic Spawning - Overworld Encounters Add On"
  • Is there is a way to set only Automatic Spawning,no extra spawning when moving?
    Spoiler: Answer
    Read https://www.pokecommunity.com/posts/10254999/
    Note that the code in the post is for PEv18, but you can probably find out how to translate it for PEv20.
About Restrict Spawning or Movement
To stop overworld spawning or normal encounters during runtime via events, install the add on
"Variable Spawn To Normal Encounter Proportion During Game - Overworld Encounters Add On"
  • is there a way to make the script adhere to a single map instead of just being global?
    Spoiler: Answer
    Let's say, you want to let the script work on no other map than the map with map id 12345678. Then add the following code snippet
    Code:
    alias map_pbBattleOrSpawnOnStepTaken pbBattleOrSpawnOnStepTaken
    def pbBattleOrSpawnOnStepTaken(repel_active)
      return false if $game_map.map_id!=12345678
      return map_pbBattleOrSpawnOnStepTaken(repel_active)
    end
    to the bottom of your visible overworld wild encounters script. Make sure that no other modifications or add-ons of the visible overworld wild encounters script, which you use, overwrite the method "pbBattleOrSpawnOnStepTaken".
  • Do you think there is any way to make it work only if a switch is activated? Perhaps in this way we can make special maps or items that allow you to see the Pokemon in the grass for a certain amount of time ...
    Spoiler: Answer
    Let's say, you want to let the script work only if the game switch 12345678 is on.
    Then add the following code snippet
    Code:
    alias map_pbBattleOrSpawnOnStepTaken pbBattleOrSpawnOnStepTaken
    def pbBattleOrSpawnOnStepTaken(repel_active)
      return false if $game_switches[12345678]==false
      return map_pbBattleOrSpawnOnStepTaken(repel_active)
    end
    to the bottom of your visible overworld wild encounters script. Make sure that no other modifications or add-ons of the visible overworld wild encounters script, which you use, overwrite the method "pbBattleOrSpawnOnStepTaken".
  • How do you keep the spawned overworld pokemon in the grass? They spawn there but they running everywhere
About Cave Enounters
  • cave encounters. From what I'm seeing, they can spawn on impassable tiles (such as the black tile used to surround maps)
  • Is there a way to make Pokémon to spawn only on passable tiles?
    Spoiler: Answer
    Place the following code snippet
    Code:
        #check if tile is passable
        for i in [2, 1, 0]
          tile_id = $game_map.data[x, y, i]
          terrain = $game_map.terrain_tags[tile_id]
          passage = $game_map.passages[tile_id]
          if terrain!=PBTerrain::Neutral
            if passage & 0x0f == 0x0f
              return false
            elsif $game_map.priorities[tile_id] == 0
              break
            end
          end
        end
    right between the two lines
    [code[
    return false if tile_terrain_tag.ice
    return true if has_cave_encounters? # i.e. this map is a cave
    [/code]
    in the method "encounter_possible_here_on_tile?(x,y)" in the visible overworld wild encounter script code ORIGINAL CODE FOR PEv20
    Note that this code snippet might be outdated, since it was originally written for PEv18.
About Overworld Pokemon And Cutscenes
  • I just ran into an issue as an aggressive encounter spawned just before I started an event cutscene. The player has forced movement in it and the encounter blocked the path. I have prevented this with "ignore if can't move", but the cutscene looks ugly with the encounter interfering. Is it possible to pause the overworld encounters until an event is over?
  • I've been trying to implement solutions for the cutscenes, but I've only managed to stop the spawn encounters until the scene is over, but the Pokemon that already appeared before are still hanging around. I read the post and the suggestion of game_temp.in_menu = true but I would like to know (if I missed it somewhere), is there any command to just make all the Pokemon that have appeared on the map at that moment disappear?
About Saving Overworld Pokemon
About Runtime Errors
  • Hi, I've found a weird stack overflow error after resetting with F12. It works normally on the first load up.
    The error points me to the top of Part 3's code, specifically the
    Code:
    if self.name=="vanishingEncounter" && @stepCount && @stepCount>=STEPSBEFOREVANISHING
    and the
    Code:
    original_increase_steps
    parts.
    Once in a while there is a problem:
    Spoiler:
    Spoiler: Answer
    Read https://www.pokecommunity.com/posts/10393908/ Maybe, you have to update the code for PEv20.

OUTDATED ADD-ONS AND MODIFICATIONS OF THIS SCRIPT
In the post https://www.pokecommunity.com/threads/visible-overworld-wild-encounter.429019/post-10203908 you will find add-ons and modifications of this script for PEv18
Moreover, there are various modifications of this script for PEv17.2. under https://www.pokecommunity.com/posts/10202528/
Probably these add-ons and modifications are not completely compatible to PEv20 and there are some bugs due to the update to PEv20. But feel free to test it with PEv20 and feel free to post your bugs.
The list of outdated add-ons and modifications include

CHANGELOG
Spoiler:
 
Last edited:
Try this
Code:
EventHandlers.add(:on_wild_pokemon_created_for_spawning, :evolve_high_leveled_spawning_pokemon,
  proc { |pkmn|
    newSpecies = pkmn.check_evolution_on_level_up
    next if !newSpecies
    # Modify Pokémon to make it evolved
    pkmn.species = newSpecies
    pkmn.form    = 0 if pkmn.isSpecies?(:MOTHIM)
    pkmn.calc_stats
    # Learn moves upon evolution for evolved species
    movelist = pkmn.getMoveList
    for i in movelist
      next if i[0]!=0 && i[0]!=pkmn.level   # 0 is "learn upon evolution"
      newMove = i[1]
      # Pokémon already knows the move
      return if pkmn.moves.any? { |m| m && m.id == newMove }
      # Pokémon has space for the new move; just learn it
      if pkmn.moves.length < Pokemon::MAX_MOVES
        pkmn.moves.push(Pokemon::Move.new(newMove))
        next
      end
      # Pokémon already knows the maximum number of moves; try to forget one to learn the new move
      forgetMove =  rand(Pokemon::MAX_MOVES) 
      pkmn.moves[forgetMove] = Pokemon::Move.new(newMove)   # Replaces current/total PP
    end
  }
)

Simply copy and paste this code at the bottom of the visible overworld wild encounter script.

This code checks if the level of a spawning pokemon is high enough to start evolution and triggers it, without showing an evolution scene. So, the evolved pokemon will spawn. If you want to change this code more for your liking then I recommand to read the spoiler section about "instructions on how to make your own Add-On or to modify an already existing script to make it work with the visible overworld wild encounter script. This includes modifying a pokemon on spawning but not on battling again, by using the events OnStartBattle, OnWildPokemonCreate and OnWildPokemonCreateForSpawning" in the main post https://www.pokecommunity.com/posts/10472596
EDIT: Updated code for PEv20.

By chance what did it look like in v19.1-
 
By chance what did it look like in v19.1-

It was

Code:
Events.onWildPokemonCreateForSpawning+=proc {|sender,e|
    pkmn = e[0]
    newSpecies = pkmn.check_evolution_on_level_up
    next if !newSpecies
    # Modify Pokémon to make it evolved
    pkmn.species = newSpecies
    pkmn.form    = 0 if pkmn.isSpecies?(:MOTHIM)
    pkmn.calc_stats
    # Learn moves upon evolution for evolved species
    movelist = pkmn.getMoveList
    for i in movelist
      next if i[0]!=0 && i[0]!=pkmn.level   # 0 is "learn upon evolution"
      newMove = i[1]
      # Pokémon already knows the move
      return if pkmn.moves.any? { |m| m && m.id == newMove }
      # Pokémon has space for the new move; just learn it
      if pkmn.moves.length < Pokemon::MAX_MOVES
        pkmn.moves.push(Pokemon::Move.new(newMove))
        next
      end
      # Pokémon already knows the maximum number of moves; try to forget one to learn the new move
      forgetMove =  rand(Pokemon::MAX_MOVES) 
      pkmn.moves[forgetMove] = Pokemon::Move.new(newMove)   # Replaces current/total PP
    end
}
 
It was

Code:
Events.onWildPokemonCreateForSpawning+=proc {|sender,e|
    pkmn = e[0]
    newSpecies = pkmn.check_evolution_on_level_up
    next if !newSpecies
    # Modify Pokémon to make it evolved
    pkmn.species = newSpecies
    pkmn.form    = 0 if pkmn.isSpecies?(:MOTHIM)
    pkmn.calc_stats
    # Learn moves upon evolution for evolved species
    movelist = pkmn.getMoveList
    for i in movelist
      next if i[0]!=0 && i[0]!=pkmn.level   # 0 is "learn upon evolution"
      newMove = i[1]
      # Pokémon already knows the move
      return if pkmn.moves.any? { |m| m && m.id == newMove }
      # Pokémon has space for the new move; just learn it
      if pkmn.moves.length < Pokemon::MAX_MOVES
        pkmn.moves.push(Pokemon::Move.new(newMove))
        next
      end
      # Pokémon already knows the maximum number of moves; try to forget one to learn the new move
      forgetMove =  rand(Pokemon::MAX_MOVES) 
      pkmn.moves[forgetMove] = Pokemon::Move.new(newMove)   # Replaces current/total PP
    end
}

TYSM AAAAAA

I tested it, works amazing. The only issue is that Pokémon like Lillipup will only evolve once in the case that it's high enough leveled to be a Stoutland; it'll just be a Herdier.

Also every once in a while I get this error that crashes my game:

[Pokémon Essentials version 19.1]
[Generation 8 Project v1.1.0]
[EBDX v1.2.3]

Exception: LocalJumpError
Message: unexpected return

Backtrace:
[Visible Overworld Wild Encounters] script.rb:1259:in `block (2 levels) in <main>'
[Visible Overworld Wild Encounters] script.rb:1255:in `each'
[Visible Overworld Wild Encounters] script.rb:1255:in `block in <main>'
035:Event_Handlers:53:in `block in trigger'
035:Event_Handlers:48:in `each'
035:Event_Handlers:48:in `trigger'
[Visible Overworld Wild Encounters] script.rb:436:in `pbSpawnOnStepTaken'
[Visible Overworld Wild Encounters] script.rb:396:in `pbOnStepTaken'
047:Game_Player:370:in `update_event_triggering'
047:Game_Player:324:in `update'

My line 1259 is this: return if pkmn.moves.any? { |m| m && m.id == newMove }

EDIT: Through trial and error I think I fixed it. I don't think Pokémon will learn their Evo-only moves with this, but now the code doesn't crash my game every once in a while and I'm pretty sure this code will work with or without the actual plugin.

Code:
Events.onWildPokemonCreate+=proc {|sender,e|
    pkmn = e[0]
    newSpecies = pkmn.check_evolution_on_level_up
    next if !newSpecies
    # Modify Pokémon to make it evolved
    pkmn.species = newSpecies
    pkmn.form    = 0 if pkmn.isSpecies?(:MOTHIM)
    pkmn.calc_stats
    pkmn.reset_moves
    newSpecies = pkmn.check_evolution_on_level_up
    next if !newSpecies
    # Modify Pokémon to make it evolved (in case the Pokemon has another evolution)
    pkmn.species = newSpecies
    pkmn.calc_stats
    pkmn.reset_moves
}
 
Last edited:
TYSM AAAAAA

I tested it, works amazing. The only issue is that Pokémon like Lillipup will only evolve once in the case that it's high enough leveled to be a Stoutland; it'll just be a Herdier.

Also every once in a while I get this error that crashes my game:

[Pokémon Essentials version 19.1]
[Generation 8 Project v1.1.0]
[EBDX v1.2.3]

Exception: LocalJumpError
Message: unexpected return

Backtrace:
[Visible Overworld Wild Encounters] script.rb:1259:in `block (2 levels) in <main>'
[Visible Overworld Wild Encounters] script.rb:1255:in `each'
[Visible Overworld Wild Encounters] script.rb:1255:in `block in <main>'
035:Event_Handlers:53:in `block in trigger'
035:Event_Handlers:48:in `each'
035:Event_Handlers:48:in `trigger'
[Visible Overworld Wild Encounters] script.rb:436:in `pbSpawnOnStepTaken'
[Visible Overworld Wild Encounters] script.rb:396:in `pbOnStepTaken'
047:Game_Player:370:in `update_event_triggering'
047:Game_Player:324:in `update'

My line 1259 is this: return if pkmn.moves.any? { |m| m && m.id == newMove }

EDIT: Through trial and error I think I fixed it. I don't think Pokémon will learn their Evo-only moves with this, but now the code doesn't crash my game every once in a while and I'm pretty sure this code will work with or without the actual plugin.

As you already noticed, the error comes from line 1259.
To fix this replace the line
Code:
    return if pkmn.moves.any? { |m| m && m.id == newMove }
by
Code:
    next if pkmn.moves.any? { |m| m && m.id == newMove }
This should solve the crashes. But your solution is very good as well.

Concerning higher evolutions, such as for Lillipup, Herdier and Stoutland:
To have multiple evolutions, you can simply place a loop around your block. Should look like this
Code:
Events.onWildPokemonCreate+=proc {|sender,e|
    pkmn = e[0]
    loop do
      newSpecies = pkmn.check_evolution_on_level_up
      break if !newSpecies
      # Modify Pokémon to make it evolved
      pkmn.species = newSpecies
      pkmn.form    = 0 if pkmn.isSpecies?(:MOTHIM)
      pkmn.calc_stats
      pkmn.reset_moves
      newSpecies = pkmn.check_evolution_on_level_up
      next if !newSpecies
      # Modify Pokémon to make it evolved (in case the Pokemon has another evolution)
      pkmn.species = newSpecies
      pkmn.calc_stats
      pkmn.reset_moves
    end
}
or you place a loop similarily around the other code (where the evolved pokemon can get there evolution-moves).
 
I've got an issue. I get an error when trying to use some plugins. The plugins I have are Additional Animations, Aggressive Encounters, Automatic Spawning, Ditto Transform and Max Spawn.

[Pokémon Essentials version 19.1]

Exception: NameError
Message: undefined local variable or method `def_arg' for PluginManager:Module

Backtrace:
008:PluginManager:263:in `block (2 levels) in register'
008:PluginManager:213:in `each'
008:PluginManager:213:in `block in register'
008:PluginManager:189:in `each'
008:PluginManager:189:in `register'
008:PluginManager:687:in `block in runPlugins'
008:PluginManager:683:in `each'
008:PluginManager:683:in `runPlugins'
373:Main:27:in `mainFunctionDebug'
373:Main:18:in `block in mainFunction'
 
Last edited:
I've got an issue. I get an error when trying to use some plugins. The plugins I have are Additional Animations, Aggressive Encounters, Automatic Spawning, Ditto Transform and Max Spawn.

[Pokémon Essentials version 19.1]

Exception: NameError
Message: undefined local variable or method `def_arg' for PluginManager:Module

Backtrace:
008:PluginManager:263:in `block (2 levels) in register'
008:PluginManager:213:in `each'
008:PluginManager:213:in `block in register'
008:PluginManager:189:in `each'
008:PluginManager:189:in `register'
008:PluginManager:687:in `block in runPlugins'
008:PluginManager:683:in `each'
008:PluginManager:683:in `runPlugins'
373:Main:27:in `mainFunctionDebug'
373:Main:18:in `block in mainFunction'

It seems that you do not have an error in one of your plugins, you have a misspelling in your Pokemon Essentials PluginManager Script File instead. To remove this, please open your script editor and go to the file "005_PluginManager". Then go to the 263th line in that file, it says
Code:
              case def_arg
and replace the code therein by
Code:
              case dep_arg
Then your error should be gone and your Pokemon Essentials version can register your plugins.
 
It seems that you do not have an error in one of your plugins, you have a misspelling in your Pokemon Essentials PluginManager Script File instead. To remove this, please open your script editor and go to the file "005_PluginManager". Then go to the 263th line in that file, it says
Code:
              case def_arg
and replace the code therein by
Code:
              case dep_arg
Then your error should be gone and your Pokemon Essentials version can register your plugins.

I now get this error. It happened when I stepped into the grass. What do I need to change this time?

[Pokémon Essentials version 19.1]

Exception: NameError
Message: uninitialized constant PBExperience

Backtrace:
371:Advanced Pokemon Level Balancing:64:in `block in <main>'
035:Event_Handlers:53:in `block in trigger'
035:Event_Handlers:48:in `each'
035:Event_Handlers:48:in `trigger'
231:Overworld_WildEncounters:409:in `pbGenerateWildPokemon'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:387:in `pbSpawnOnStepTaken'
[Max Spawn - Visible Overworld Wild Encounters Add On] 004_add_on_max_spawn.rb:30:in `pbSpawnOnStepTaken'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:353:in `pbOnStepTaken'
[Aggressive Encounters - Overworld Encounters Add On] 001_add_on_aggressive_encounters.rb:148:in `pbOnStepTaken'
047:Game_Player:370:in `update_event_triggering'
 
I now get this error. It happened when I stepped into the grass. What do I need to change this time?

[Pokémon Essentials version 19.1]

Exception: NameError
Message: uninitialized constant PBExperience

Backtrace:
371:Advanced Pokemon Level Balancing:64:in `block in <main>'
[...]

This error comes from the script "Advanced Pokemon Level Balancing". This script was written for Pokemon Essentials Version 17 by Joltik and it was updated for Pokemon Essentials version 18 by Phye. The corresponding thread is

https://www.pokecommunity.com/threads/409828

Unfortunately, Joltiks' "Advanced Pokemon Level Balancing" script seems not to be updated for Pokemon Essentials version 19, which you use. Thus your error message comes from that incompatibility.

So, the easiest way to remove the error is to remove the "Advanced Pokemon Level Balancing" script from your fan game. If you still want to use that script, then you have to update the script for Pokemon Essentials version 19 by your own. Maybe you can ask for help in the thread https://www.pokecommunity.com/threads/409828

Nevertheless, I want you to give you some instructions for updating.
Your error message says that the word "PBExperience" in line 64 of your "Advanced Pokemon Level Balancing" script causes the problem. I highlighted this in your error message above. Every error message works like that (compare the previous error message concerning "def_arg").

So the first step would be to find the new notation for that "PBExperience::MAXLEVEL". I would guess that it is "GameData::GrowthRate.max_level" now, but I'm not completely sure. And replace all code snippits by the new notation.

There will be even more that needs to be changed. For example all appearences of "MAXIMUMLEVEL" need to be replaced by "Settings::MAXIMUM_LEVEL". There to replace code will always be told by the error messages. Unfortunately, what to use to replace it can only be found by comparing Pokemon Essentials version 18 and 19.
 
Back
Top