• 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

V21.1

After the first 2 images I removed the first 'do' (see below) but when I finally got it working it crashed, showing image 3.

Thank you for reporting the bug in Max Spawn Addon. I updated the code. It should work now. You can find the new version of the max spawn addon on the github repository.
 
How would you keep events spawned on Transfer or Save Load?

The behaviour of spawned pokemon is basically the same as for ordinary events placed in the map editor. More precisely, this means
  1. If you save your game, then the position of spawned pokemon will also be saved on the current map (as it is for ordinary events such as trainers).
  2. Moreover, if you move to directly adjoining map then all spawned pokemon are still active and moving as usual. You also can go back to them.
  3. And if you transfer to a map that is not adjoined (for example by using a teleporter or a door event, or simply moving to far away) and return right back then all events are back on there starting position (and for overworld encounters that means not yet spawned).
However, If you want that spawned pokemon always wait on the map till the player comes back (even in situation 3) then you can add the following code to the bottom of your 001_visible overworld wild encounters script.rb file in your plugins folder.

Ruby:
class Game_PokeEvent < Game_Event
  attr_accessor :event
end

class Game_Map
  attr_accessor :events
end

class Game_Temp
  attr_accessor :overworld_pokemon_data

  alias o_initialize initialize
  def initialize
    @overworld_pokemon_data = {}
    o_initialize
  end
end

#===============================================================================
# Checks when moving between maps
#===============================================================================
EventHandlers.add(:on_leave_map, :save_overworld_pokemon,
  proc { |new_map_id, new_map|
    $game_temp.overworld_pokemon_data = {} if !$game_temp.overworld_pokemon_data
    old_map_id = $game_map.map_id
    $game_temp.overworld_pokemon_data[old_map_id] = []
    if $game_map.events
      for event in $game_map.events do
        event = event[1]
        if event.is_a?(Game_PokeEvent)
          $game_temp.overworld_pokemon_data[old_map_id].push(event)
        end
      end
    end
  }
)

EventHandlers.add(:on_enter_map, :load_overworld_pokemon,
  proc { |old_map_id|   # previous map ID, is 0 if no map ID
    map_id = $game_map.map_id
    game_map = $game_map
    if $map_factory
      game_map = $map_factory.getMap(map_id)
    end
    if $game_temp.overworld_pokemon_data.has_key?(map_id)
      for event in $game_temp.overworld_pokemon_data[map_id] do
        key_id = event.id
        conflict = false
        next if game_map.events.has_key?(key_id)
        for placed_event in game_map.events.values do
          if placed_event.x ==event.x && placed_event.y == event.y
            conflict = true
            break
          end
        end
        next if conflict == true

        gameEvent = Game_PokeEvent.new(map_id, event.event, game_map)
        gameEvent.id = key_id
        gameEvent.moveto(event.x,event.y)
        gameEvent.pokemon = event.pokemon
        gameEvent.remaining_steps = event.remaining_steps

        game_map.events[key_id] = gameEvent
        sprite = Sprite_Character.new(Spriteset_Map.viewport,game_map.events[key_id])
        $scene.spritesets[map_id]=Spriteset_Map.new(game_map) if $scene.spritesets[map_id]==nil
        $scene.spritesets[map_id].character_sprites.push(sprite)
      end
    end
  }
)
 
Hello derFischae,

first of all, your plugins are absolutely amazing!
Some of the players of my game occasionally report me a "stack level too deep" error they run into, caused by the "Additional Animations" addon. Do you have an idea what could cause it? Is seems to only happen to a handful of people 🤔
I am on Essentials v20.1, main plugin version 20.0.0.4, the addon is version 1.4.
[PokeCommunity.com] Visible Overworld Wild Encounter
 
Some of the players of my game occasionally report me a "stack level too deep" error they run into, caused by the "Additional Animations" addon. Do you have an idea what could cause it? Is seems to only happen to a handful of people 🤔
I am on Essentials v20.1, main plugin version 20.0.0.4, the addon is version 1.4.
The mysterious "stack level too deep" error was discussed before. Right now, There is only one reason known. That is if someone presses the F12 button during playtesting without closing the game window before. More about that can be read in
https://www.pokecommunity.com/posts/10393908/
Please let me know, if this (or something similar) was done by the handful of people, or if there seems to be another (yet unknown) reason.
 
Sorry, I did not go through all the pages of this thread :( I did test what you described and the F12 button is indeed the cause of the error! The reply you linked is from 2 years ago and seems to describe an old version of the particular section of code in the plugin, could you maybe indicate how the respective adjustment of the v20.0.0.4 version code would look like (see below the v.20.0.0.4 code)? Thank you for your quick help!

Ruby:
  alias original_increase_steps increase_steps
  def increase_steps
    if @remaining_steps <= 0
      removeThisEventfromMap
    else
      @remaining_steps-=1
      original_increase_steps
    end
  end
 
Sorry, I did not go through all the pages of this thread :( I did test what you described and the F12 button is indeed the cause of the error! The reply you linked is from 2 years ago and seems to describe an old version of the particular section of code in the plugin, could you maybe indicate how the respective adjustment of the v20.0.0.4 version code would look like (see below the v.20.0.0.4 code)? Thank you for your quick help!

Ruby:
  alias original_increase_steps increase_steps
  def increase_steps
    if @remaining_steps <= 0
      removeThisEventfromMap
    else
      @remaining_steps-=1
      original_increase_steps
    end
  end
First of all, I suggest that the error with the F12 reload occurs only during playtesting in debug mode and not in the final version of a game anymore. (Please tell me if I'm wrong.) So, there is no really need to change any code. You can simply close the test game window and restart it instead of pressing F12. But if you want to change the code then the idea is the following
  1. Search for all appearences of the code command alias . Usually, it looks something like the following pseudocode.
    Code:
    alias renamed_method_name method_name
    def method_name
      # some code
      renamed_method_name
      # more code
    end
    This is used to overwrite an already existing method (called method_name in the pseudocode above) in such a way that it adds new code ( # some code and # more code ) but still runs the old original code of that method (at position of # renamed_method_name ). And by the way, this is used for various methods in pokemon essentials and not only in plugins.
  2. Now, search for the original method ( method_name in our example). This might look like the following pseudocode.
    Code:
    def method_name
      # here original code
    end
    Note, that the method might be overwritten more than ones.
  3. Combine everything to a single method. The original code needs to be placed at the position where the overwriting method calls the original method. In pseudocode, it looks something like that
    Code:
    def method_name
      # some code
      # here original code
      # more code
    end
Perhaps, the method that forces your stack overflow error was update beginning in line 124. But it could also be one of the other 3 methods that where renamed with alias and overwritten in the additional animations addon.
 
It actually does happen in the final version of the game, when you run it via the Game.exe.
Okay, just so I get this correctly: when you say "original method", you refer to the main Script within the Script Editor in RPG Maker? And I would have to combine everything by bringing the original method into the plugin's code as shown above?

Edit: Okay I was just playing around a bit and brought the original "update" method into the plugin - it solved the crash from happening, however now every overworld spawn disappears whenever it is supposed to move for the first time 😅
 
Last edited:
It actually does happen in the final version of the game, when you run it via the Game.exe.
Okay, just so I get this correctly: when you say "original method", you refer to the main Script within the Script Editor in RPG Maker? And I would have to combine everything by bringing the original method into the plugin's code as shown above?
Yes, exactly. And combining everything really means combining every occurrence of that mathod in any script or plugin.
Edit: Okay I was just playing around a bit and brought the original "update" method into the plugin - it solved the crash from happening, however now every overworld spawn disappears whenever it is supposed to move for the first time
This is the same problem, but with the method increase_steps , which is overwritten in the visible overworld wild encounters script with the help of an alias . And possiblly this is not the last one. I recommand not to use F12, since this is a constant source for bugs in Pokemon Essentials, for example https://www.pokecommunity.com/showthread.php?t=304195
 
Last edited:
Yes I will - I think the probability of me breaking something by trying to get all the way to the root of this one is higher than the benefit :) thank you for your help!
 
looks like a fun plugin. only thing i want to ask at the moment is that under the v20 and v21 one of the addons was for the lavander town ghosts but the only script for them ive found is for pe17 is this the correct one still? just want to be sure before i break something using the wrong script since it seems to require a lot of editing
I removed that the overworld lavender town ghosts Add-On requires the original lavender town ghost plugin. Now, you can use the overworld version by its own without the full funtionality of the original plugin.
 
Hello there! I have an error which i think that where it comes.

So i will give you as much detailed info as i can provide.


Where the error appeared?

I was on an outside map, ex: Route 1, and i was in battle using boons phenomena, in other words, a phenomenon grass encounters. When i run away from battle option, when the game was about "leaving/transiting" from the battle scene into the outside map, this error appeared, i was using the normal way to test my fan game and not using the debug mode, which it could be useful for this, but the error only appears at random and its hard to recreate it again.


I'm still using PEv20.1, i know that you may not give any support since thats PEv21 is out there, or if you can point me into the right direction, maybe my helper can help me fix it, currently we are both "blinded" about this.

Another thing, the map has a parallel process with this.

Sorry to bother you with that and thx for your time.

Spoiler:

Spoiler:

Spoiler:
 
I updated the shiny hunting script and I think mine is better
Code:
#===============================================================================
# The Let's Go Shiny Hunting, inpired by Diego Mertens script
# - to make a chained pokemon shiny
#Edit done by lemiho19
#===============================================================================

# This is an add-on for the visible overworld wild encounter script.
# It adds shiny hunting by chaining a pokemon species to the script.
# This script is motified by Diego Mertens Lets's Go Catch Combo, see
# https://www.pokecommunity.com/showthread.php?p=10011513

# FEATURES INCLUDED:
# If you catch the same species in a row, then you increase the chance of
# spawning a shiny of that species.

# INSTALLATION:
# Copy this code and
# Paste it at the bottom of your visible wild overworld encounter script.

# PROPERTIES:
# You can choose how many encounters you have to catch to obtain the increased
# Shiny-Chance in parameter
#     CHAINLENGTH
# and the increased Shiny-Chance in parameter
#     SHINYPROBABILITY
# in the settings below.

# REMARK:
# If you want that killing instead of chaining has the effect on spawning shinies then replace "result == 4"
# at the bottom of the shiny chining script by "result==1".
# And If you want that killing and chaining also that effect then replace "result == 4" by "(result==1 || result == 4)".

#===============================================================================
# Settings
#===============================================================================
CHAINLENGTH      = 10 # default 10
#       number describes how many pokemon of the same species
#       you have to catch in a row to increase shiny propability

SHINYPROBABILITY = 80 # default 100 --> 10%
#       increasing this value decreases the probability of spawning a shiny

pokemon = 0
#===============================================================================
# adding a new instance variable to $PokemonTemp in script PField_Metadata to
# remember which pokemon and how many of that kind were caught in a row
#===============================================================================
class PokemonTemp
  attr_accessor :catchcombo # [chain length, species]
end

#===============================================================================
# adding a new event handler on pokemon create to make pokemon shiny on spawning
# and in instant battles if the chain is long enough
#===============================================================================
Events.onWildPokemonCreate+=proc {|sender,e|
   
  if !$PokemonGlobal.battlingSpawnedPokemon
    pokemon=e[0]
       
    next if pokemon.nil?
    $PokemonTemp.catchcombo=[0,0] if !$PokemonTemp.catchcombo
    if ($PokemonTemp.catchcombo[0]>=CHAINLENGTH && $PokemonTemp.catchcombo[1]==pokemon.species)
      if rand(SHINYPROBABILITY)<$PokemonTemp.catchcombo[0]
        pokemon.makeShiny
      end  
    end
 

    if pokemon.species != $PokemonTemp.catchcombo[1]
      if $PokemonTemp.catchcombo[0] < 10
        if rand(10) == 0
          next if $PokemonTemp.catchcombo[1] == 0
          pokemon.species = $PokemonTemp.catchcombo[1]
            if rand((SHINYPROBABILITY * 2))<$PokemonTemp.catchcombo[0]
              pokemon.makeShiny
            end  
          end
        end
     
         if $PokemonTemp.catchcombo[0] == 10
          if rand(5) == 0
            next if $PokemonTemp.catchcombo[1] == 0
            pokemon.species = $PokemonTemp.catchcombo[1]
            if rand((SHINYPROBABILITY * 2))<$PokemonTemp.catchcombo[0]
            pokemon.makeShiny
          end  
        end
        end
     
        if $PokemonTemp.catchcombo[0] > 10
          if rand(2) == 0
            next if $PokemonTemp.catchcombo[1] == 0
            pokemon.species = $PokemonTemp.catchcombo[1]
            if rand((SHINYPROBABILITY * 2))<$PokemonTemp.catchcombo[0]
            pokemon.makeShiny
          end  
          end
        end
      end
  end
}

#===============================================================================
# adding a new event handler on Battle end to update the catchchain (where the
# pokemon-catch-chain is saved)
#===============================================================================
Events.onWildBattleEnd+=proc {|sender,e|
   species=e[0]
   result=e[2]
   $PokemonTemp.catchcombo = [0,0] if !$PokemonTemp.catchcombo
   #if $PokemonTemp.catchcombo[1]!=species
     #$PokemonTemp.catchcombo=[0,species]
   #end
   if (result == 1 || result == 4) #&& species==$PokemonTemp.catchcombo[1]
     if $PokemonTemp.catchcombo[1]!=species
     $PokemonTemp.catchcombo=[0,species]
     end
     $PokemonTemp.catchcombo[0]+=1

     #$game_variables[145] = $PokemonTemp.catchcombo[0]#####################
     #$game_variables[144] = $PokemonTemp.catchcombo[1]#####################
     if result == 4 && $PokemonTemp.catchcombo[1]==species
        $PokemonTemp.catchcombo=[0,species]
     end
   end
}

This is for V18.1
my changes:
1. no longer will fights that you run from reset the counter
2. after you start a chain there is a 1 in 10 chance of the pokemon being forced to spawn
3. after you hit chain 10 theres a 50/50 chance to force spawn the chained pkmn
4. the chain resets after you catch any pkmn (including the chained pkmn) or battle the wrong pkmn (a nonchained pkmn) but you can run from any pkmn!
 
I updated the shiny hunting script and I think mine is better
Code:
#===============================================================================
# The Let's Go Shiny Hunting, inpired by Diego Mertens script
# - to make a chained pokemon shiny
#Edit done by lemiho19
#===============================================================================

# This is an add-on for the visible overworld wild encounter script.
# It adds shiny hunting by chaining a pokemon species to the script.
# This script is motified by Diego Mertens Lets's Go Catch Combo, see
# https://www.pokecommunity.com/showthread.php?p=10011513

# FEATURES INCLUDED:
# If you catch the same species in a row, then you increase the chance of
# spawning a shiny of that species.

# INSTALLATION:
# Copy this code and
# Paste it at the bottom of your visible wild overworld encounter script.

# PROPERTIES:
# You can choose how many encounters you have to catch to obtain the increased
# Shiny-Chance in parameter
#     CHAINLENGTH
# and the increased Shiny-Chance in parameter
#     SHINYPROBABILITY
# in the settings below.

# REMARK:
# If you want that killing instead of chaining has the effect on spawning shinies then replace "result == 4"
# at the bottom of the shiny chining script by "result==1".
# And If you want that killing and chaining also that effect then replace "result == 4" by "(result==1 || result == 4)".

#===============================================================================
# Settings
#===============================================================================
CHAINLENGTH      = 10 # default 10
#       number describes how many pokemon of the same species
#       you have to catch in a row to increase shiny propability

SHINYPROBABILITY = 80 # default 100 --> 10%
#       increasing this value decreases the probability of spawning a shiny

pokemon = 0
#===============================================================================
# adding a new instance variable to $PokemonTemp in script PField_Metadata to
# remember which pokemon and how many of that kind were caught in a row
#===============================================================================
class PokemonTemp
  attr_accessor :catchcombo # [chain length, species]
end

#===============================================================================
# adding a new event handler on pokemon create to make pokemon shiny on spawning
# and in instant battles if the chain is long enough
#===============================================================================
Events.onWildPokemonCreate+=proc {|sender,e|
  
  if !$PokemonGlobal.battlingSpawnedPokemon
    pokemon=e[0]
      
    next if pokemon.nil?
    $PokemonTemp.catchcombo=[0,0] if !$PokemonTemp.catchcombo
    if ($PokemonTemp.catchcombo[0]>=CHAINLENGTH && $PokemonTemp.catchcombo[1]==pokemon.species)
      if rand(SHINYPROBABILITY)<$PokemonTemp.catchcombo[0]
        pokemon.makeShiny
      end 
    end
 

    if pokemon.species != $PokemonTemp.catchcombo[1]
      if $PokemonTemp.catchcombo[0] < 10
        if rand(10) == 0
          next if $PokemonTemp.catchcombo[1] == 0
          pokemon.species = $PokemonTemp.catchcombo[1]
            if rand((SHINYPROBABILITY * 2))<$PokemonTemp.catchcombo[0]
              pokemon.makeShiny
            end 
          end
        end
    
         if $PokemonTemp.catchcombo[0] == 10
          if rand(5) == 0
            next if $PokemonTemp.catchcombo[1] == 0
            pokemon.species = $PokemonTemp.catchcombo[1]
            if rand((SHINYPROBABILITY * 2))<$PokemonTemp.catchcombo[0]
            pokemon.makeShiny
          end 
        end
        end
    
        if $PokemonTemp.catchcombo[0] > 10
          if rand(2) == 0
            next if $PokemonTemp.catchcombo[1] == 0
            pokemon.species = $PokemonTemp.catchcombo[1]
            if rand((SHINYPROBABILITY * 2))<$PokemonTemp.catchcombo[0]
            pokemon.makeShiny
          end 
          end
        end
      end
  end
}

#===============================================================================
# adding a new event handler on Battle end to update the catchchain (where the
# pokemon-catch-chain is saved)
#===============================================================================
Events.onWildBattleEnd+=proc {|sender,e|
   species=e[0]
   result=e[2]
   $PokemonTemp.catchcombo = [0,0] if !$PokemonTemp.catchcombo
   #if $PokemonTemp.catchcombo[1]!=species
     #$PokemonTemp.catchcombo=[0,species]
   #end
   if (result == 1 || result == 4) #&& species==$PokemonTemp.catchcombo[1]
     if $PokemonTemp.catchcombo[1]!=species
     $PokemonTemp.catchcombo=[0,species]
     end
     $PokemonTemp.catchcombo[0]+=1

     #$game_variables[145] = $PokemonTemp.catchcombo[0]#####################
     #$game_variables[144] = $PokemonTemp.catchcombo[1]#####################
     if result == 4 && $PokemonTemp.catchcombo[1]==species
        $PokemonTemp.catchcombo=[0,species]
     end
   end
}

This is for V18.1
my changes:
1. no longer will fights that you run from reset the counter
2. after you start a chain there is a 1 in 10 chance of the pokemon being forced to spawn
3. after you hit chain 10 theres a 50/50 chance to force spawn the chained pkmn
4. the chain resets after you catch any pkmn (including the chained pkmn) or battle the wrong pkmn (a nonchained pkmn) but you can run from any pkmn!
Thank you for sharing your updated version. I added a link to your version in the overwiew post for V18.1.
 
I don't know if anyone has mentioned this (haven't read through all 29 pages of comments) but I've been testing the Improved Mementos plugin and I noticed that this script completely removes any marks from wild pokemon once you catch them. I did confirm that it is this plugin specifically that is causing the issue. I'm not sure what in the code could be removing this information or how to fix it.
 
There is a critical bug that needs to be fixed as soon as possible with Additional Animations - Overworld Encounters Add On 1.4 for ES V20.1.
When you save in front of a shiny and reset the game (not with f12), the next shiny that will try to appear or trying again with the same shiny will send this error:

People can get past the titles screen but once they get to the screen to load their save, loading their save give this error.

[PokeCommunity.com] Visible Overworld Wild Encounter
 
I don't know if anyone has mentioned this (haven't read through all 29 pages of comments) but I've been testing the Improved Mementos plugin and I noticed that this script completely removes any marks from wild pokemon once you catch them. I did confirm that it is this plugin specifically that is causing the issue. I'm not sure what in the code could be removing this information or how to fix it.
You discribe that overworld encounter have marks during battle. But after you caught that pokemon the marks are gone and will not be listed in the mementos overview menu. Did I understand you correctly?
Have you ever tried to place an event manually on the map (on the map editor), that triggers a wildbattle with a pokemon? In that situation, does the pokemon also lose its marks after being caught?
 
There is a critical bug that needs to be fixed as soon as possible with Additional Animations - Overworld Encounters Add On 1.4 for ES V20.1.
When you save in front of a shiny and reset the game (not with f12), the next shiny that will try to appear or trying again with the same shiny will send this error:

People can get past the titles screen but once they get to the screen to load their save, loading their save give this error.
Thank you for reporting the bug. Unfortunately, but I could not reproduce it.
I did the following.
  • I added a short script that made all spawning pokemon shiny.
  • I moved on the overworld till an pokemon (a shiny one) spawned.
  • I saved the game.
  • I closed the game (pressing the x on the upper right)
  • I started it again.
  • I moved on the map till othe shiny pokemon spawned
  • I also went into battle with one.
But no error occured. I used Pokemon Essentials v 21.1 with the newest visible overworld wild encounter plugin version and the newest Additional Addon version from github.

Can you please reinstall the newest version of the additional animation addon and let me know in more detail, what you have done to get that error? Did you changed the route, stepped into a house, went into battle or anything else?
 
Hello there! I have an error which i think that where it comes.

So i will give you as much detailed info as i can provide.


Where the error appeared?

I was on an outside map, ex: Route 1, and i was in battle using boons phenomena, in other words, a phenomenon grass encounters. When i run away from battle option, when the game was about "leaving/transiting" from the battle scene into the outside map, this error appeared, i was using the normal way to test my fan game and not using the debug mode, which it could be useful for this, but the error only appears at random and its hard to recreate it again.


I'm still using PEv20.1, i know that you may not give any support since thats PEv21 is out there, or if you can point me into the right direction, maybe my helper can help me fix it, currently we are both "blinded" about this.

Another thing, the map has a parallel process with this.

Sorry to bother you with that and thx for your time.



Thank you for reporting the error. Since the error occures at random, it is hard to reproduce. It may take some time to check. If you find anything interesting, please let me know.
 
Thank you for reporting the bug. Unfortunately, but I could not reproduce it.
I did the following.
  • I added a short script that made all spawning pokemon shiny.
  • I moved on the overworld till an pokemon (a shiny one) spawned.
  • I saved the game.
  • I closed the game (pressing the x on the upper right)
  • I started it again.
  • I moved on the map till othe shiny pokemon spawned
  • I also went into battle with one.
But no error occured. I used Pokemon Essentials v 21.1 with the newest visible overworld wild encounter plugin version and the newest Additional Addon version from github.

Can you please reinstall the newest version of the additional animation addon and let me know in more detail, what you have done to get that error? Did you changed the route, stepped into a house, went into battle or anything else?
It's not me who got the error, it's people on my discord who got it. I may have an idea where the error can be located, it may be in the perma anim thing. But since someone else tried to reproduce the same bug and was unsuccessful... Maybe the people who reported this bug used something to modify the data of game, I don't know. And I'm sorry if I can't give you more details, since people who got the bug didn't give me enough details about it. Also I don't think I can load a ES V21 plugin in a ES V20.1 game...
 
You discribe that overworld encounter have marks during battle. But after you caught that pokemon the marks are gone and will not be listed in the mementos overview menu. Did I understand you correctly?
Have you ever tried to place an event manually on the map (on the map editor), that triggers a wildbattle with a pokemon? In that situation, does the pokemon also lose its marks after being caught?
You got it right. A wild battle event does also lose it's marks when being caught, so maybe I was wrong with calling out this plugin specifically. At this point I have no idea what's causing my issue, honestly.
 
Back
Top