Controlling wild encounters and having multiple encounter tables of the same type on a map

ferunnico

Rookie
Member
Joined
Feb 15, 2018
Posts
5
Is it possible to control which Pokémon the player will encounter next while walking through tall grass? For example, as long as a certain switch is active, the player can only encounter Pikachu in the tall grass on this map.

One possible way I could imagine would be to have multiple encounter tables for the same map and switch between them with switches and variables, but I have no idea if and how that could be done and the wiki even states "a map's section cannot have more than one of the same encounter type".
 

Golden-1992

Rookie
Member
Joined
Jan 17, 2019
Posts
1
One suggestion I have is to create multiple grass tile sets, basically just duplicate them and define them as separate encounter types. For each grass file you create in the tileset define them with different encounter number. In the script editor under encounter the original text looks something like this:

Land 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1
LandMorning 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1
LandDay 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1
LandNight 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1
Cave 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1
BugContest 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1
Water 60, 30, 5, 4, 1
RockSmash 60, 30, 5, 4, 1
OldRod 70, 30
GoodRod 60, 20, 20
SuperRod 40, 40, 15, 4, 1
HeadbuttLow 30, 25, 20, 10, 5, 5, 4, 1
HeadbuttHigh 30, 25, 20, 10, 5, 5, 4, 1

Copy Land and paste in at the bottom as Land_1. This will be defined with a certain number that will need to go back into Database and define your new grass tile as Land_1's encounter number. Also, you can change how many pokemon can be encountered this way and what percentage. So if you don't want to have to define 12 pokemon for Land_1, you can redefine this in the script editor under encounters by entering any percentage numbers as long as the sum of number of pokemon encountered adds up 100%.
Playing the game it wont look any different but in the code you could define different pokemon to appear. Also, you can use land morning, day, or night to change when a certain pokemon appears.

I know the above portion will work, but a thought I had based off what you are describing in your questions is set up an event based on the new encounter type you defined above. So after define the new encounter type, set up an event that will flip a switch and set up an another event so that when said switch is on your grass tile appears on the map. You will probably have to copy the event with the new grass tile to everywhere on the map that you want the encounter to happen. I don't know if the encounter's will work but this only a thought I had. I'll test it out later when I'm working on my game. Someone with better understanding of script writing will probably have a better solution but this is one method I can think of.

If you are looking to do only one pokemon that appears once on a given tileset then goes away, I would suggest looking at legendary pokemon in the game and copy those events but change the graphic to nothing and the event to touch instead of action so the player wouldn't have to do anything to encounter the wild pokemon except walking over the tile.
 

leilou

A wild Minun appeared!
Member
Joined
May 17, 2017
Posts
223
I worked something out ...

Code:
WILD_EXCHANGE_POKEMON = []
WILD_EXCHANGE_POKEMON[75] = [[EncounterTypes::Land,PBSpecies::BULBASAUR]]
WILD_EXCHANGE_POKEMON[69] = [[EncounterTypes::Land,PBSpecies::CHARIZARD],
                             [EncounterTypes::Water,PBSpecies::IVYSAUR]]


Events.onWildBattleOverride+= proc { |sender,e|
   species=e[0]
   level=e[1]
   handled=e[2]
   next if handled[0]!=nil
   next if $game_switches[30] == false
   next if !WILD_EXCHANGE_POKEMON[$game_map.map_id]
   new_species = WILD_EXCHANGE_POKEMON[$game_map.map_id].select{
       |enc_type,_| enc_type == $PokemonEncounters.pbEncounterType}.map{
       |_ , species_| species_}[0]
   next if !new_species
   next if species == new_species
   handled[0] = pbWildBattle(new_species,level)
}

Put this somewhere between PField_Field and Compiler.

You'll need to adjust the array at the top. The first number is the map id. The thing in the brackets are the encounter type and the species.
You'll also need to adjust the id of the game switch that needs to be on (the thingy in the brackets after $game_switches)

This script checks the encounter type of the tile you're standing on. So if you fish while standing on a tile with an encounter type the script will believe the encounter was not by fishing, but by normal walking(i.e. fishing while surfing or standing in tall grass). But if you don't mind that the script works fine.
Sadly I didn't find a better solution to this problem ... if somebody has an idea I'd be delighted to hear it.
 
Top