• 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
    Following on from my last post, I think the stack overflow thing I was getting was fixed with a simple reinstall. This time I come with a slight oversight you may not have thought of: cave encounters. From what I'm seeing, they can spawn on impassable tiles (such as the black tile used to surround maps)

    In caves, the overworld encounter script allready checks for impassable rock tiles. These have the tile-ID 4. If you want to use the black tile or your own selfmade tiles in a cave map which are impassable, then you can give them the tile-ID 4 to make sure that no pokemon can spawn there.
     
  • 308
    Posts
    4
    Years
    It works no matter what restrictions there are when it comes to Kantonian Rattata, but it never works for Alolan Rattata (even if I make it available on that route for both day and night).

    Just to make sure:
    Chaining Kantonian Rattata --> Kantonian Raticate spawns, Alolan Raticate don't spawn
    Chaining Alolan Rattata --> Kantonian and Alolan Raticate don't spawn.

    Right?
     
  • 5
    Posts
    4
    Years
    • Seen Jul 8, 2021
    The error message is not enough to help you. Which Pokemon Essentials Version do you use: v16.2, v17.2 or a completely different version? I would guess that you don't have the latestversion of Pokemon essentials. And which version of the overworld encounter script have you installed: Version 1.9.1 for PE v17.2 or Version 1.6 for PEv16.2? And when did the error message occure?


    I have Version 16.2 the error came out when
     
  • 308
    Posts
    4
    Years
    I have Version 16.2 the error came out when

    It seems that your Pokemon Essentials version does not support waterfalls completely.

    Please go to module "PBTerrain" in the script "PBTerrain" and post the whole code of that module here. In your next post, please write "[ C O D E ]" above that code and "[ / C O D E ]" below that code to garanty that the code is written in a code environement such as

    Code:
    module PBTerrain
      def PBTerrain.isWaterfall?(tag)
        you don't have this method yet :(
      end
    end
     
  • 308
    Posts
    4
    Years

    Thank you for your testing and your informations. I found some errors in the code. It should work the suggested way now. This means that, first of all, you don't have to chain a specific form. It suffices to chain arbitrary forms of pokemon of the same pokemon family. Furthermore, if the rescuechain is active then the evolved pokemon can get any form which is allowed by the spawning conditions. For example alolan Raticate can only spawn at night.

    I have tested it and it worked with the following modifications. (Alternatively, you can simply copy the updated version 1.9.2 of this visible overworld wild encounter script in the first post of this thread.) At first, replace the old code of method "Events.onWildBattleEnd+=proc{|sender,e|" at the end of the overworld encounter script by the following code:

    Spoiler:


    And after that replace the old code of the method "pbChooseEncounter(x,y,repel=false)" by the following new code:

    Spoiler:
     
    Last edited:
  • 59
    Posts
    7
    Years
    • Seen Apr 20, 2024
    Hey, how do i add encounter types as they appear only on their area?
    Example, i tried to manually add the Shallow Water new encounter method i added before this script, but either nothing appear or the Shallow Water encounters appear on the whole map instead of the terrain with the shallow water.
     
  • 308
    Posts
    4
    Years
    I have Version 16.2 the error came out when

    It seems that your Pokemon Essentials version does not support waterfalls completely.

    To remove this compatibility error you have to add the following code:
    Code:
    module PBTerrain
      Waterfall       = 8
      WaterfallCrest  = 9
    
      def PBTerrain.isWaterfall?(tag)
        return tag==PBTerrain::WaterfallCrest ||
               tag==PBTerrain::Waterfall
      end
    end
    It's recommanded to include the tags "Waterfall = 8" and "WaterfallCrest = 9" and the whole method "PBTerrain.isWaterfall?(tag)" in the already existing module "PBTerrain", which you can find in the script section "PBTerrain". But anyway, it's also fine to simply copy the code above and paste it at the end of the visible overworld encounter script.
     
  • 308
    Posts
    4
    Years
    Hey, how do i add encounter types as they appear only on their area?
    Example, i tried to manually add the Shallow Water new encounter method i added before this script, but either nothing appear or the Shallow Water encounters appear on the whole map instead of the terrain with the shallow water.

    It is allready implemented for surfing encounters and grass encounters. Both types spawn only on their tiles. You can try to use this way to include it for your shallow water encounter method. But without knowing how you coded your shallow water encounter method no concrete tips can be given. Do you have a link to your script code, here on Pokecommunity, or can you post your code?
     
  • 59
    Posts
    7
    Years
    • Seen Apr 20, 2024
    It is allready implemented for surfing encounters and grass encounters. Both types spawn only on their tiles. You can try to use this way to include it for your shallow water encounter method. But without knowing how you coded your shallow water encounter method no concrete tips can be given. Do you have a link to your script code, here on Pokecommunity, or can you post your code?

    i scripted normally using Thundaga's tutorial of adding encounters and it works just fine in game as seen in the spoiler

    Spoiler:


    however it doesn't work as surf, it is like BW/BW2 as you step on the shallow water normally and encounters happen. I tried to see if i could put you script with this as, grass = land encounter (Land Pokemon spawn on grass) and shallowwater = water pokemon on land, but only on the ShallowWater tagged tiles and having both Land and SW on the same map. However either didn't worked with no encounter at all or Shallow Water encounter appeared all over the map.

    So i just gave up and deleted altogether.
     
  • 308
    Posts
    4
    Years
    i scripted normally using Thundaga's tutorial of adding encounters and it works just fine in game as seen in the spoiler

    Spoiler:


    however it doesn't work as surf, it is like BW/BW2 as you step on the shallow water normally and encounters happen. I tried to see if i could put you script with this as, grass = land encounter (Land Pokemon spawn on grass) and shallowwater = water pokemon on land, but only on the ShallowWater tagged tiles and having both Land and SW on the same map. However either didn't worked with no encounter at all or Shallow Water encounter appeared all over the map.

    So i just gave up and deleted altogether.

    Okay I understand. By the way, thank you for pointing at Thundaga's Tutorial. I didn't know that there is a standard way of implementing new encounter types. However, there is a way to implement your ShallowWater:

    If you want to have new encounter types and want that some special pokemon only spawn at special tiles, such as a Gurdurr spawns only at the building site, or a special water pokemon in shallow water or groudon only in the dessert..., then you have to follow 2 steps:
    1) Follow Thundaga's Tutorial on adding new encounter types. See https://www.youtube.com/watch?v=kdtofAPuyxA
    This includes all nessessary changes for ordinary encountering. Note that Thundaga added a Desert tile for the new encounter type for his tutorial. We will also use this notation here. If you want to use ShallowWater instead, then make sure to use ShallowWater instead of Desert in the code snippets.

    2) To activate these changes also for overworld spawning you have to search for the method "pbEncounterTypeOnTile(x,y)" and add
    Code:
        elsif PBTerrain.isDesert?($game_map.terrain_tag(x,y))
          return EncounterTypes::Desert
    right below "return EncounterTypes::Water".
    In the following Spoiler sections you can compare the code of "pbEncounterTypeOnTile(x,y)" before and after adding.
    Spoiler:

    And finally find the method "isEncounterPossibleHereOnTile?(x,y)" in the visible overworld wild encounter script and add
    Code:
      elsif PBTerrain.isDesert?($game_map.terrain_tag(x,y))
          return true
    right below "if PBTerrain.isJustWater?($game_map.terrain_tag(x,y)) return true".
    You can compare in the following spoiler section there to put the code.
    Spoiler:


    I haven't test it myself. But it should work. I would be happy to hear if it works.
     
    Last edited:
  • 59
    Posts
    7
    Years
    • Seen Apr 20, 2024
    Spoiler:

    Yup, worked perfectly fine!

    Visible Overworld Wild Encounter
     
  • 4
    Posts
    3
    Years
    • Seen May 27, 2021
    I noticed the pokemon keep moving when the pause menu is displayed. This means they can still walk up to you and initiate a battle.
     
  • 308
    Posts
    4
    Years
    I noticed the pokemon keep moving when the pause menu is displayed. This means they can still walk up to you and initiate a battle.

    This seems to be a general issue of pokemon essentials. You can test it the following way. Place an event on the map, such as a trainer, and let it move randomly. Then, I would guess, this event will have the same behaviour as the spawning encounters while the pause menu is displayed. Maybe there is allready a script for pokemon essential solving this problem. But I'm not sure-
     
  • 7
    Posts
    6
    Years
    • Seen Apr 28, 2022
    I have set the Terrain Tag to 4 in Tileset Editor.
    But in Caves, the Pokemon still spawns on other tiles...
    How can i fix that?
    They should only spawns on the fields that passable.

    Im using Essentials 17.2

    https ://ibb.co/ BnFJNVy delete spaces for image. Im new and cant post Links :/

    EDIT:
    Ok i fixed it by myself.
    I needet to make the tile who the pokemon should NOT spawn Terrain Tag 4 and there they should spawn Terrain Tag 0 :D
    Now with Terrain Tag 0 they spawns on Terrain Tag 0-Tiles and not longer out of map :)

    Next Question:
    Is it possible to play an endless loop of an animation ON the Shiny Pokemon? Like in Lets Go with the stars?
     
    Last edited:

    LuisCris327

    LuisCris
  • 1
    Posts
    3
    Years
    Hello, your script works very well in pokemon essentials 17.2, but I am using pokemon essentials 16.2 for convenience and for another script that I am using that does not work in 17.2, I still have this problem, and I don't know if someone can help me with it. , I was reading and someone else also asked it but in the end I don't know if there is already a solution and it is to this error:


    ---------------------------
    Pokemon Essentials Esp v16.2
    ---------------------------
    Excepción: ArgumentError

    Mensaje: wrong number of arguments(2 for 1)

    OverWorld Encounters:337:in `pbCanEncounter?'

    OverWorld Encounters:337:in `pbChooseEncounter'

    OverWorld Encounters:280:in `pbOnStepTaken'

    Game_Player:484:in `update_old'

    Walk_Run:76:in `update'

    Scene_Map:104:in `update'

    Scene_Map:101:in `loop'

    Scene_Map:114:in `update'

    Scene_Map:68:in `main'

    Scene_Map:65:in `loop'
     
  • 308
    Posts
    4
    Years
    Hello, your script works very well in pokemon essentials 17.2, but I am using pokemon essentials 16.2 for convenience and for another script that I am using that does not work in 17.2, I still have this problem, and I don't know if someone can help me with it. , I was reading and someone else also asked it but in the end I don't know if there is already a solution and it is to this error:


    ---------------------------
    Pokemon Essentials Esp v16.2
    ---------------------------
    Excepción: ArgumentError
    Mensaje: wrong number of arguments(2 for 1)
    OverWorld Encounters:337:in `pbCanEncounter?'
    [...]

    It is recommended to use the downscaled version of the overworld encounter script version 1.6 from ArchyTheArc for Pokemon essentials 16.2. You didn't use this version, right?

    To remove this error message, you have to go to the line 337 in the overworld encounter script. There, you will find the following code.
    Code:
      if !$PokemonEncounters.pbCanEncounter?(encounter,repel)
    The error message says that it is wrong to have two arguments "encounter" and "repel" in the brackets. There should be only one argument.
    Hence, you have to replace the line by
    Code:
      if !$PokemonEncounters.pbCanEncounter?(encounter)
    This error occurs since Pokemon Essential 16.2 supports repels differently to Pokemon Essentials 17.2. Maybe the script works after that correction. But maybe another error arises now. I can't test that, since I don't have Pokemon Essentials 16.2.
    You can decide by yourself if you want to use the allready existing downscaled version 1.6 or if you want to have all new features and bug fixes which came with the newer versions up to version 1.9.2.
    For the latter, you have to downscale the current version 1.9.2 again by your own, beginning with correcting the line 337 as written above. I can't do it by myself since I don't have Pokemon Essentials 16.2. One remark, if you decide to downscale the newest version 1.9.2. then you can always go to the line where the error occurs (above it was 337) and compare this line with the corresponding line in the allready downscaled version 1.6 by ArchyTheArk. This should help enormously. And if you completed the new downscale, then I would be happy, if you publish your version. Then, I can also embed your code in the starting post, such that all other users of Pokemon Essentials 16.2 can find this version immediately.
     
    Last edited:
  • 308
    Posts
    4
    Years
    I have set the Terrain Tag to 4 in Tileset Editor.
    But in Caves, the Pokemon still spawns on other tiles...
    How can i fix that?
    They should only spawns on the fields that passable.

    Im using Essentials 17.2

    https ://ibb.co/ BnFJNVy delete spaces for image. Im new and cant post Links :/

    EDIT:
    Ok i fixed it by myself.
    I needet to make the tile who the pokemon should NOT spawn Terrain Tag 4 and there they should spawn Terrain Tag 0 :D
    Now with Terrain Tag 0 they spawns on Terrain Tag 0-Tiles and not longer out of map :)

    Normally, in caves pokemon can encounter everywhere. But with this visible overworld wild encounter script, this behaviour can let pokemon spawn on impassible tiles. Now, if you want do forbid pokemon to spawn on certain tiles in caves, then you have two options.
    1) The visible overworld encounter script allready forbids spawning on rock tiles, which have the terrain tag 4 in the terrain tag editor. Hence, the first way to forbid spawning on a specific tile is to set the terrain tag of that tile to 4 in the terrain tag editor.
    2) If you want to add new terrain types to the module PBTerrain in script PBTerrain and want to forbid pokemons to spawn there, then you have to do the following way. Here, I will sketch the procedure for mud. At first you had add mud to the module PPTerrain in such a way
    Code:
    module PBTerrain
      Mud             = 42
      def PBTerrain.isMud?(tag)
        return tag==PBTerrain::Mud
      end
    end
    Now, go to the method "pbChooseTileOnStepTaken" in the visible overworld wild encounter script and add
    Code:
      return if PBTerrain.isMud?($game_map.terrain_tag(x,y))
    below
    Code:
      return if PBTerrain.isRock?($game_map.terrain_tag(x,y))
    In the following spoiler section you can compare the code of "pbChooseTileOnStepTaken" before and after adding
    Spoiler:
     
  • 308
    Posts
    4
    Years
    Next Question:
    Is it possible to play an endless loop of an animation ON the Shiny Pokemon? Like in Lets Go with the stars?

    This seems to be a general question on shiny pokemon. Maybe there is allready a solution or code for your wishes out there. Try to find a suitable thread.
    And if there is allready a way, then we can try to implement that code and animation also for spawning shinys.
     
  • 7
    Posts
    6
    Years
    • Seen Apr 28, 2022
    Ok Guys,
    i did it :D

    If you like play an Animation ON the new spawned Pokemon that is SHINY you will need to do 2 things:

    Add this Line:
    SHINY_ANIMATION_ID = 8# or animation ID you'd like to use
    After this Line:
    EVODISABLESWITCH = -1

    then go to this Line:

    if $game_switches[SHINY_WILD_POKEMON_SWITCH]==true
    character_name = character_name+"s"
    shinysprite=true

    elsif ($PokemonTemp.catchcombo[0]>=CHAINLENGTH && $PokemonTemp.catchcombo[1]==encounter[0])
    if rand(SHINYPROBABILITY)<$PokemonTemp.catchcombo[0]
    character_name = character_name+"s"
    shinysprite=true

    end
    end

    And replace all of this with this:

    if $game_switches[SHINY_WILD_POKEMON_SWITCH]==true
    character_name = character_name+"s"
    shinysprite=true
    $scene.spriteset.addUserAnimation(SHINY_ANIMATION_ID,event.x,event.y,true,2)
    elsif ($PokemonTemp.catchcombo[0]>=CHAINLENGTH && $PokemonTemp.catchcombo[1]==encounter[0])
    if rand(SHINYPROBABILITY)<$PokemonTemp.catchcombo[0]
    character_name = character_name+"s"
    shinysprite=true
    $scene.spriteset.addUserAnimation(SHINY_ANIMATION_ID,event.x,event.y,true,2)
    end
    end

    And tadaaa, every shiny that spawns will now play on hisself the animation once with ID 8 in your Animation Editor.

    Sorry for bad english, im german and try my best :D

    This Animation is nice to have because you are able to see if its an shiny or not even if you DONT have an Shiny Overworld Sprite.

    EDIT: I used the berry plant sparkle animation for my shiny encounters. Just copy and paste the animation from slot 7 to 8 in the animation editor.
    Script workes with Essential 17.2. Dont know if other Version will have problems.
     
    Last edited:
    Back
    Top