• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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

If you want to add to the script that pokemon don't spawn on impassable tiles then
replace the code snippet
Code:
  return [x,y]
in the method "pbChooseTileOnStepTaken" in your visible overworld wild encounters script by
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
      elsif $game_map.priorities[tile_id] == 0
        break
      end
    end
  end
  return [x,y]

Thanks a lot! I found an embarassing solution with putting the black part a 2x priority, so this is much better!
 
I don't know if someone replied to something similar, but the random can also spawn form? like rotom form, galarian/alolan form?

If you want to spawn various forms with the randomiser add-on then you should extend the randomiser add-on script. For example, using the following extended script works.
Code:
#======================================================
#           Randomised Spawning v1.01 by derFischae
#======================================================
# This is an Add-On for the visible overworld wild encounters script. It will randomise overworld encounters.
#
# Add this code to the bottom of the visible overworld wild encounter script

Events.onWildPokemonCreateForSpawning+=proc{|sender,e|
  pokemon=e[0]
  pokemon.species = rand(PBSpecies.maxValue)+1
  pokemon.setGender(2)
  pokemon.setGender(1)
  pokemon.setGender(0) if rand(100)<50
  f = MultipleForms.call("getFormOnCreation",pokemon)
  if f
    pokemon.form = f
    pokemon.resetMoves
  end
}
 
Last edited:
If there is a way to set only Automatic Spawning,no extra spawning when moving?
 
Is there is a way to set only Automatic Spawning,no extra spawning when moving?

Of course. Depending on what you want exactly, you have 2 options.
1.) To obtain automatic spawning and no spawning but still normal encounters while moving or direction change, you can do the following.
Remove this code
Code:
    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,isShiny = pbChooseEncounter(pos[0],pos[1],repel)
      return if !encounter
      #we generate an random encounter overworld event
      pbPlaceEncounter(pos[0],pos[1],encounter,gender,form,isShiny)
in the method "pbOnStepTaken(eventTriggered)" in the "visible overworld wild encounter script" and in the code of "the bug fix for Pokemon Essentials v18.1" (if you used it).
2.) To obtain automatic spawning but no spawning and no normal encounters while moving or direction change, you can do the following.
Remove this code
Code:
        if ($game_variables[OVERWORLD_ENCOUNTER_VARIABLE]>0 && ($game_variables[OVERWORLD_ENCOUNTER_VARIABLE]>=100 || rand(100) < $game_variables[OVERWORLD_ENCOUNTER_VARIABLE])) || pbPokeRadarOnShakingGrass
      #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,isShiny = pbChooseEncounter(pos[0],pos[1],repel)
      return if !encounter
      #we generate an random encounter overworld event
      pbPlaceEncounter(pos[0],pos[1],encounter,gender,form,isShiny)
    end
in the method "pbOnStepTaken(eventTriggered)" in the "visible overworld wild encounter script" and in the code of "the bug fix for Pokemon Essentials v18.1" (if you used it).
 
This is a great Script. I used it initially for Essentials 17.2.

At the moment I'm moving to 18.1 and there I have a little problem: The shiny chaining doesn't seems to be working. Even after more than 10 kills of Pidgeys there is no shiny one.
I use CHAINLENGTH = 1 and SHINYPROBABILITY = 10. If I'm using this setting in the version of 17.2 then it works as intented.

I hope you can help.

EDIT: After further testing I noticed that shinies appear when I'm catching the Pokémon. Defeating seems to have no impact.
 
Last edited:
This is a great Script. I used it initially for Essentials 17.2.

At the moment I'm moving to 18.1 and there I have a little problem: The shiny chaining doesn't seems to be working. Even after more than 10 kills of Pidgeys there is no shiny one.
I use CHAINLENGTH = 1 and SHINYPROBABILITY = 10. If I'm using this setting in the version of 17.2 then it works as intented.

I hope you can help.

EDIT: After further testing I noticed that shinies appear when I'm catching the Pokémon. Defeating seems to have no impact.

If you want that killing beside chaining also has an effect on spawning shinies then replace "result == 4" at the bottom of the shiny chaining script by
"(result==1 || result == 4)"
 
Last edited:
i know you've updated to v18 and maybe you fixed it but... i think theres a tiny chance sometimes that the shiny switch gets locked on(?) i've had two time it happened, and its around caves (unrelated i feel but felt i'd share) i've checked all the doorways or events nearby and nothing, and both instances of the issue are completely different areas and maps. most of the time regular and shiny pokemon appear fine, but somehow after one shiny encounter it just locks the switch on. im only relating it to this script as its the other thing to reference the wild shiny switch anywhere.

for reference if its changed for you in v18;
Code:
    # setting shiny switch on if sprite is a shiny-sprite
    oldShinySwitchStatus=$game_switches[SHINY_WILD_POKEMON_SWITCH]
    parameter = (shinysprite == true) ? " $game_switches["+SHINY_WILD_POKEMON_SWITCH.to_s+"]=true" : " $game_switches["+SHINY_WILD_POKEMON_SWITCH.to_s+"]=false"
    pbPushScript(event.pages[0].list,sprintf(parameter))
Code:
    pbPushScript(event.pages[0].list,sprintf(" $game_switches["+SHINY_WILD_POKEMON_SWITCH.to_s+"]="+oldShinySwitchStatus.to_s))

its not been a regular thing just two cases. the recent one was via a normal encounter (but that goes through the same generation method as the overworlds iirc just doesnt spawn them in the world)
if you can confirm its not this, leaves me with no idea why but lets me know its not this.
 
i know you've updated to v18 and maybe you fixed it but... i think theres a tiny chance sometimes that the shiny switch gets locked on(?) i've had two time it happened, and its around caves (unrelated i feel but felt i'd share) i've checked all the doorways or events nearby and nothing, and both instances of the issue are completely different areas and maps. most of the time regular and shiny pokemon appear fine, but somehow after one shiny encounter it just locks the switch on. im only relating it to this script as its the other thing to reference the wild shiny switch anywhere.

for reference if its changed for you in v18;
Code:
    # setting shiny switch on if sprite is a shiny-sprite
    oldShinySwitchStatus=$game_switches[SHINY_WILD_POKEMON_SWITCH]
    parameter = (shinysprite == true) ? " $game_switches["+SHINY_WILD_POKEMON_SWITCH.to_s+"]=true" : " $game_switches["+SHINY_WILD_POKEMON_SWITCH.to_s+"]=false"
    pbPushScript(event.pages[0].list,sprintf(parameter))
Code:
    pbPushScript(event.pages[0].list,sprintf(" $game_switches["+SHINY_WILD_POKEMON_SWITCH.to_s+"]="+oldShinySwitchStatus.to_s))

its not been a regular thing just two cases. the recent one was via a normal encounter (but that goes through the same generation method as the overworlds iirc just doesnt spawn them in the world)
if you can confirm its not this, leaves me with no idea why but lets me know its not this.

Indeed, the code is changed concerning the shinyflag of pokemon in script version 2.0.4 for Pokemon Essentials 18 and 18.1. I could rewrite that section for PEv17.2. but before we should check if it is really an issue coming from the overworld encounter script.

its not been a regular thing just two cases. the recent one was via a normal encounter (but that goes through the same generation method as the overworlds iirc just doesnt spawn them in the world)

Could it be possible that the shiny status got locked on because you lost a battle against an overworld encounter? Or did something else happen before? What do you meen with "was via a normal encounter"? Were the first shiny encounter a normal encounter? Did overworld encounter become shiny too after that normal encounter or only normal encounters? Can you explain that precisely, and can you tell me what you mean with "iirc"?
Right now I don't have a clue, I don't see why this error should raise.
 
Indeed, the code is changed concerning the shinyflag of pokemon in script version 2.0.4 for Pokemon Essentials 18 and 18.1. I could rewrite that section for PEv17.2. but before we should check if it is really an issue coming from the overworld encounter script.

Could it be possible that the shiny status got locked on because you lost a battle against an overworld encounter? Or did something else happen before? What do you meen with "was via a normal encounter"? Were the first shiny encounter a normal encounter? Did overworld encounter become shiny too after that normal encounter or only normal encounters? Can you explain that precisely, and can you tell me what you mean with "iirc"?
Right now I don't have a clue, I don't see why this error should raise.

right yea, since it happened only to players and not me not got that much info, but
player got a normal encounter, that was shiny, caught it, then every pokemon after (Even not from encounters and event ones) was shiny, which included overworlds, iirc is if i recall correctly, because the other person never said if the overworlds got them, but the first incident did. could it be catching a shiny doesnt turn of the flag? i dont know as i have people going just for shinies and this bug doesnt occur, and i see shinies when testing but never get locked.

again only feel its this script as nothing else mentions "SHINY_WILD_POKEMON_SWITCH" or switch 31 (the actual switch) minus this and in settings and encounter modifiers where it makes them shiny. the trigger could even be set by the pokemon before that but im not sure (e.g. a seemingly normal encounter somehow triggered it) but that feels a bit far fetched.

if i could recreate the bug for you then i could do more testing but.
its the actual switch being locked on causing shinies (i assume you knew i meant that just re-iterating)

Actually i have an idea...

so with how it works it sets something to the switches settings prior (So if it was off its off being "oldShinySwitchStatus" then changes the switch back in that time) what if, when a shiny appears, from normal or smth a overworld spawns (or with how normal ones work it causes both) and before it can set the switch back, oldShinySwitchStatus is rewritten for the new encounter as true, thus locking it?

if that is the case; could have a specific switch/metadata trigger for overworlds for this shiny toggle over the wild switch? (like Metadata.ShinyStatus (ofc not right call but for simplicity) = $game_switches[SHINY_WILD_POKEMON_SWITCH], then change were it references the switch to the metadata?)
 
Last edited:
right yea, since it happened only to players and not me not got that much info, but
player got a normal encounter, that was shiny, caught it, then every pokemon after (Even not from encounters and event ones) was shiny, which included overworlds, iirc is if i recall correctly, because the other person never said if the overworlds got them, but the first incident did. could it be catching a shiny doesnt turn of the flag? i dont know as i have people going just for shinies and this bug doesnt occur, and i see shinies when testing but never get locked.

again only feel its this script as nothing else mentions "SHINY_WILD_POKEMON_SWITCH" or switch 31 (the actual switch) minus this and in settings and encounter modifiers where it makes them shiny. the trigger could even be set by the pokemon before that but im not sure (e.g. a seemingly normal encounter somehow triggered it) but that feels a bit far fetched.

if i could recreate the bug for you then i could do more testing but.
its the actual switch being locked on causing shinies (i assume you knew i meant that just re-iterating)

Actually i have an idea...

so with how it works it sets something to the switches settings prior (So if it was off its off being "oldShinySwitchStatus" then changes the switch back in that time) what if, when a shiny appears, from normal or smth a overworld spawns (or with how normal ones work it causes both) and before it can set the switch back, oldShinySwitchStatus is rewritten for the new encounter as true, thus locking it?

if that is the case; could have a specific switch/metadata trigger for overworlds for this shiny toggle over the wild switch? (like Metadata.ShinyStatus (ofc not right call but for simplicity) = $game_switches[SHINY_WILD_POKEMON_SWITCH], then change were it references the switch to the metadata?)

I looked at the code of version 2.0.1 for Pokemon Essentials v17.2 and I found out that the code with the shiny-switch is redundant. I commented it out and the shiny hunting should work as before. In the best situation, the lock on is also gone. But I can't be sure since I don't know exactly where it came from.

I will keep the version number 2.0.1 for the script for PEv17.2 but infact the code in the main post is updated. Give it a try. Hopefully the issue is gone.
 
Last edited:
I looked at the code of version 2.0.1 for Pokemon Essentials v17.2 and I found out that the code with the shiny-switch is redundant. I commented it out and the shiny hunting should work as before. In the best situation, the lock on is also gone. But I can't be sure since I don't know exactly where it came from.

I will keep the version number 2.0.1 for the script for PEv17.2 but infact the code in the main post ist updated. Give it a try. Hopefully the issue is gone.

okay yea made mine match the v2.0.1 version (but with the additions still) i'll keep an eye if more cases appear ty for the help again
 
I have installed it was in v18.1 but there is no overworld encounter in water only on the land can you fix it I installed aromatic spawn script
 
I have installed it was in v18.1 but there is no overworld encounter in water only on the land can you fix it I installed aromatic spawn script

Thank you for reporting. I included a bug fix for that issue in the visible overworld wild encounter script and updated it to version 2.0.5.
You can either install the new updated version 2.0.5.
Or you can simply add the following line
Code:
  return [x,y] if PBTerrain.isWater?($game_map.terrain_tag(x,y))
right above the this line
Code:
  # check if tile is passable
in your current visible overworld wild encounter script.
 
Hi!
This is an amazing script that we are using in our game "Pokémon Edición Celestial" with credits for you, of course. But we have a problem that we cannot solve.
It is with the tile priority of the spawned events of Pokémon. As you see in the image, they are above the tree.
We are using Essentials 16.2 and version 1.6 of this script, so maybe this bug is resolved in a newest version. If this is so, could you tell me how to solve it?
Thank you so much!

[PokeCommunity.com] Visible Overworld Wild Encounter


[PokeCommunity.com] Visible Overworld Wild Encounter
 
Last edited:
Hi!
This is an amazing script that we are using in our game "Pokémon Edición Celestial" with credits for you, of course. But we have a problem that we cannot solve.
It is with the tile priority of the spawned events of Pokémon. As you see in the image, they are above the tree.
We are using Essentials 16.2 and version 1.6 of this script, so maybe this bug is resolved in a newest version. If this is so, could you tell me how to solve it?
Thank you so much!
There are definitely errors in script version 1.6 that have been removed in later versions. So it is recommanded to use visible overworld wild encounter script version 1.11.2 for Pokemon Essentials 16.2. Updating to that version should be unproblematic, simply replace the old code by the new one.
However, I don't know if this would remove your issue mentioned above. I only have PEv17.2 and higher and your mentioned error does not occure in that versions. It could be possible that it is not an error with the script but with the outdated Pokemon Essentials Version 16.2. Definitely, there are problems in PEv16.2 with the layers. For instance the fog layers are also below the overworld encounters. This issue was already discussed earlier in this thread and it is an issue coming from Pokemon Essentials v16.2 and not from this overworld encounter script. That error was solved with the update of Pokemon Essentials to version 17+.

Here are some ideas to face the problem.
1) Check if ordinary placed events on the same tile as the tree are also always displayed above the tree. If so, then the error definitely comes from an error during the map construction or from an error in Pokemon Essentials.
2) Check the priority tag of the trees in the tileset tap of the database editor (F9). It should have priority *1 or *2 or *3 but not 0. Maybe, increasing that priority value can solve the problem.
3) Try to update to visible overworld wild encounter script version 1.11.2. This should be done anyway, since the game could crash after fainting against an overworld encounter in version 1.6.
4) Try to update Pokemon Essentials. But this could be a tough task. This could lead to a lot of incompatibility problems with your other scripts. So maybe, it suffices to update only the parts of Pokemon Essentials that handle the layers. You can find some hints on how to attack that in the fog layer posts in this thread.

I hope this helps.
Ach, and make sure to also give credits to ARCHYTHEARC. There would be no overworld encounter script for PEv16.2 without ARCHYTHEARC.
 
Last edited:
That's awesome!!! I haven't tried it yet, but it works for Roaming encounters like Entei, Raikou and Suicune on Pokémon Gold/Silver too?
 
That's awesome!!! I haven't tried it yet, but it works for Roaming encounters like Entei, Raikou and Suicune on Pokémon Gold/Silver too?
If I mention correctly, then Pokemon Gold/Silver is based on an old Pokemon Essentials Version. So It could be possible that the visible overworld wild encounters scripts for Pokemon Essentials version 16.2 or 17.2 will work in Pokemon Gold/Silver, inclusive roaming encounters. Just give it a try and let us know if it works.
 
Back
Top