• 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

  • 308
    Posts
    4
    Years
    So i just copy the script and i don't need anything else?
    Well, you need to install an overworld-sprite-package for your pokemon or fakemon and name that images correctly. But after that, this script is just drag and drop. All Add-Ons and modifications are just bonus.
     
    Last edited:
  • 308
    Posts
    4
    Years
    * Visible Overworld Wild Encounters Version 1.6 - by derFischae (Credits if used please) *

    DOWNSCALE OF VERSION 1.6 FOR POKEMON ESSENTIALS V16.2 BY ARCHYTHEARC. This script is for Pokémon Essentials V16.2. Originally written for V17 and V17.2 by me and 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
    • In caves, pokemon don't spawn on impassable Rock-Tiles, which have the Tile-ID 4
    • 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
    • choose whether pokemon spawn automatically or only while moving the player
    • Vendilys Rescue Chain, see https://www.pokecommunity.com/showthread.php?t=415524 for original script
    • 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.
    • You can check if you are battleing a spawned pokemon with the global variable $PokemonGlobal.battlingSpawnedPokemon

    INSTALLATION: It is as simple as it can be.
    1. You need sprites for the overworld pokemon in your \Graphics\Characters folder named by there number 001.png, 002.png, ..., For instance you can use Gen 1-7 OV SPrites or whatever you want for your fakemon.
      If you want to use shiny overworld sprites for shiny encounters, then make sure to also have the corresponding shiny versions in your \Graphics\Characters folder named by 001s.png, 002s.png, ....
      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, ...
      Please note that Scatterbug has 18 alternative forms in Pokemon Essentials. But you will only see one form depending on your trainerID. So, you also have to include 664_1.png, ..., 664_19.png and 664s_1.png, ..., 664s_19.png. Same needs to be done for Pokemon Spewpa with number 665 and Vivillon with number 666.
      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)
    2. Insert a new file in the script editor above main, name it Overworld_Encounters and copy this code into it.
    3. Set the properties for your pleasure in the properties section of the script. Most of you don't need to change anything.
    4. If you want then you can install modifications for the script from below.
    5. If you want then you can also install the script always in bush and in water to obtain that the overworld encounter don't stand on water anymore but sink in. You can find it at https://www.pokecommunity.com/showthread.php?p=10109060

    * Version 1.6 for Pokemon Essentials V16.2. THANKS to ArchyTheArc for downscaling *
    Spoiler:


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


    Or maybe you also need this bug fix for pokemon essentials version 16.2 if you get a disposed sprite error message
    Spoiler:


    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 overworld sprite of an shiny encounter is always the standard sprite or is the corrensponding shiny overworld sprite in parameter
      USESHINYSPRITES
    5. You can choose whether the sprite of your overworld encounter is always the standard form or can be an alternative form in parameter
      USEALTFORMS
    6. You can choose whether the sprites depend on the gender of the encounter or are always neutral in parameter
      USEFEMALESPRITES
    7. You can choose whether the overworld encounters have a stop/ step-animation similar to following pokemon in the parameter
      USESTOPANIMATION
    8. You can choose how many overworld encounters are agressive and run to the player in the parameter
      AGGRESSIVEENCOUNTERPROBABILITY
    9. You can choose the move-speed and move-frequenzy of normal and aggressive encounters in parameters
      ENCMOVESPEED, ENCMOVEFREQ, AGGRENCMOVESPEED, AGGRENCMOVEFREQ
    10. 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
    11. You can activate or deactivate vendilys rescue chain in the parameter
      USERESCUECHAIN
      Moreover, you also have all settings of vendilys Rescue chain here.
    12. If you have impassable tiles in a cave, where you don't want pokemon to spawn there. Then choose the Tile-ID 4 for that tile in the tile-editor.

    MODIFICATIONS OF THIS SCRIPT: These modifications are tested with Pokemon Essentials 17.2. but should also work with version 16.2. Read the whole thread https://www.pokecommunity.com/showthread.php?t=429019 for more features and modifications, including
    • randomized spawning
      Spoiler:
    • 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
      Spoiler:
    • removing grass rustle animation on water and in caves
      Spoiler:
    • how to change the movement of the overworld encounter
      Spoiler:
    • "aggressive encounters" only get aggressive when you are 2 tiles away from them, and not before.
      Spoiler:
    • activating and deactivating overworld encounter spawning with switches
      Spoiler:
    • overworld spawning and original encounters at the same time
      Spoiler:
    • forbidding pokemons to spawn on specific terrain tiles in caves
      Spoiler:
    • adding new encounter types, eg. desert, shallow water
      Spoiler:
    • instructions on how to have different encounters for overworld spawning and original encountering on the same map
      Spoiler:
    • error solutions

    CHANGELOG
    Spoiler:
     
    Last edited:
  • 308
    Posts
    4
    Years
    You might have to check your code a bit, cause I am sometimes can still get default random encounters.

    Here is a video of it:
    View attachment 93875

    Edit: I am using V18 btw

    Maybe this is only because of the settings in your script.

    What is your value of the variable INSTANT_WILD_BATTLE_PROPABILITY in the settings section of your script? Is it 0 or higher?
    Have you changed the index of the game variable OVERWORLD_ENCOUNTER_VARIABLE=26 or do other scripts of your game use the same variable?
    And what is the value of your $game_variable OVERWORLD_ENCOUNTER_VARIABLE during game? Is it -1 or higher?
     

    DarrylBD99

    Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    Maybe this is only because of the settings in your script.

    What is your value of the variable INSTANT_WILD_BATTLE_PROPABILITY in the settings section of your script? Is it 0 or higher?
    Have you changed the index of the game variable OVERWORLD_ENCOUNTER_VARIABLE=26 or do other scripts of your game use the same variable?
    And what is the value of your $game_variable OVERWORLD_ENCOUNTER_VARIABLE during game? Is it -1 or higher?

    1. My INSTANT_WILD_BATTLE_PROPABILITY is 0
    2. I have only changed the OVERWORLD_ENCOUNTER_VARIABLE to prevent any clashes with other stuff that I have in my game
    3. my OVERWORLD_ENCOUNTER_VARIABLE stores the value 14

    Edit: I even tried turning off RESTRICTENCOUNTERSTOPLAYERMOVEMENT, but it still doesn't work
     
    Last edited:
  • 308
    Posts
    4
    Years
    1. My INSTANT_WILD_BATTLE_PROPABILITY is 0
    2. I have only changed the OVERWORLD_ENCOUNTER_VARIABLE to prevent any clashes with other stuff that I have in my game
    3. my OVERWORLD_ENCOUNTER_VARIABLE stores the value 14

    Edit: I even tried turning off RESTRICTENCOUNTERSTOPLAYERMOVEMENT, but it still doesn't work

    The issue has nothing to do with RESTRICTENCOUNTERSTOPLAYERMOVEMENT. It is for water overworld encounters while moving on land and vice versa.
    The issue comes from the OVERWORLD_ENCOUNTER_VARIABLE and how it is used.

    A Game Variable in Pokemon Essentials contains 2 informations, its number and its value.
    As discribed in the essentials wiki, the game variables 1 to 25 are already used or reserved for pokemon essentials. Maybe, Pokemon Essentials v18 uses the game variable number 14 now, which previous versions didn't. Thus it is recommanded to use a number larger or equal to 26 for the game variable OVERWORLD_ENCOUNTER_VARIABLE, for example
    Code:
    OVERWORLD_ENCOUNTER_VARIABLE = 26

    The value of a game variable can be anything and the value can be changed during game.
    If you want to read out the value of the, let's say, game variable number 26 then you can place a new event on the map and add a new "show text.." event command with the following text
    Code:
    The value of the game variable number 26 is \v[26]
    Triggering the event during playtime will give you the answer.
    For the game variable OVERWORLD_ENCOUNTER_VARIABLE, the value stores the probability of encountering a normal encounter in percent. So, if you don't want normal encounters in your game, then the value should be -1 and not 14%. To reset that value to your INSTANT_WILD_BATTLE_PROPABILITY of 0, you can place an event on the map and add a script command containing
    Code:
    $game_variables[26]=0 # maybe you need to use your number for the OVERWORLD_ENCOUNTER_VARIABLE instead of 26
    Alternatively, you can set the value of that game variable to 0 with the event command "control variables...".

    After that the probability stored in the game variable OVERWORLD_ENCOUNTER_VARIABLE is lower than 0. And the normal encounter should not encounter anymore. Let me know, if they still do.
     
    Last edited:

    DarrylBD99

    Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    The issue has nothing to do with RESTRICTENCOUNTERSTOPLAYERMOVEMENT. It is for water overworld encounters while moving on land and vice versa.
    The issue comes from the OVERWORLD_ENCOUNTER_VARIABLE and how it is used.

    A Game Variable in Pokemon Essentials contains 2 informations, its number and its value.
    As discribed in the essentials wiki, the game variables 1 to 25 are already used or reserved for pokemon essentials. Maybe, Pokemon Essentials v18 uses the game variable number 14 now, which previous versions didn't. Thus it is recommanded to use a number larger or equal to 26 for the game variable OVERWORLD_ENCOUNTER_VARIABLE, for example
    Code:
    OVERWORLD_ENCOUNTER_VARIABLE = 26

    The value of a game variable can be anything and the value can be changed during game.
    If you want to read out the value of the, let's say, game variable number 26 then you can place a new event on the map and add a new "show text.." event command with the following text
    Code:
    The value of the game variable number 26 is \v[26]
    Triggering the event during playtime will give you the answer.
    For the game variable OVERWORLD_ENCOUNTER_VARIABLE, the value stores the probability of encountering a normal encounter in percent. So, if you don't want normal encounters in your game, then the value should be -1 and not 14%. To reset that value to your INSTANT_WILD_BATTLE_PROPABILITY of 0, you can place an event on the map and add a script command containing
    Code:
    $game_variables[26]=0 # maybe you need to use your number for the OVERWORLD_ENCOUNTER_VARIABLE instead of 26
    Alternatively, you can set the value of that game variable to 0 with the event command "control variables...".

    After that the probability stored in the game variable OVERWORLD_ENCOUNTER_VARIABLE is lower than 0. And the normal encounter should not encounter anymore. Let me know, if they still do.

    Funny story, I have tried out everything. You may ask, have any success? The answer, no...

    Edit: I event tried auto running "$game_variables[(number in OVERWORLD_ENCOUNTER_VARIABLE)]=-1" with an event and it doesn't even change anything
     
    Last edited:
  • 308
    Posts
    4
    Years
    Funny story, I have tried out everything. You may ask, have any success? The answer, no...

    Edit: I event tried auto running "$game_variables[(number in OVERWORLD_ENCOUNTER_VARIABLE)]=-1" with an event and it doesn't even change anything

    Unfortunately, I cannot reproduce your error, yet.
    How often does this happen? Are the normal encountering pokemon always the same pokemon? Or are they sometimes on the overworld and sometimes normal encounters? For example is it always Pidgey? And have you checked that you have the overworld graphic with the correct name? Maybe Pidgey does not have any graphic in the characters folder, or the name of the graphic is not correct. Then your issue is the following. There is a pokemon which spawns on the overworld without the correct graphic. This pokmon runs as an invisible event on the map. But the grass will rustles where it moves forward. So you could find it.
     

    DarrylBD99

    Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    Unfortunately, I cannot reproduce your error, yet.
    How often does this happen? Are the normal encountering pokemon always the same pokemon? Or are they sometimes on the overworld and sometimes normal encounters? For example is it always Pidgey? And have you checked that you have the overworld graphic with the correct name? Maybe Pidgey does not have any graphic in the characters folder, or the name of the graphic is not correct. Then your issue is the following. There is a pokemon which spawns on the overworld without the correct graphic. This pokmon runs as an invisible event on the map. But the grass will rustles where it moves forward. So you could find it.

    Ok... firstly, I have the correct graphics. Secondly, there is no pattern. Sometimes the normal encounter happens, sometimes the overworld encounter happens. 't They aren't all Pidgeys, it is basically everything in the encounters for the location specified in the pbs. And also, there ane no grass rustles with invisible pokemon.
     
  • 308
    Posts
    4
    Years
    Ok... firstly, I have the correct graphics. Secondly, there is no pattern. Sometimes the normal encounter happens, sometimes the overworld encounter happens. 't They aren't all Pidgeys, it is basically everything in the encounters for the location specified in the pbs. And also, there ane no grass rustles with invisible pokemon.

    Can you do me a favor and place an event on the map and add a "show text.." event command with the following text
    Code:
    The value of the game variable is \v[26]
    But please replace the number 26 by your number of OVERWORLD_ENCOUNTER_VARIABLE in the settings section of your overworld encounter script.
    Please trigger the event during playtime and tell me the output.
     

    DarrylBD99

    Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    Can you do me a favor and place an event on the map and add a "show text.." event command with the following text
    Code:
    The value of the game variable is \v[26]
    But please replace the number 26 by your number of OVERWORLD_ENCOUNTER_VARIABLE in the settings section of your overworld encounter script.
    Please trigger the event during playtime and tell me the output.

    So just FYI, I set OVERWORLD_ENCOUNTER_VARIABLE to 33 cause my game already has 26-32 used for other stuff
    Visible Overworld Wild Encounter
    This is the event that checks the value inside Variable 33
    Visible Overworld Wild Encounter
    And this is how I initially set variable 33 to -1 it without a background event
    Visible Overworld Wild Encounter
    Now firstly, is there anything wrong with this setup that I should change?
     

    DarrylBD99

    Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    If there is nothing wrong, then here is the results I got...
    View attachment 2020-10-23 13-54-44.mp4

    as you can see, the overworld encounter can still spawn and you can encounter them. However, the variable hasn't changed one bit and yet I am still getting this normal encounter. But what is weirder is that after the normal encounter, my character goes forward one tile without me even pressing that key.
     
  • 308
    Posts
    4
    Years
    If there is nothing wrong, then here is the results I got...
    View attachment 93952

    as you can see, the overworld encounter can still spawn and you can encounter them. However, the variable hasn't changed one bit and yet I am still getting this normal encounter. But what is weirder is that after the normal encounter, my character goes forward one tile without me even pressing that key.

    Everything looks alright.

    In the screenshot, I have seen that you are also using the automatic spawning add-on for overworld encounters. I have updated that code some time ago. Do you have the latest version of that add-on? It should be this
    Spoiler:

    I tested everything with the latest version 2.0.2 of the overworld encounter script for PEv18.0 and with the latest version of automated spawning. Amd everything worked fine.

    You are also using a lot of user scripts. Maybe there is a script that forces this behavior due to incompatibility. Can you search (strg+F) for "pbBattleOnStepTaken" and "pbOnStepTaken" in these scripts. Maybe we find something. Then we can look up that scripts in detail.
    Are there any scripts using the method "pbBattleOnStepTaken" or overriding the method "pbOnStepTaken"?

    Edit: But, actually, I cannot understand why your player moves without input after battling a normal encounter.
     
    Last edited:

    DarrylBD99

    Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    I tested everything with the latest version 2.0.2 of the overworld encounter script for PEv18.0 and with the latest version of automated spawning.

    Why did yoi specifically say PE18.0... wait time out... are you saying you haven't tested it for PE18.1?
     
  • 308
    Posts
    4
    Years
    Why did yoi specifically say PE18.0... wait time out... are you saying you haven't tested it for PE18.1?

    I tested it for V18 since you said it here.
    Edit: I am using V18 btw

    But I understand your question that you're using PE V18.1 now, don't you?
    Edit: Now I can reproduce your error with PE V18.1. I will need some time to check what changes in V18.1 create the incompatibility.
     
    Last edited:
  • 308
    Posts
    4
    Years
    You might have to check your code a bit, cause I am sometimes can still get default random encounters.

    Here is a video of it:
    View attachment 93875

    Edit: I am using V18.1 [version edited] btw

    In Pokemon Essentials V18.1, it was introduced that normal wild encounter can encounter on turning the direction of your player. These encounters are always normal encounters. So, if you want don't want these normal encounters then you have multiple ways to remove or correct that.

    Open the script editor and go to the script section "PField_Field". Search for the following code snippet
    Code:
    # Start wild encounters while turning on the spot
    Events.onChangeDirection += proc {
      repel = ($PokemonGlobal.repel>0)
      pbBattleOnStepTaken(repel) if !$game_temp.in_menu
    }
    and
    • simply remove it to remove that pokemon can encounter on changing the direction of your player, or
    • replace it by this code snippet
      Spoiler:

      to replace normal wild encountering during direction changing by overworld/mixed encountering.
     

    DarrylBD99

    Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    In Pokemon Essentials V18.1, it was introduced that normal wild encounter can encounter on turning the direction of your player. These encounters are always normal encounters. So, if you want don't want these normal encounters then you have multiple ways to remove or correct that.

    Open the script editor and go to the script section "PField_Field". Search for the following code snippet
    Code:
    # Start wild encounters while turning on the spot
    Events.onChangeDirection += proc {
      repel = ($PokemonGlobal.repel>0)
      pbBattleOnStepTaken(repel) if !$game_temp.in_menu
    }
    and
    • simply remove it to remove that pokemon can encounter on changing the direction of your player, or
    • replace it by this code snippet
      Spoiler:

      to replace normal wild encountering during direction changing by overworld/mixed encountering.

    Thanks, and sorry for not being specific enough...
     
  • 465
    Posts
    7
    Years
    • Seen Jun 1, 2024
    Me Again, Scripts looking great, i've moved upto v17.2 myself now (took a bit xP) just due to the v18 update so im still kinda current times (and can backport an update for some people)

    I've moved to the v17.2 script, and definetly much cleaner than the v16.2 one xP My one question is, v16 version has a shiny chance for the script itself, does the v17+ modify or have its own shiny chance? (with v16 there was an obsurd amount of shinies (with my chances) and its a bit better in v17 but still feels common (like people have seen back to back shinies, whiles its 1/2k its still should be uncommon) if not, that lets me know its a me issue ^^
     
  • 308
    Posts
    4
    Years
    Me Again, Scripts looking great, i've moved upto v17.2 myself now (took a bit xP) just due to the v18 update so im still kinda current times (and can backport an update for some people)

    I've moved to the v17.2 script, and definetly much cleaner than the v16.2 one xP My one question is, v16 version has a shiny chance for the script itself, does the v17+ modify or have its own shiny chance? (with v16 there was an obsurd amount of shinies (with my chances) and its a bit better in v17 but still feels common (like people have seen back to back shinies, whiles its 1/2k its still should be uncommon) if not, that lets me know its a me issue ^^

    The integrated shiny chance in version 1.11.2 for PEv16.2 is now redesigned as an add-on named
    "Simple Let's go shiny hunting by chaining a pokemon, inspired by Diego Mertens script"

    To reduce the shiny spawning, you can change the values of
    Code:
    CHAINLENGTH      = 1 # default 10
    SHINYPROBABILITY = 10
    in the settings of that add-on. The higher the values the lower the shiny spawning.

    Up to now, there are no new features in v2.0.2 for PEv18 compared to v2.0.1 for PEv17.2. I just made the features in v2.0.1 compatible with v18. However, they work slightly different. Hence, the new version number 2.0.2.
     
  • 308
    Posts
    4
    Years
    If you want to change the movement of your overworld pokemon, then you can do this.

    In method "spawnEvent(x,y,encounter,gender = nil,form = nil, isShiny = nil)", find the following code snippet
    Code:
    # we configure the movement of the overworld encounter
        if rand(100) < AGGRESSIVEENCOUNTERPROBABILITY
          event.pages[0].move_type = 3
          event.pages[0].move_speed = AGGRENCMOVESPEED
          event.pages[0].move_frequency = AGGRENCMOVEFREQ
          event.pages[0].move_route.list[0].code = 10
          event.pages[0].move_route.list[1] = RPG::MoveCommand.new
        else
          event.pages[0].move_type = 1
          event.pages[0].move_speed = ENCMOVESPEED
          event.pages[0].move_frequency = ENCMOVEFREQ
        end
        event.pages[0].step_anime = true if USESTOPANIMATION
        event.pages[0].trigger = 2
    You can change this code according to your needs.

    I recommand to read the instructions in
    https://forums.rpgmakerweb.com/index.php?threads/creating-a-move-route-with-a-script-command.59367/
    or
    https://forums.rpgmakerweb.com/index.php?threads/creating-a-move-route-via-script-call.87467/
    These instructions are not complete and are for RPGMakerVX. However, they explain how rpgMaker uses Moveroutes in the script section.

    As an example, if you want (who knows why) that your overworld pokemon should
    look left -> jump to the right -> look left -> jump to the right -> and so on,
    then this can be done by the following code snippet
    Code:
        event.pages[0].move_type = 3 # means that we have a custom move_route
        event.pages[0].move_route.repeat = true # the pokemon repeats the route
        event.pages[0].move_route.list = []
        event.pages[0].move_route.list.push(RPG::MoveCommand.new(17,[])) # 1st command: look left, no parameters needed
        event.pages[0].move_route.list.push(RPG::MoveCommand.new(14,[1,0])) # 2nd command: jump, needs 2 parameters for x and y direction: jump to the right has parameter [1,0] 
        event.pages[0].move_route.list.push(RPG::MoveCommand.new) # always end with an empty MoveCommand
     
    Back
    Top