• 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

Whenever on route, I get a crash randomly.

Here is the error log.

[2022-08-07 04:15:16 -0400]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.2]

Exception: ArgumentError
Message: wrong number of arguments (given 7, expected 2..4)

Backtrace:
[Essentials Deluxe] Species Files.rb:89:in `check_graphic_file'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:689:in `ow_sprite_filename'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:588:in `spawnPokeEvent'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:475:in `pbPlaceEncounter'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:379:in `pbSpawnOnStepTaken'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:342:in `pbOnStepTaken'
047:Game_Player:544:in `update_event_triggering'
047:Game_Player:439:in `update'
032:Scene_Map:161:in `block in update'
032:Scene_Map:159:in `loop'

Note sure what's going on here. It says given 7 but is expecting 2..4.

Hey! :)
I'm sorry to quote you but i tried the new version of "Essentials Deluxe 1.0.2" and "Visible Overworld Wild Encounters V20" but that sadly dosent work.
I got the same message as above mentioned, i also tried both plugins (+hotfix) in a new essentials folder but the error returns.

Have a nice day :)

Yeah ill look into it again when im home.

The Essentials Deluxe plugin overwrites the method
Code:
check_graphic_file(path, species, form = 0, gender = 0, shiny = false, shadow = false, subfolder = "")
of Maruno's current Pokemon Essentials Version on Github and replaces it by
Code:
check_graphic_file(path, params, subfolder = "", dmax_folder = "")

Unfortunately, the visible overworld wild encounters script uses maruno's original version of that method (so that means including gender shiny etc, thus 7 parameters).
So, I would recommand to modify the update for the method in such a way that it still supports the original parameters.

@Lucidious89, if you want to combine all parameters (i.e. species, form, gender, shiny and shadow) in one parameter and also still have the old compatibility, then you should include something like the following in your method-update
Code:
check_graphic_file(path, params, param_1 = "", param_2 = "", param_3 = false, param_4 = false, param_5 = "", param_6 = "")
  if params is an array
    species = params[0]
    ...
    shadow = params[4]
    subfolder = param_1
    dmax_folder = param_2
  else
    species = params
    if param_1 = ""
      param_1 = 0
    else
      form = param_1
    end
    if param_2 = ""
      param_2 = 0
    else
      form = param_2
    end
    shiny = param_3
    shadow = param_4
    subfolder = param_5
    dmax_folder = param_6
  end
  ...
end

Edited missspelling
 
Last edited:
That's too messy and confusing. Im probably just gonna rewrite the part of your plugin that calls for that line of code and stick it in mine with the new formatting so that it loads with that instead.
 
That's too messy and confusing. Im probably just gonna rewrite the part of your plugin that calls for that line of code and stick it in mine with the new formatting so that it loads with that instead.

The method of the visible overworld wild encounter script, you have to overwrite then, is ow_sprite_filename.
But hat's not a good idea to overwrite it since other modifications of the visible overworld wild encounter plugin (such a "Ditto transform", "Overworld Lavender Town Ghosts" and other add-ons) are designed in such a way that these add-ons also already overwrite that method, always using Maruno's original check_graphic_file method with 7 parameters.

It's better to include a compatibility in check_graphic_file for Maruno's original parameters and for your style. Maruno also did this for the old and new parameter styles of Pokemon Essentials battling methods, and so you should do for check_graphic_file. Otherwise, your Essentials Deluxe Plugin becomes incompatible to every default check_graphic_file using script. I think your Essentials Deluxe Plugin is to good and to valuable for the community to have such a source for incompatibility.
 
Bit of help please, im getting this error when I move to a different, connected map, but there are overlworld pokemon in the old map:

[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.3]

Exception: ArgumentError
Message: Actually, this should not be possible

Backtrace:
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:873:in `removeThisEventfromMap'
[Additional Despawn Methods - Overworld Encounters Add On] 005_add_on_additional_despawn_methods.rb:75:in `update'
042:Game_Map:431:in `block in update'
042:Game_Map:430:in `each_value'
042:Game_Map:430:in `update'
032:Scene_Map:131:in `block in updateMaps'
032:Scene_Map:130:in `each'
032:Scene_Map:130:in `updateMaps'
032:Scene_Map:162:in `block in update'
032:Scene_Map:159:in `loop'
 
Bit of help please, im getting this error when I move to a different, connected map, but there are overlworld pokemon in the old map:

[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.3]

Exception: ArgumentError
Message: Actually, this should not be possible

Backtrace:
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:873:in `removeThisEventfromMap'
[Additional Despawn Methods - Overworld Encounters Add On] 005_add_on_additional_despawn_methods.rb:75:in `update'
042:Game_Map:431:in `block in update'
042:Game_Map:430:in `each_value'
042:Game_Map:430:in `update'
032:Scene_Map:131:in `block in updateMaps'
032:Scene_Map:130:in `each'
032:Scene_Map:130:in `updateMaps'
032:Scene_Map:162:in `block in update'
032:Scene_Map:159:in `loop'

Thank you for reporting the bug.
Can you please specify which settings you use in the add-on "Additional Despawn Methods"; Because I want to test it with your settings.
 
The only setting I have different from the defaults are REMOVE_DISTANCED = true, everything else stays as default.
 
Bit of help please, im getting this error when I move to a different, connected map, but there are overlworld pokemon in the old map:

[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.3]

Exception: ArgumentError
Message: Actually, this should not be possible

Backtrace:
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:873:in `removeThisEventfromMap'
[Additional Despawn Methods - Overworld Encounters Add On] 005_add_on_additional_despawn_methods.rb:75:in `update'
[...]

The only setting I have different from the defaults are REMOVE_DISTANCED = true, everything else stays as default.

I could reproduce your error and updated the visible overworld wild encounters script to version 20.0.0.2. The error did not happen anymore while testing in the new version. Please download and install the new version 20.0.0.2 on github, and let me know if the error still occures.

For your interest, I noticed that the map factory changed from $MapFactory to $map_factory in PEv20, which I did not change in the visible overworld wild encounters script before.
 
So far I haven't re-encountered the error anymore.
Thank you so much! I was worried about the nightmare that surf maps were going to be
 
Is there any way to make this plugin work with the weather encounters: (broken link removed) ? Just curious if someone has been able to make the two work well together.
 
Is there any way to make this plugin work with the weather encounters: (broken link removed) ? Just curious if someone has been able to make the two work well together.

Have you ever tried to simply include both plugins to your project? Did you get any error messages?
 
Last edited:
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.
 
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.

Okay, I understand. To make both work on the same map, add this to the bottom of your visible overworld wild encounters script.
Code:
class PokemonEncounters  
  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)
        # Weather encounters are here
        ret = find_valid_encounter_type_for_time(:Storm, time) if $game_screen.weather_type == :Storm && !ret
        ret = find_valid_encounter_type_for_time(:HeavyRain, time) if ($game_screen.weather_type == :HeavyRain || $game_screen.weather_type == :Storm) && !ret
        ret = find_valid_encounter_type_for_time(:Rain, time) if ($game_screen.weather_type == :Rain || $game_screen.weather_type == :HeavyRain || $game_screen.weather_type == :Storm) && !ret
        ret = find_valid_encounter_type_for_time(:Blizzard, time) if $game_screen.weather_type == :Blizzard && !ret
        ret = find_valid_encounter_type_for_time(:Snow, time) if ($game_screen.weather_type == :Snow || $game_screen.weather_type == :Blizzard) && !ret
        ret = find_valid_encounter_type_for_time(:Sandstorm, time) if $game_screen.weather_type == :Sandstorm && !ret
        ret = find_valid_encounter_type_for_time(:Sun, time) if $game_screen.weather_type == :Sun && !ret
        ret = find_valid_encounter_type_for_time(:Fog, time) if $game_screen.weather_type == :Fog && !ret
        # Back to normal encounters
        ret = find_valid_encounter_type_for_time(:Land, time) if !ret
      end
      if !ret && has_cave_encounters?
        ret = find_valid_encounter_type_for_time(:Cave, time)
      end
    end
    return ret
  end
end
Code edited.
 
Last edited:
Alright, so I added this right after the "EventHandlers.add(:on_wild_pokemon_created_for_spawning," paragraph at the very end of the document, however, the weather encounters are still not appearing on the map. Is there anything else I need to do?
 
Alright, so I added this right after the "EventHandlers.add(:on_wild_pokemon_created_for_spawning," paragraph at the very end of the document, however, the weather encounters are still not appearing on the map. Is there anything else I need to do?

Installation:
  1. Install both plugins, i.e. "visible overworld wild encounters" and "weather encounters"
  2. Set your weather encounters on the map
  3. Place the following code at the very end of the "visible overworld wild encounters" script. (As you said after the "EventHandlers.add(:on_wild_pokemon_created_for_spawning, [...] })" paragraph. And note, that I changed the code compared to the the previous version.
    Code:
    class PokemonEncounters  
      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)
            # Weather encounters are here
            ret = find_valid_encounter_type_for_time(:Storm, time) if $game_screen.weather_type == :Storm && !ret
            ret = find_valid_encounter_type_for_time(:HeavyRain, time) if ($game_screen.weather_type == :HeavyRain || $game_screen.weather_type == :Storm) && !ret
            ret = find_valid_encounter_type_for_time(:Rain, time) if ($game_screen.weather_type == :Rain || $game_screen.weather_type == :HeavyRain || $game_screen.weather_type == :Storm) && !ret
            ret = find_valid_encounter_type_for_time(:Blizzard, time) if $game_screen.weather_type == :Blizzard && !ret
            ret = find_valid_encounter_type_for_time(:Snow, time) if ($game_screen.weather_type == :Snow || $game_screen.weather_type == :Blizzard) && !ret
            ret = find_valid_encounter_type_for_time(:Sandstorm, time) if $game_screen.weather_type == :Sandstorm && !ret
            ret = find_valid_encounter_type_for_time(:Sun, time) if $game_screen.weather_type == :Sun && !ret
            ret = find_valid_encounter_type_for_time(:Fog, time) if $game_screen.weather_type == :Fog && !ret
            # Back to normal encounters
            ret = find_valid_encounter_type_for_time(:Land, time) if !ret
          end
          if !ret && has_cave_encounters?
            ret = find_valid_encounter_type_for_time(:Cave, time)
          end
        end
        return ret
      end
    end

I haven't tested it. Let me know if it works.
Do you use the visible overworld wild encounters Add-On "different encounters for overworld spawning and original encountering on the same map"?
 
Last edited:
I did include different encounters for overworld spawning and original encountering on the same map. Should I remove that?
 
I did include different encounters for overworld spawning and original encountering on the same map. Should I remove that?

This changes everything. Indeed, this add-on overwrites everything about spawning weather encounters. Now, do the following to have different overworld and normal weather encounters:
  1. Install the weather encounter plugin to your project, if not already done
  2. Install the visible overworld wild encounters plugin, if not already done
  3. Install the "different encounters for overworld spawning and original encountering on the same map" Add-On
  4. Remove the additional code you might have added to the bottom of the your visible overworld wild encounters script because of previously instructions
  5. Copy the code in the following spoiler section to the bottom of your file "03_add_on_different_spawn_and_normal_encounters.rb" in the Add-On folder
    Spoiler:
  6. Add weather encounters to your encounters.txt pbs file as described in the instructions of the weather plugin. Add overworld encounters to your encounters.txt as described in the overworld encounters add-on. And similarly, add overworld weather encounters to your encounters.txt file, such as OverworldFog.
I haven't tested it. Let me know if everything works simultanously.
 
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.

Do the following
  1. Replace the code in the randomizer file "add_on_randomized_spawning.rb" in the plugins folder by the code below
  2. Set RANDOMIZE_BLACK_LIST, SPAWN_WHITE_LIST and SPAWN_BLACK_LIST in the settings section of the randomized spawning add-on as you want. You find descriptions in the settings section
Code:
#======================================================
#           Randomized Spawning v1.2 by derFischae
#======================================================
# This is an Add-On for the visible overworld wild encounters script. It will randomize overworld encounters.
#
# Copy the folder of this plugin in your plugins folder.

module VisibleEncounterSettings
  # the following overworld spawning pokemon will not be randomized into other ones
  RANDOMIZE_BLACK_LIST = [:MEW]

  # spawning pokemon will only be randomized into one of the following pokemon (leave blank if you allow every pokemon)
  SPAWN_WHITE_LIST = [] # default [] means all pokemon are allowed
  
  # Additionally,  forbid that spawning pokemon will be randomized into one of the following pokemon 
  SPAWN_BLACK_LIST = [:MEW]

  SPAWN_LIST = (VisibleEncounterSettings::SPAWN_WHITE_LIST.size == 0) ? GameData::Species.keys : VisibleEncounterSettings::SPAWN_WHITE_LIST
  for key in VisibleEncounterSettings::SPAWN_BLACK_LIST
    SPAWN_LIST.delete(key)
  end
end

EventHandlers.add(:on_wild_pokemon_created_for_spawning, :randomized_spawn,
  proc { |pkmn|
    next if VisibleEncounterSettings::SPAWN_LIST.size == 0
    next if VisibleEncounterSettings::RANDOMIZE_BLACK_LIST.include?(pkmn.species)
    k = rand(VisibleEncounterSettings::SPAWN_LIST.size)
    pkmn.species = VisibleEncounterSettings::SPAWN_LIST[k]
  }
)
 
Last edited:
For me the pokemon show up, but the animation for aggressive pokemon does not show up. And the animation that shows when a pokemon is shiny does show up, but the overworld sprite and the pokemon encounter are not shiny. Did I miss something? Generally it works though..
 
For me the pokemon show up, but the animation for aggressive pokemon does not show up. And the animation that shows when a pokemon is shiny does show up, but the overworld sprite and the pokemon encounter are not shiny. Did I miss something? Generally it works though..

The plan to include the animation for aggressive encounters is:
1) Add the "Visible Overworld Wild Encounters" plugin to your project.
2) Add the "Aggressive Encounters" Add-On to your project.
3) Optional: Add the "Additional Animations" Add-On to your project.
4) Add the animation package from https://www.pokecommunity.com/posts/10395100/ to your project. Read the instructions therein carefully to omit errors and crashes.
5) Find the number of the aggressive animation in your animations database. It should be number 11 if you haven't edited anything.
6) Open the file "001_add_on_aggressive_encounters.rb" in your plugin folder and go to the line
Code:
AGG_ANIMATIONS = [7, nil, nil] # default [7, nil, nil]
Here, the number 7 is the number of the animation in the database that shall trigger then a pokemon becomes aggressive. In your project the shiny animation is stored as number 7. So
7) Replace the number 7 in that line by the number of your aggressive animation in the database (so usually 11).

I hope this works.
 
Back
Top