• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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

I keep getting this error:
Script 'Overworld_Random_Encounters' line 387:
NoMethodError occurred.

undefined method '<' for [85, 24]:Array

from 'Overworld_Random_Encounters' line 387 in 'spawnEvent'
from 'Overworld_Random_Encounters' line 317 in 'pbPlaceEncounter'
from 'Overworld_Random_Encounters' line 229 in 'pbOnStepTaken'
from 'Game_Player' line 461 in 'update_old'
from 'Game_Player_Visuals' line 71 in 'pokeride_update'
from 'Pokeride_0' line 106 in 'follow_update'
from 'FLLW' line 1463 in 'update'
from 'Scene_Map' line 164 in 'follow_update'
from 'Scene_Map' line 161 in 'loop'
from 'Scene_Map' line 170 in 'follow_update'
from 'FLLW' line 1551 in 'update'
from 'Scene_Map' line 234 in 'main'
 
Hey, the script is so good! I was doing something similar in my game but with events with so many pages, and this look so much neat and useful. I've got a question, 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.

You're right, its nice to just stand somewhere on the map and just keep watching the running pokemon. Well, on the other hand, your respond also sounds like that you just want to let the game play itself. Anyway (without thinking to much about the implementation), I included this feature for you and all the other, who want to include it in there fan games, now in Version 1.7, which you can find in the main post.

If you want to include it by your own, then add a new parameter in the settings section.
Code:
AUTOSPAWNSPEED = 60 # default 60
#You can set the speed of automatic pokemon spawning, i.e. the ability of pokemon
# to spawn automatically even without even moving the player.
#0   - means that pokeomon only spawn while the player is moving
#>0  - means automatic spawning is activated, the closer to 0 the faster the spawning
and add the "Kernel.pbOnStepTaken(nil)" functionallity to the update method of the Game_Map class by adding the following code at the bottom of the visible_overworld_encounter script

Code:
class Game_Map
  alias original_update update
  def update
    #--------------------------------
    # for testing auto spawning
    $framecounter = 0 if !$framecounter 
    $framecounter = $framecounter + 1
    if $framecounter == AUTOSPAWNSPEED
      $framecounter = 0
      Kernel.pbOnStepTaken(nil)
    end
    #--------------------------------
    original_update
  end
end
 
I keep getting this error:
Script 'Overworld_Random_Encounters' line 387:
NoMethodError occurred.

undefined method '<' for [85, 24]:Array
[...]
from 'Game_Player_Visuals' line 71 in 'pokeride_update'
from 'Pokeride_0' line 106 in 'follow_update'
[...]

Unfortunately, your error message is not enough to detect your error.
First of all, what script version did you use: for pokeon essentials 16.2 of 17.2. I whould suggest that you use 16.2? But it is just a guess.
Second, please start the editor go into the Overworld_Random_Encounter script and copy the code at line 387. That code does not seem to be the same as in the original scripts.
Did you some changes in the script?

Moreover, it seems that you are using Marins Pokeride script. Maybe these two scripts are not compatible. I don't know. But you can check that easily, by removing the code for the pokeride and starting a new game. If your error does not occur anymore, then, indeed, the pokeride script is not compatible. In that case, I recommand to use items instead of pokemon for you hm-moves. You can find a complete script (drag and drop) here: https://www.pokecommunity.com/threads/429034
 
I use 17.2
The code at line 387 is: if encounter[0] < 10
The only thing I did was replace the method "Kernel.pbOnStepTaken(eventTriggered)" with the overworld encounter switch method
 
Last edited:
I use 17.2
The code at line 387 is: if encounter[0] < 10
The only thing I did was replace the method "Kernel.pbOnStepTaken(eventTriggered)" with the overworld encounter switch method

Please test the following: copy and paste the new version 1.7. And don't replace the "Kernel.pbOnStepTaken(eventTriggered)" method by the overworld encounter switch method. Does that work? I would guess that it doesn't.

Are you using pokeride or any scripts that override vanilla 17.2 functionallity?

Edit:
Originally encounter[0] is a number. More precisely, it is the index of the encountering pokemon. However, in your error message encounter[0] is an array [85,24]. I would say that this can't happen without other scripts that override the EncounterModifier or any other method used to generate the encounter.
 
Last edited:
Seems like it works without the overworld encounter switch method, huh.
Is there no way to retain this or something simmilar, as I don't want it to be always active?
 
Seems like it works without the overworld encounter switch method, huh.
Is there no way to retain this or something simmilar, as I don't want it to be always active?

EDIT: Now, I think I know what you did. You used the version of the overworld encounter switch method for Version 1.0, which is not compatible with version 1.2 and higher. The overworld encounter switch method has also a newer compatible version. I added the code of that version at the bottom.

ORIGINALLY POST: Okay, I looked for the overworld encounter switch method. I tested it with version 1.7 and it worked.

I set "AUTOSPAWNSPEED = 0" and "OVERWORLD_ENCOUNTER_SWITCH = 97" in the settings of the script.

Here the code again:
Code:
def Kernel.pbOnStepTaken(eventTriggered)
  #Should it be possible to search for pokemon nearby?
  if $game_player.move_route_forcing || pbMapInterpreterRunning? || !$Trainer
    Events.onStepTakenFieldMovement.trigger(nil,$game_player)
    return
  end
  $PokemonGlobal.stepcount = 0 if !$PokemonGlobal.stepcount
  $PokemonGlobal.stepcount += 1
  $PokemonGlobal.stepcount &= 0x7FFFFFFF
  repel = ($PokemonGlobal.repel>0)
  Events.onStepTaken.trigger(nil)
  handled = [nil]
  Events.onStepTakenTransferPossible.trigger(nil,handled)
  return if handled[0]
  if !eventTriggered
    if $game_switches[OVERWORLD_ENCOUNTER_SWITCH]==false
      #STANDARD WILDBATTLE
      pbBattleOnStepTaken(repel)
    else  
      #OVERWORLD ENCOUNTERS
      #we choose the tile on which the pokemon appears
      pos = pbChooseTileOnStepTaken
      return if !pos
      #we choose the random encounter
      encounter,gender,form = pbChooseEncounter(pos[0],pos[1],repel)
      return if !encounter
      #we generate an random encounter overworld event
      pbPlaceEncounter(pos[0],pos[1],encounter,gender,form)
    end
  end
end
 
Last edited:
I have the script Rescue Chain - By Vendily that makes the wild Pokémon evolve according to the dating chain.
Know how I can make it work with your Visible Overworld Encounters script?

Thank you in advance.
 
I have the script Rescue Chain - By Vendily that makes the wild Pokémon evolve according to the dating chain.
Know how I can make it work with your Visible Overworld Encounters script?

Thank you in advance.

To include visible overworld encounter and the rescue chain in the same game, these two scripts need to be merged together. Therefor, I made a new version 1.8 of the visible overworld encounter script, which includes Vendilys Rescue Chain https://www.pokecommunity.com/threads/415524

Everyone, who wants to use the rescue chain simply has to set the parameter "USERESCUECHAIN" to true in the settings section of the script. Unless the visible overworld encounter script works as before.
 
To include visible overworld encounter and the rescue chain in the same game, these two scripts need to be merged together. Therefor, I made a new version 1.8 of the visible overworld encounter script, which includes Vendilys Rescue Chain https://www.pokecommunity.com/threads/415524

Everyone, who wants to use the rescue chain simply has to set the parameter "USERESCUECHAIN" to true in the settings section of the script. Unless the visible overworld encounter script works as before.

Thank you.
Your script worked verry well.
 
Hi! Your script looks great but i keep getting this error. After adding missing terrain tags i get this error after finishing a combat. Sorry for my poor english, and thanks in advance. I'm begging for help!

Exception: RGSSError
Mensaje: disposed sprite
Spriteset_Map:29:in `src_rect'
Spriteset_Map:29:in `update'
Spriteset_Map:381:in `_animationSprite_update'
Spriteset_Map:378:in `each'
Spriteset_Map:378:in `_animationSprite_update'
AnimationSprite:86:in `update'
Scene_Map:51:in `updateSpritesets'
Scene_Map:45:in `each'
Scene_Map:45:in `updateSpritesets'
Scene_Map:115:in `update'
 
Hi! Your script looks great but i keep getting this error. After adding missing terrain tags i get this error after finishing a combat. Sorry for my poor english, and thanks in advance. I'm begging for help!

Exception: RGSSError
Mensaje: disposed sprite
Spriteset_Map:29:in `src_rect'
Spriteset_Map:29:in `update'
Spriteset_Map:381:in `_animationSprite_update'
Spriteset_Map:378:in `each'
Spriteset_Map:378:in `_animationSprite_update'
AnimationSprite:86:in `update'
Scene_Map:51:in `updateSpritesets'
Scene_Map:45:in `each'
Scene_Map:45:in `updateSpritesets'
Scene_Map:115:in `update'

Your error message basically says that the rpgmaker wants to work with a sprite which is already disposed. But we still don't know, which sprite it is and what the scripts want to do with that.
So, before anyone can help you you have to give more informations.

Which version of Pokemon Essentials do you use, PE17.2 or 16.2?
And which version of the visible overworld encounter script do you use, v1.6 for pe16.2 or v1.8 for 17.2?
What do you mean by adding missing terrain tags? To my mind, you don't have to add terrain tags to use make this script working. Did the visible overworld encounter script work before you added the terrain tags? And where did you added it.
And of course, please check if your error message also occurs after removing the visible overworld encounter script.
 
View attachment 90535

* Visible Overworld Wild Encounters Version 1.8 - by derFischae (Credits if used please) *

UPDATED TO VERSION 1.8. NOW INCLUDING VENDILYS RESCUE CHAIN AND DOWNSCALE OF VERSION 1.6 FOR POKEMON ESSENTIALS V16.2 BY ARCHYTHEARC.

This script is for Pokémon Essentials V16.2, V17 and V17.2. Originally written for V17 and 17.2 by me and VERSION 1.6 downscaled to V16.2 by ArchyTheArc.

As in Pokemon Let's go Pikachu/Eevee or Pokemon Shild and Sword random 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 INCLUDED:
- see the pokemon on the overworld before going into battle
- no forced battling against random encounters
- plays the pokemon cry while spawning
- Choose whether encounters occure on all terrains or only on the terrain of the player
- if you kill the same species in a row, then you increase the chance of spawning a shiny of that species or an evolved pokemon of that species family

NEW FEATURES IN VERSION 1.1:
- less lag
- supports sprites for alternative forms of pokemon

NEW FEATURES IN VERSION 1.2:
- supports sprites for female/male/genderless pokemon

NEW FEATURES IN VERSION 1.3:
- bug fixes for roaming encounter and double battles

NEW FEATURES IN VERSION 1.4:
- more options in settings

NEW FEATURES IN VERSION 1.5:
- roaming encounters working correctly

NEW FEATURES IN VERSION 1.6:
- did some runtime optimization, i.e. faster despawning of pokemon after battle

NEW FEATURES IN VERSION 1.7:
- included automatic spawening of pokemon, i.e. without spawning without having to move the player

NEW FEATURES IN VERSION 1.8:
- included vendilys rescue chain, i. e. if pokemon of the same species family spawn in a row and will be battled in a row, then you increase the chance of spawning an evolved pokemon of that species family. Link: https://www.pokecommunity.com/threads/415524

INSTALLATION:
Installation as simple as it can be.
Step 1) You need sprites for the overworld pokemon in your \Graphics\Characters folder named by there number 001.png, 002.png, ..., with the corresponding shiny versions 001s.png, 002s.png, .... For instance you can use Gen 1-7 OV SPrites or whatever you want for your fakemon.
If you want to use alternative forms as overworld sprites, then make sure that you also have a sprite for each alternative form, e. g. for Unown 201_1.png, 201s_1.png, 201_2.png, 201s_2.png, ...
If you want to use female forms as overworld sprites, then make sure that you also have a female sprite for each pokemon named 001f.png, 001fs.png, 002f.png, 002fs.png, ... (excluding genderless pokemon of course)
Step 2) Insert a new file in the script editor above main, name it Overworld_Random_Encounters and copy this code into it.

PROPERTIES:
1) If you want to have water encounters only while surfing, you also have to change the value of the upcoming parameter RESTRICTENCOUNTERSTOPLAYERMOVEMENT to
RESTRICTENCOUNTERSTOPLAYERMOVEMENT = true
2) You can choose how many steps the encounter moves before vanishing in parameter
STEPSBEFOREVANISHING
3) You can choose how many encounters you have to kill to obtain the increased Shiny-Chance in parameter
CHAINLENGTH
and the increased Shiny-Chance in parameter
SHINYPROBABILITY
4) You can choose whether the sprite of your overworld encounter is always the standard form or can be an alternative form in parameter
USEALTFORMS
5) You can choose whether the sprites depend on the gender of the encounter or are always neutral in parameter
USEFEMALESPRITES
6) You can choose whether the overworld encounters have a stop/ step-animation similar to following pokemon in the parameter
USESTOPANIMATION
7) You can choose how many overworld encounters are agressive and run to the player in the parameter
AGGRESSIVEENCOUNTERPROBABILITY
8) You can choose the move-speed and move-frequenzy of normal and aggressive encounters in parameters
ENCMOVESPEED, ENCMOVEFREQ, AGGRENCMOVESPEED, AGGRENCMOVEFREQ
9) You can choose whether pokemon can spawn automatically or only while the player is moving and you can set the spawning frequency in the parameter
AUTOSPAWNSPEED
10) You can activate or deactivate vendilys rescue chain by in the parameter
USERESCUECHAIN
Moreover, you also have all settings of vendilys Rescue chain here.

THANKS to BulbasaurLvl5 for bringing me to pokemon essentials and the super productive time

THANKS to ArchyTheArc for downscaling to Pokemon Essentials V16.2.

* For Pokemon Essentials V17 and V17.2. *
Spoiler:


* Version 1.6 for Pokemon Essentials V16.2. Downscale by ArchyTheArc *
Spoiler:


Maybe, you also need this for Pokemon Essentials 16.2:
Spoiler:

Hello
I thought it is possible to change the script.
Instead of showing Pokémon, make trainers appear instead.
This way, we avoid creating events for trainer combat.
And to prevent the trainer from appearing and disappearing from the map, we can use updating the map change or entering a building.

I don't know if you understand me, my English is very basic?

See you again.
 
Umm... Do normal encounters still work? Like that still you can have wild encounters

If you want overwild encounter and ordinary wild encounter at the same time, then you can use the following modification:

Spoiler:

If you want to use overworld encounter only after activating a switch, then you can use the following:

Spoiler:

If you don't want to have visible overworld encounter at all, then simply don't use this script.
 
Hello
I thought it is possible to change the script.
Instead of showing Pokémon, make trainers appear instead.
This way, we avoid creating events for trainer combat.
And to prevent the trainer from appearing and disappearing from the map, we can use updating the map change or entering a building.

I don't know if you understand me, my English is very basic?

See you again.

You're right. You can modify the script to implement your suggested functionality.
I would say that this is a long and tough scripting project. But this is also a very good idea. This will increase the user friendliness of pokemon essentials, speed up the creating process for new games and it will make pokemon essentials easier to use and learn for new user.

However, it is a tough project.
You still have to use the PBS-file for the trainer and trainer types and fill in the pokemon the trainers have.
Then you have to generate events for the trainers. This should work like the "spawnEvent" method in my visible overworld encounter script.
Please make sure, that you have to set up the character sprite depending on the trainer type of the trainer.
(Moreover, beside all the other properties, you will have to give them there fighting text "I like shorts." This will be the same text for all.)
The actual tough part is to tell pokemon essential on which map the trainers spawn. To my mind, the easiest way is to create an array of trainer names for each route in the settings.
But you can also create a new pbs-file (where you put in that data) and modify the compiler to make the data in the new pbs-file readable for pokemon essentials.
Finally you have to find a good way to spawn the events ones. As you alraedy mentioned, you can do this on map creation.
 
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.
And I'd like that during the double encounters, there is only one Pokémon and not two.
To make it more realist.
(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

Thanks in advance and I continue to enjoy your awesome scripts.

Well, it took some time to look for the practicability of your suggested roaming encounter functionality. Unfortunately, it is not easy to tell pokemon essentials to treat the temporary background data for roaming encounter differently depending on the kind of wild encounter (overworld or not).
However, it is possible. So feel free to try to code it by your own. But I don't think, that the efford is proportional to the reward, for me. Sorry.
 
This is the error showing up for me. It happens when I lose a wild battle and get sent to the Poke Center.
I don't appear to be missing anything, and I can't seem to find a fix to it on my own. Thoughts?
This is with the latest update to the script, I didn't change anything that I shouldn't have.

Exception: NoMethodError

Message: (eval):13:in `pbExecuteScript'undefined method `removeThisEventfromMap' for nil:NilClass

***Full script:

$PokemonGlobal.roamEncounter = nil
$PokemonTemp.nowRoaming = false
$PokemonTemp.roamerIndex = nil
$PokemonGlobal.nextBattleBGM = nil
$PokemonTemp.forceSingleBattle = false
$PokemonTemp.encounterType = 0
$game_switches[31]=false
pbSingleOrDoubleWildBattle(23,9, $game_map.events[23].map.map_id, $game_map.events[23].x, $game_map.events[23].y,nil,0)
$game_switches[31]=false
$PokemonTemp.encounterType = -1
$PokemonTemp.forceSingleBattle = false
EncounterModifier.triggerEncounterEnd()
$game_map.events[23].removeThisEventfromMap
$game_map.events.delete(23)


Interpreter:243:in `pbExecuteScript'

Interpreter:1606:in `eval'

Interpreter:243:in `pbExecuteScript'

Interpreter:1606:in `command_355'

Interpreter:494:in `execute_command'

Interpreter:193:in `update'

Interpreter:106:in `loop'

Interpreter:198:in `update'

Scene_Map:199:in `follow_update'

Scene_Map:197:in `loop'



Interpreter:281:in `pbExecuteScript'

Interpreter:1606:in `command_355'

Interpreter:494:in `execute_command'

Interpreter:193:in `update'

Interpreter:106:in `loop'

Interpreter:198:in `update'

Scene_Map:199:in `follow_update'

Scene_Map:197:in `loop'

Scene_Map:206:in `follow_update'

FollowingPKMN:1651:in `updateold'
 
Try replacing your script with this:
Spoiler:
 
Back
Top