• 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

The script is wonderful, but 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?
 
The script is wonderful, but 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?

See this quote
My first idea to stop spawning during dialogues would be to set the pause flag to true
Code:
$game_temp.in_menu = true
in the first command of the event (and back to false in the last command of the event). This is definitely not a final solution. But even if there is no spawning during dialogues then there still could be such softlocking produced by overworld encounters that spawned before the dialogue started. So it will be still important to keep an eye on the map design (for example not to small places) as it is also always important if there are other NPCs on the map.
 
My first idea to stop spawning during dialogues would be to set the pause flag to true
Thank you for the suggestion. I didn't know about the pause flag, but setting it to true also causes the "set move route" actions in the event to be blocked. I have solved it instead by giving them the "Through ON" command as they go past both encounters and moving trainers.
 
* Visible Overworld Wild Encounters Version 19.0.10 for PEv19.1 - by derFischae and TrankerGolD (Credits if used please) *

UPDATED TO VERSION 19.0.10 FOR POKEMON ESSENTIALS V19.1 BY TrankerGolD. This script is for Pokémon Essentials v19 and v19.1 (for short PEv19).

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.

Seems like everything works well but for any error TrankerGolD will try and take a look.

FEATURES
INCLUDED for PEv19 by TrankerGolD:
  • You can manage different appear animations in pbPlaceEncounter depending on encounter type
  • Choose whether you can battle water pokemon while not surfing or not with BATTLE_WATER_ONGROUND
  • Stop more PokeEvent from spawning with the MAX_SPAWN parameter
  • 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
  • In water pokemon won't spawn above other tiles, which made them stuck or walk on ground
  • Shiny animation while PokeEvent is visible on screen
  • Remove by time chronometer with REMOVE_PROLONGED
  • Use your own chance in VISIBLE_ENCOUNTER_PROBABILITY
IDEAS for PEv19:
  • don't keep events when saving and quiting the game (Currently, there is no need for this)
  • plugin script format?
  • more in the future?
UPSCALED FEATURES INCLUDED from PEv18:
  • 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
  • you can have instant wild battle and overworld spawning at the same time and set the propability of that by default and change it ingame and store it with a $game_variable
  • In caves, pokemon don't spawn on impassable Rock-Tiles, which have the Tile-ID 4
  • You can check during the events @@OnWildPokemonCreate, @@OnStartBattle, ... if you are battling a spawned pokemon with the global variable $PokemonGlobal.battlingSpawnedPokemon
  • You can check during the event @@OnWildPokemonCreate 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 @@OnWildPokemonCreateForSpawning.

INSTALLATION
Installation as simple as it can be.
  1. Get the resources from Gen 8 Project (broken link removed)
    You only need to install the "Graphic/Character" folder in your game file system.
  2. Insert new line in scripts above Main and name it "Overworld_VisibleEncounters", then copy and paste the code below inside.
  3. Enjoy!
Notes:
  • If you want to use fakemon, then you have to organize the corresponding graphics similarly as in the Gen 8 Project.
  • Try to install updates, Add-ons or modifications for this script.
  • Create new animation in database and edit animation_id in settings script (line 199),
    (if the id number is bigger than the database number of animations it will crash the game).
  • There are a lot of parameter settings for your personal optimal solution. So, edit parameters in settings to your liking.
  • Some parameter combinations can produce lag, e.g. a high spawning rate without a spawning cap "MAX_SPAWN=0", or e.g. "SEARCH_POSSIBLE_TILE=true" with "REROLLS_POSSIBLE_TILE<=0" (or too high) when having other scripts like Pokemon Following.
  • If you use any other script that triggers on change of direction of the player, then either
    • these scripts have to be below this visible overworld wild encounter script or
    • you have to use the bug fix for OnChangeDirection below.

HERE IS THE CODE OF THE VISIBLE OVERWORLD WILD ENCOUNTER SCRIPT
Spoiler:


THE BUG FIX FOR ONCHANGEDIRECTION
Spoiler:


ADD-ONS AND ADDITIONAL RESOURCES FOR THIS SCRIPT:
  • Remove overworld encounter on load/save and on map transfer
    Spoiler:
  • Animation Resource for water encounters, shinys and aggressive encounters
    Spoiler:
  • instructions on how to have different encounters for overworld spawning and original encountering on the same map - like in Pokemon Sword/Shield
    Spoiler:



ADD-ONS OF THIS SCRIPT FOR VERSION 18.0.8: (Try to test it if it is compatible with version 19+.) In the post https://www.pokecommunity.com/threads/429019 under script version 18.0.8, you will find add-ons, including

MODIFICATIONS OF THIS SCRIPT FOR PEv17.2: There are various modifications of this script for Pokemon Essentials v17.2. at https://www.pokecommunity.com/posts/10202528 , including
  • adding shiny sparkle animation to spawned overworld shinys, especially useful if you want to sign out the shiny encounters on the map without using overworld shiny sprites
  • removing grass rustle animation on water and in caves
  • instructions on how to change the movement of the overworld encounter
  • "aggressive encounters" only get aggressive when you are 2 tiles away from them, and not before
  • forbidding pokemon to spawn on specific terrain tiles in caves
  • adding new encounter types, eg. desert, shallow water
  • error solutions
But I don't know jet, which one still work with Pokemon Essentials v19.1. And probably there are some bugs due to the update to PEv19.1. Feel free to test it with PEv19.1 and to post your bugs.

CHANGELOG
Spoiler:
 
Last edited:
Maybe I'm to stupid to find it, but is there an option to change the probability of the overworld encounter? At the moment at almost every step I take, a Pokémon is appearing.
 
There seems to be an issue with the v19.1 version. There are an awful lot of Pokémon spawning at a very high rate, no matter how high or low the step value is. I didn't have that issue in the v18 version.
 
There seems to be an issue with the v19.1 version. There are an awful lot of Pokémon spawning at a very high rate, no matter how high or low the step value is. I didn't have that issue in the v18 version.


I have this same problem, could anybody explain where to set the spawning rate for the overworld encounters?

Is it related to the rate encounters of each map?
Even if I set it to low values such as
5 or 10% the Pokémon spawn at a high rate.
 
My bad, this line of code sould be used in v19.1:
Code:
return if !$PokemonEncounters.encounter_triggered?(encounterType, repel)

Inside pbChooseEncounter, under this line:
Code:
return if !$PokemonEncounters.encounter_possible_here_on_tile?(x,y)

This will use the encounters chance saved in encounters.txt and will check if the first pokemon has a certain Item or Ability,
also holding Control in Debug mode will prevent from spawning pokemon

I've been working on an update that will have more parameter/features, and some problems including that one will be already fixed.
 
My bad, this line of code sould be used in v19.1:
Code:
return if !$PokemonEncounters.encounter_triggered?(encounterType, repel)

Inside pbChooseEncounter, under this line:
Code:
return if !$PokemonEncounters.encounter_possible_here_on_tile?(x,y)

This will use the encounters chance saved in encounters.txt and will check if the first pokemon has a certain Item or Ability,
also holding Control in Debug mode will prevent from spawning pokemon

I've been working on an update that will have more parameter/features, and some problems including that one will be already fixed.

Works perfectly! Thanks a lot and great job!
 
My bad, this line of code sould be used in v19.1:
Code:
return if !$PokemonEncounters.encounter_triggered?(encounterType, repel)

Inside pbChooseEncounter, under this line:
Code:
return if !$PokemonEncounters.encounter_possible_here_on_tile?(x,y)

This will use the encounters chance saved in encounters.txt and will check if the first pokemon has a certain Item or Ability,
also holding Control in Debug mode will prevent from spawning pokemon

I've been working on an update that will have more parameter/features, and some problems including that one will be already fixed.

Thanks! It works perfectly now. And thank you for the update to v19.1.


Now I have another problem. Once in a while there is a problem with trainer battles. If I start one then this massage is appearing:
Spoiler:


When I'm deleting the script, all trainer battles working as intented.
I hope you can help.
 
Thanks! It works perfectly now. And thank you for the update to v19.1.

Now I have another problem. Once in a while there is a problem with trainer battles. If I start one then this massage is appearing:
Spoiler:


When I'm deleting the script, all trainer battles working as intented.
I hope you can help.

Perhaps your issue was already discussed. Probably it appears when restarting the testplay by pressing F12 without closing the last game. Here I quote the solution for you for a previous version of the script. So perhaps you have to update the code snippets below for PE V19.1.

The method "original_increase_steps" links to the already defined method "increase_steps". This method is not defined in the visible overworld wild encounter script. It is defined in Pokemon Essentials or could be overwritten by any other script you installed. If you use f12 without closing the test window, then the game memory will not be cleared. This leads to the problem that the method "original_increase_steps" does not link to the original method "increase_steps" anymore, but to the later defined method "increase_steps" in the visible overworld wild encounter script. This behaviour leads to the stack overflow after using f12 without closing the window and, by the way, can occure in any arbitrary script which uses the "alias" command. That's why I do not recommand to use f12 without closing the window.

However, if you want to continue with your workflow and use f12, then you can do so by modifying the code in the following way:
Go find the following code in the visible overworld wild encounter script (it is the snippet where your errors occure)
Code:
  alias original_increase_steps increase_steps
  def increase_steps
    if self.name=="vanishingEncounter" && @stepCount && @stepCount>=STEPSBEFOREVANISHING
      removeThisEventfromMap
    else
      @stepCount=0 if (!@stepCount || @stepCount<0)
      @stepCount+=1
      original_increase_steps
    end
  end
and replace it by
Code:
def increase_steps
    if self.name=="vanishingEncounter" && @stepCount && @stepCount>=STEPSBEFOREVANISHING
      removeThisEventfromMap
    else
      @stepCount=0 if (!@stepCount || @stepCount<0)
      @stepCount+=1
      @stop_count = 0
      triggerLeaveTile()
    end
  end
It will work, I tested it. However, if you use any other script that overwrites the Method "increase_steps" of Class "Game_Character" in Script section "Game_Character", then this new code above will neglect that changes of that other script and could lead to compatibly problems. The original code above will not due to the alias command.

You're welcome.
 
For some extra, in v19.1 I think that this line:
Code:
$PokemonTemp.encounterType = -1
Should be replaced with:
Code:
$PokemonTemp.encounterType = nil

Also maybe compile all data holding control when starting play test.
 
How come you missed this?:
Spoiler:


Easy enough fix: add "VisibleEncounterSettings::" before "USEFEMALESPRITES" and "USEALTFORMS" in "pbDoubleWildBattle".

Also sometimes this happens and I'm not sure why:
Spoiler:

Something to do with the deep bushes or its trying to spawn outside of my map borders but I wasn't having crashes before adding the script... Maybe I did something wrong on my map? (I'm still learning)
Here's a screenshot of my test map just in case:
 

Attachments

  • [PokeCommunity.com] Visible Overworld Wild Encounter
    testmap.png
    15.3 KB · Views: 14
Back
Top