• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

Adding a Land 2 encounter type

The basic idea is having a second encounter type that works like walking in grass so I can have multiple set of pokemon per area, puddles for water pokemon that live on land or flowers for smaller bugs. I have looked on the wikia and in past post discussing a similar topic "How to add Encounter Types" however with the examples I have been given work like caves. After trying to just copy Land to try and make a Land 2 I have ran into some interesting issues. Having the entire map act like a cave where you can encounter a pokemon on any tile, having the pokemon at are to appear in the flowers appear in the grass, and no encounters not even even on the other maps without a Land 2 encounter defined.

Can anybody help me with this issue or is it simply not possible?
 
You'll probably have to make a separate terrain tag for the different encounter areas (puddles, flowers, etc.)
 
I'm having the same problem. I tried making a sand encounter, but when I try to use both grass and sand together, only the sand encounters are being used.
 
What does your def pbEncounterType look like? That's the method that decides which encounter method's Pokémon list to use.
Mine looks like this:
Code:
def pbEncounterType
  if $PokemonGlobal && $PokemonGlobal.surfing
    return EncounterTypes::Water
  elsif self.isCave?
    return EncounterTypes::Cave
  elsif self.isSand?
    time=pbGetTimeNow
    enctype=EncounterTypes::Sand
    enctype=EncounterTypes::SandNight if self.hasEncounter?(EncounterTypes::SandNight) && PBDayNight.isNight?(time)
    enctype=EncounterTypes::SandDay if self.hasEncounter?(EncounterTypes::SandDay) && PBDayNight.isDay?(time)
    enctype=EncounterTypes::SandMorning if self.hasEncounter?(EncounterTypes::SandMorning) && PBDayNight.isMorning?(time)
    return EncounterTypes::Sand
  elsif self.isGrass?
    time=pbGetTimeNow
    enctype=EncounterTypes::Land
    enctype=EncounterTypes::LandNight if self.hasEncounter?(EncounterTypes::LandNight) && PBDayNight.isNight?(time)
    enctype=EncounterTypes::LandDay if self.hasEncounter?(EncounterTypes::LandDay) && PBDayNight.isDay?(time)
    enctype=EncounterTypes::LandMorning if self.hasEncounter?(EncounterTypes::LandMorning) && PBDayNight.isMorning?(time)
    if pbInBugContest? && self.hasEncounter?(EncounterTypes::BugContest)
      enctype=EncounterTypes::BugContest
    end
    return enctype
  end
  return -1
end
Even with both sand and grass defined, it only reads from the sand while the grass encounters are ignored, and I don't know why.
 
Last edited by a moderator:
Then what does def isSand? look like?

Did you also add sand-related code into def isEncounterPossibleHere? ?

Are the terrain tag numbers correct, and are you using them properly?
 
Code:
PokémonField

  Ledge           = 1
  Grass           = 2
  Sand            = 3
  Rock            = 4
  DeepWater       = 5
  StillWater      = 6
  Water           = 7
  Waterfall       = 8
  WaterfallCrest  = 9
  TallGrass       = 10
  UnderwaterGrass = 11
  Ice             = 12
  Neutral         = 13
  SootGrass       = 14
  Bridge          = 15
  Puddle          = 16
  Flower          = 17

---------------------------------------------------------------------------------------------------
        
  def PBTerrain.isJustGrass?(tag)   # The Poké Radar only works in these tiles
    return tag==PBTerrain::Grass ||
           tag==PBTerrain::SootGrass
  end

  def PBTerrain.isFlower?(tag)
    return tag==PBTerrain::Flower
  end

(I copied the def for JustGrass and took out the parts I didn't think was needed)
Code:
[B][B]PokémonEncounters

module EncounterTypes
  Land         = 0
  Cave         = 1
  Water        = 2
  RockSmash    = 3
  OldRod       = 4
  GoodRod      = 5
  SuperRod     = 6
  HeadbuttLow  = 7
  HeadbuttHigh = 8
  LandMorning  = 9
  LandDay      = 10
  LandNight    = 11
  BugContest   = 12
  Flower       = 13   
  Names=[
     "Land",
     "Cave",
     "Water",
     "RockSmash",
     "OldRod",
     "GoodRod",
     "SuperRod",
     "HeadbuttLow",
     "HeadbuttHigh",
     "LandMorning",
     "LandDay",
     "LandNight",
     "BugContest",
     "Flower" 
  ]
  EnctypeChances=[
     [20,20,10,10,10,10,5,5,4,4,1,1],
     [20,20,10,10,10,10,5,5,4,4,1,1],
     [60,30,5,4,1],
     [60,30,5,4,1],
     [70,30],
     [60,20,20],
     [40,40,15,4,1],
     [30,25,20,10,5,5,4,1],
     [30,25,20,10,5,5,4,1],
     [20,20,10,10,10,10,5,5,4,4,1,1],
     [20,20,10,10,10,10,5,5,4,4,1,1],
     [20,20,10,10,10,10,5,5,4,4,1,1],
     [20,20,10,10,10,10,5,5,4,4,1,1],
     [20,20,10,10,10,10,5,5,4,4,1,1]         #added this line
  ]
  EnctypeDensities=[25,10,10,0,0,0,0,0,0,25,25,25,25,25]      #added ,25 to the end
  EnctypeCompileDens=[1,2,3,0,0,0,0,0,0,1,1,1,1,1]               #added ,1 to the end
end

-------------------------------------------------------------------------------------

def isFlower?
    return false if @density==nil
    return  @enctypes[EncounterTypes::Flower] ? true : false
  end  

--------------------------------------------------------------------------------

def pbEncounterType
    if $PokemonGlobal && $PokemonGlobal.surfing
      return EncounterTypes::Water
    elsif self.isCave?
      return EncounterTypes::Cave
    elsif self.isFlower?                           #added Flower
      return EncounterTypes::Flower
    elsif self.isGrass?
      time=pbGetTimeNow
      enctype=EncounterTypes::Land
      enctype=EncounterTypes::LandNight if self.hasEncounter?(EncounterTypes::LandNight) && PBDayNight.isNight?(time)
      enctype=EncounterTypes::LandDay if self.hasEncounter?(EncounterTypes::LandDay) && PBDayNight.isDay?(time)
      enctype=EncounterTypes::LandMorning if self.hasEncounter?(EncounterTypes::LandMorning) && PBDayNight.isMorning?(time)
      if pbInBugContest? && self.hasEncounter?(EncounterTypes::BugContest)
        enctype=EncounterTypes::BugContest
      end
      return enctype
    end
    return -1
  end

def isEncounterPossibleHere?
    if $PokemonGlobal && $PokemonGlobal.surfing
      return true
    elsif PBTerrain.isIce?(pbGetTerrainTag($game_player))
      return false
    elsif self.isCave?
      return true
    elsif self.isGrass?
      return PBTerrain.isGrass?($game_map.terrain_tag($game_player.x,$game_player.y))
    elsif self.isFlower?                   #I copied the isGrass code, but I have also tried it with the isCave code
      return PBTerrain.isFlower?($game_map.terrain_tag($game_player.x,$game_player.y))
    end
    return false
  end[/B][/B]



Finally, I opened up the Editor and changed the tile I wanted to terrain tag 17
 
Then what does def isSand? look like?

Did you also add sand-related code into def isEncounterPossibleHere? ?

Are the terrain tag numbers correct, and are you using them properly?
Code:
def isSand?
    return false if @density==nil
    return (@enctypes[EncounterTypes::Sand] ||
            @enctypes[EncounterTypes::SandMorning] ||
            @enctypes[EncounterTypes::SandDay] ||
            @enctypes[EncounterTypes::SandNight]) ? true : false
  end
isSand? code

Code:
def isEncounterPossibleHere?
    if $PokemonGlobal && $PokemonGlobal.surfing
      return true
    elsif PBTerrain.isIce?(pbGetTerrainTag($game_player))
      return false
    elsif self.isCave?
      return true
    elsif self.isSand?
      return PBTerrain.isSand?($game_map.terrain_tag($game_player.x,$game_player.y))
    elsif self.isGrass?
      return PBTerrain.isGrass?($game_map.terrain_tag($game_player.x,$game_player.y))
    end
    return false
  end
isEncounterPossibleHere? code
 
Last edited by a moderator:
Finally, I opened up the Editor and changed the tile I wanted to terrain tag 17
You're just checking whether you have Flower-type encounters defined for the map, and if so, use them. They will always override the grass encounters. Your problem is in def pbEncounterType.

The solution is simple: make it only return the Flower encounter method if you're standing in flowers. Amend your code in that method to read:

Code:
elsif self.isFlower? && PBTerrain.isFlower?($game_map.terrain_tag($game_player.x,$game_player.y))
  return EncounterTypes::Flower
The original code worked fine because surfing should always override cave encounters (if both are defined for a given map), the difference between using water or grass encounters simply depends on whether you're surfing (as you can see in the code), and cave/grass are mutually exclusive. There's no need to be more specific about under what circumstances either are to be used.

However, the difference between Flower and Grass is not "are you surfing?" but rather "are you standing in flowers?". You just need to ask that one question; if you're not, and you still want a wild encounter anyway, you must be standing in tall grass instead. The code I added makes it ask "are you standing in flowers?".

The rest of your code looks fine.

isSand? code

isEncounterPossibleHere? code
Use
Code:
 tags, not [spoiler] tags. You're writing code, not spoilers.

You have the same problem as GT-Baka - Sand is always overriding Grass. In [COLOR=Red]def pbEncounterType[/COLOR], change the appropriate line of code as shown below:

[code]elsif self.isSand? && PBTerrain.isSand?($game_map.terrain_tag($game_player.x,$game_player.y))
 
Sorry about that. Still kinda new here. Anyway, thanks for that, but that didn't help. For some reason, I'm still not getting any grass encounters. I have them defined in the txt file, but no grass Pokemon are showing up. The sand Pokemon, however, are popping up just fine.
 
I added your code but the Flower is still overriding the Grass, I tried to solve the issue by using your code to check for grass.

Code:
elsif self.isGrass? && PBTerrain.isGrass?($game_map.terrain_tag($game_player.x,$game_player.y))  
 return EncounterTypes::Grass
but the game crashed when I went into the grass.
 
Last edited:
Back
Top