• 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
  • The Poke Radar got some odd behavior due to overworld spawning.
    This can be easily repaired in script version 2.0.1 and 2.0.2 for Pokemon Essentials V17, V17.2, V18 and 18.1.
    Find the line
    Code:
        if $game_variables[OVERWORLD_ENCOUNTER_VARIABLE]>0 && ($game_variables[OVERWORLD_ENCOUNTER_VARIABLE]>=100 || rand(100) < $game_variables[OVERWORLD_ENCOUNTER_VARIABLE])
    in the method "def pbOnStepTaken(eventTriggered)" and replace it by
    Code:
        if ($game_variables[OVERWORLD_ENCOUNTER_VARIABLE]>0 && ($game_variables[OVERWORLD_ENCOUNTER_VARIABLE]>=100 || rand(100) < $game_variables[OVERWORLD_ENCOUNTER_VARIABLE])) || pbPokeRadarOnShakingGrass
    Then, using the poke radar, the pokemon in the rustling grass will be always normal, i.e. instant encounters, as usual.
    I will also include this bug fix in the overworld encounter script version 2.0.3 for PE V18 and V18.1.
     
    Last edited:
    22
    Posts
    7
    Years
    • Seen May 15, 2023
    Hi, awesome script!, I am testing with it and all is working great.

    I have a doubt, there is any way to show a combo-count for the current Pokemon chain.
    It could be something like showing the current chained pokemon icon and the number of Pokemon of that specie defeated or catched.
    I dont know if this is too dificult to achieve,
    i tried adding "$PokemonTemp.catchcombo[0]" to the script of SimpleHUD Optimized by FL in this way:

    textPositions=[
    [@currentTexts[0],xposition,0,2,baseColor,shadowColor],
    [@currentTexts[1],xposition,22,2,baseColor,shadowColor],
    [@currentTexts[2],xposition,40,2,Color.new(190,220,130),Color.new(70,90,50)]
    ]

    and

    def textsDefined
    ret=[]
    ret[0] = ($Trainer.money.to_s)
    ret[1] = ($Trainer.pokedexOwned(0).to_s)
    ret[2] = ($PokemonTemp.catchcombo[0].to_s)
    return ret
    end

    but i am not being succesful, i always get NoMethodError, undefined method [] for nil:NilClass.

    How it would be the correct way to get this working?
     
    308
    Posts
    4
    Years
  • Hi, awesome script!, I am testing with it and all is working great.

    I have a doubt, there is any way to show a combo-count for the current Pokemon chain.
    It could be something like showing the current chained pokemon icon and the number of Pokemon of that specie defeated or catched.
    I dont know if this is too dificult to achieve,
    i tried adding "$PokemonTemp.catchcombo[0]" to the script of SimpleHUD Optimized by FL in this way:

    Code:
    textPositions=[
      [@currentTexts[0],xposition,0,2,baseColor,shadowColor],
      [@currentTexts[1],xposition,22,2,baseColor,shadowColor],
      [@currentTexts[2],xposition,40,2,Color.new(190,220,130),Color.new(70,90,50)]
    ]
    and
    Code:
    def textsDefined
      ret=[]
      ret[0] = ($Trainer.money.to_s)
      ret[1] = ($Trainer.pokedexOwned(0).to_s)
      ret[2] = ($PokemonTemp.catchcombo[0].to_s)
      return ret
    end

    but i am not being succesful, i always get NoMethodError, undefined method [] for nil:NilClass.

    How it would be the correct way to get this working?

    As long as there is no data stored about a chained pokemon in the temporary data, you will have to set "ret[2]" manually to zero. An easy way to do this is the following.
    Replace
    Code:
          ret[2] = ($PokemonTemp.catchcombo[0].to_s)
    in your modifications of the method textsDefined in FL's Simple HUD Optimized script by
    Code:
          if ($PokemonTemp.catchcombo && $PokemonTemp.catchcombo[0])
            ret[2] = ($PokemonTemp.catchcombo[0].to_s)
          else 
            ret[2]="0"
          end
    I tested it. It will work.
     
    22
    Posts
    7
    Years
    • Seen May 15, 2023
    Tested! awesome result.
    Now I tried using "$PokemonTemp.rescuechain[0].to_s" instead "$PokemonTemp.catchcombo[0].to_s"
    and I discovered that when wild pokemon spawn, the rescuechain broke. I suppouse that this shouldn't be happening.
    http://i.imgur.com/zYqLDku.gifv
    Here you can see this, in the overworld in the Red text that say "Racha: 1" at bottom-right corner.
     
    308
    Posts
    4
    Years
  • Tested! awesome result.
    Now I tried using "$PokemonTemp.rescuechain[0].to_s" instead "$PokemonTemp.catchcombo[0].to_s"
    and I discovered that when wild pokemon spawn, the rescuechain broke. I suppouse that this shouldn't be happening.
    http://i.imgur.com/zYqLDku.gifv
    Here you can see this, in the overworld in the Red text that say "Racha: 1" at bottom-right corner.

    What happens if you replace
    Code:
        family=pbGetBabySpecies(pokemon.fSpecies)
    by
    Code:
        family=pbGetBabySpecies(pokemon.species)
    and
    Code:
            evodata=pbGetEvolvedFormData(pokemon.fSpecies)
    by
    Code:
            evodata=pbGetEvolvedFormData(pokemon.species)
    in the resque chain script?
     
    22
    Posts
    7
    Years
    • Seen May 15, 2023
    Tested,
    The chain still break when spawn a pkmn species different from the one i am chaining.
    With the replacements you've propoused, the chain dont break if, for example i am chaining normal sandshrew and then spawn a alolan sandsrew.
    PD: I am using PEv17.2, with version 2.0.1 of your script plus the addons: Rescue chain, Shiny Let'sGo Hunting, and Autospawn
    Here you can see it:
    Spoiler:
     
    308
    Posts
    4
    Years
  • Tested,
    The chain still break when spawn a pkmn species different from the one i am chaining.
    With the replacements you've propoused, the chain dont break if, for example i am chaining normal sandshrew and then spawn a alolan sandsrew.
    PD: I am using PEv17.2, with version 2.0.1 of your script plus the addons: Rescue chain, Shiny Let'sGo Hunting, and Autospawn

    Actually, breaking the chain when spawning a pokemon with different species family is intended. It represents the original behaviour of Vendilys Resque Chain at best, where the chain break on encountering (hence spawning now) a pokemon of different species family. However, I can understand that you don't want that kind of breaks.

    You can modify the Resque Chain add-on for the visible overworld encounters script version 2.0.1 for Pokemon Essentials v17.2 by using this instead
    Code:
    #===============================================================================
    # RESCUE CHAIN - By Vendily
    # - edited to obtain compatibility for visible overworld encounter by derFischae
    #===============================================================================
    # This is an add-on for the visible overworld wild encounter script.
    # It adds Vendilys Rescue Chain to the script.
    # See https://www.pokecommunity.com/showthread.php?t=415524 for original script
    #
    # FEATURES INCLUDED:
    # If you kill the same species in a row, then you increase the chance of spawning an evolved pokemon of that species family.
    #
    # INSTALLATION:
    # Step 1) Copy this code and 
    # Paste it at the bottom of your visible wild overworld encounter script
    # Step 2) If you want to use JoelMathews Add-ons, then simply copy and paste
    # the original code at https://www.pokecommunity.com/showthread.php?t=422513
    #
    # PROPERTIES:
    # Moreover, you also have all settings of vendilys Rescue chain below.
    
    #===============================================================================
    # Rescue Chain - By Vendily
    # This script makes it so that if you chain pokemon of the same evolutionary
    #  family together, an evolved form of the species will appear.
    # I used no references and I completly misinterpreted a description of SOS
    #  battles as this thing.
    # * Minimum length of chain before evolved forms begin to appear. With every
    #    multiple, the chance for the evolved form or a second evolved form to appear
    #    increases. (Default 10)
    # * Chance that the evolved form will even show up, 1 out of this constant.
    #    (Default 4, for 1/4 chance, it's probably too high)
    # * Random number added to the minimum level this pokemon can evolve at or
    #    the wild pokemon's current level if it evolves through item (Default 5)
    # * Disable this modifier while the pokeradar is being used.
    #    I recommend leaving it as is as the pokeradar may behave strangely and the
    #    two scripts may reset each others' chain. (Default true)
    # * The maps where this effect can only take place in.
    # * The maps where this effect will never happen. Ever.
    # * The switch to disable this effect. (Default -1)
    #===============================================================================
    EVOCHAINLENGTH      = 1
    EVORANDCHANCE       = 1
    EVOLEVELWOBBLE      = 5
    EVOPKRADERDISABLE   = true
    EVOMAPSWHITELIST    = []
    EVOMAPSBLACKLIST    = []
    EVODISABLESWITCH    = -1
    
    class PokemonTemp
      attr_accessor :rescuechain # [chain length, evo family]
    end
    
    Events.onStartBattle+=proc {|sender,e|
      if !$PokemonGlobal.battlingSpawnedPokemon
        next if EVOMAPSBLACKLIST.include?($game_map.map_id)
        next if EVOMAPSWHITELIST.length>0 && !EVOMAPSWHITELIST.include?($game_map.map_id)
        next if EVODISABLESWITCH>0 && $game_switches[EVODISABLESWITCH]
        next if EVOPKRADERDISABLE && !$PokemonTemp.pokeradar.nil?
        next if !$PokemonGlobal.roamEncounter.nil?
        pokemon=e[0]
        next if pokemon.nil?
        if !$PokemonTemp.rescuechain
          $PokemonTemp.rescuechain=[0,nil]
        end
        family=pbGetBabySpecies(pokemon.species)
        if family != $PokemonTemp.rescuechain[1]
          $PokemonTemp.rescuechain=[0,family]
        end
        if $PokemonTemp.rescuechain[0]>=EVOCHAINLENGTH
          for i in 0..($PokemonTemp.rescuechain[0]/EVOCHAINLENGTH).floor()
            evodata=pbGetEvolvedFormData(pokemon.species)
            if evodata.length>0 && rand(EVORANDCHANCE)==0
              fspecies=evodata[rand(evodata.length)][2]
              newspecies,newform=pbGetSpeciesFromFSpecies(fspecies)
              level=pbGetMinimumLevel(fspecies)
              level=[level,pokemon.level].max
              level+=rand(EVOLEVELWOBBLE)
              pokemon.species=newspecies
              pokemon.form=newform
              pokemon.level=level
              pokemon.name=PBSpecies.getName(newspecies)
              pokemon.calcStats
              pokemon.resetMoves
             end
          end
        end
      end
    }
    
    Events.onWildPokemonCreateForSpawning+=proc {|sender,e|
      if !$PokemonGlobal.battlingSpawnedPokemon
        next if EVOMAPSBLACKLIST.include?($game_map.map_id)
        next if EVOMAPSWHITELIST.length>0 && !EVOMAPSWHITELIST.include?($game_map.map_id)
        next if EVODISABLESWITCH>0 && $game_switches[EVODISABLESWITCH]
        next if EVOPKRADERDISABLE && !$PokemonTemp.pokeradar.nil?
        next if !$PokemonGlobal.roamEncounter.nil?
        pokemon=e[0]
        next if pokemon.nil?
        if !$PokemonTemp.rescuechain
          $PokemonTemp.rescuechain=[0,nil]
        end
        family=pbGetBabySpecies(pokemon.species)
        if $PokemonTemp.rescuechain[0]>=EVOCHAINLENGTH && family == $PokemonTemp.rescuechain[1]
          for i in 0..($PokemonTemp.rescuechain[0]/EVOCHAINLENGTH).floor()
            evodata=pbGetEvolvedFormData(pokemon.species)
            if evodata.length>0 && rand(EVORANDCHANCE)==0
              fspecies=evodata[rand(evodata.length)][2]
              newspecies,newform=pbGetSpeciesFromFSpecies(fspecies)
              level=pbGetMinimumLevel(fspecies)
              level=[level,pokemon.level].max
              level+=rand(EVOLEVELWOBBLE)
              pokemon.species=newspecies
              pokemon.form=newform
              pokemon.level=level
              pokemon.name=PBSpecies.getName(newspecies)
              pokemon.calcStats
              pokemon.resetMoves
             end
          end
        end
      end
    }
    
    Events.onWildBattleEnd+=proc {|sender,e|
       next if EVOMAPSBLACKLIST.include?($game_map.map_id)
       next if EVOMAPSWHITELIST.length>0 && !EVOMAPSWHITELIST.include?($game_map.map_id)
       next if EVODISABLESWITCH>0 && $game_switches[EVODISABLESWITCH]
       next if EVOPKRADERDISABLE && !$PokemonTemp.pokeradar.nil?
       $PokemonTemp.rescuechain = [0,nil] if !$PokemonTemp.rescuechain
       species=e[0]
       result=e[2]
       family=pbGetBabySpecies(species)
       if $PokemonTemp.rescuechain[1]!=family
         $PokemonTemp.rescuechain=[0,family]
       end
       if (result==1 || result == 4) && family==$PokemonTemp.rescuechain[1]
         $PokemonTemp.rescuechain[0]+=1
       end 
    }
    If you are interested what I did then you can read the spoiler section about how to modify or create your own add-on in the main thread for v17.2.
    I haven't tested it, so I would be happy to hear if it works as it should.
     

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • Hello, I have a question, when using a randomizer to randomize everypokemon in the game, are the overwolrd sprite randomized too?

    Example: I have the randomizer ON, and an altaria appeared in overworld but when going to the altaria a swellow was here
     
    89
    Posts
    4
    Years
    • Seen Jan 17, 2023
    Hello, I have a question, when using a randomizer to randomize everypokemon in the game, are the overwolrd sprite randomized too?

    Example: I have the randomizer ON, and an altaria appeared in overworld but when going to the altaria a swellow was here

    No because the script spawns Overworlds based on the encounter table, not on the Randomizer you have.
     
    308
    Posts
    4
    Years
  • There is a way to tweak this?

    EDIT: not that it's annoy me but we never know

    There is a special randomizer add-on for this visible overworld wild encounter script. It makes that overworld pokemon are random while spawning but don't change anymore when going into battle with whem. You can find it in a spoiler section of the "add-ons" subsection in the main post of your visible overworld wild encounter script version of your Pokemon Essentials version.

    However, if you want to keep your old overworld randomizer script and want that spawned overworld pokemon remain that pokemon after going into battle with them, then you have to modify your original randomizer script. I don't know the code of your script but the following 2 steps should do the trick:
    1) Find every code snippet in your randomizer script of the form
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
        #HERE IS SOME CODE, probably more than one line
    }
    and replace it by
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
      if !$PokemonGlobal.battlingSpawnedPokemon
        #HERE IS SOME CODE, probably more than one line
      end
    }
    2) If your randomizer script also contains code snippets of the form
    Code:
    Events.onStartBattle+=proc {|sender,e|
        #HERE IS SOME CODE, probably more than one line
    }
    then also replace that code snippets by
    Code:
    Events.onStartBattle+=proc {|sender,e|
      if !$PokemonGlobal.battlingSpawnedPokemon
        #HERE IS SOME CODE, probably more than one line
      end
    }
    If you want to learn more about that, then you can read the spoiler section about how to create or modify your own add-ons in the main post of your visible overworld wild encounter script version of your Pokemon Essentials version.

    And if you want randomized spawning and again randomizing when going into battle, then you can use your script and the special randomizer add-on together
     
    Last edited:

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • I don't know if i'm dumb but I can't see the add-on :/

    EDIT: found it wasn't looking at the right topic
     
    Last edited:

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • 1) Find every code snippet in your randomizer script of the form
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
        #HERE IS SOME CODE, probably more than one line
    }
    and replace it by
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
      if !$PokemonGlobal.battlingSpawnedPokemon
        #HERE IS SOME CODE, probably more than one line
      end
    }
    2) If your randomizer script also contains code snippets of the form
    Code:
    Events.onStartBattle+=proc {|sender,e|
        #HERE IS SOME CODE, probably more than one line
    }
    then also replace that code snippets by
    Code:
    Events.onStartBattle+=proc {|sender,e|
      if !$PokemonGlobal.battlingSpawnedPokemon
        #HERE IS SOME CODE, probably more than one line
      end
    }

    The randomizer that I have doesn't contain any of this
     
    308
    Posts
    4
    Years
  • The randomizer that I have doesn't contain any of this

    Then the easiest way is to remove your randomizer and use the specific randomizer add-on.

    I cannot guess what your randomizer looks like or how it was coded. If you want to modify your old randomizer insteed of using the specific randomizer add-on and want to ask for some help, then you have to like to the thread of that randomizer.
     

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • Is that normal that sometimes Pokémon appear on top of tileset? I mean in a cave they appear on the wall, on the black tile where there is nothing
     
    308
    Posts
    4
    Years
  • Is that normal that sometimes Pokémon appear on top of tileset? I mean in a cave they appear on the wall, on the black tile where there is nothing

    In caves, pokemon don't spawn on rocks. If you want to restrict pokemon to spawn on specific terrain, then set that terrain tag to Tile-ID 4. This is already written in the main thread under "features included".

    For more informations or if you want to modify cave spawning for your desire, then read the spoiler tag "forbidding pokemon to spawn on specific terrain tiles in caves" in the main post for your version.
     
    308
    Posts
    4
    Years
  • Is there a way to make Pokémon to spawn only on passable tiles?

    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]
     

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • I don't know if someone replied to something similar, but the random can also spawn form? like rotom form, galarian/alolan form?
     
    Back
    Top