- 38
- Posts
- 9
- Years
- Canada
- Seen Jul 10, 2022
So i'm trying to add a gen8-style encounter method to my game where certain weather conditions will cause different pokemon to appear. Thought it'd be pretty straightforward, but after doing the scripting and changing the encounters data file, i'm not encountering any Pokémon in the grass. I tried using Sweet Scent, and THAT seems to work fine, though. So the problem seems to be that the game just isn't detecting that random encounters should happen when you take steps in the grass. This only happens when the relevant weather is in effect, the old "LandDay, LandNight, etc" encounters work fine still. Here's what I changed in the scripts (I put "#" by the lines I added or changed):
I didn't make any other changes in PField_Encounters. What did I do wrong?
Code:
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
RainMorn = 13 #
RainDay = 14 #
RainNight = 15 #
Names = [
"Land",
"Cave",
"Water",
"RockSmash",
"OldRod",
"GoodRod",
"SuperRod",
"HeadbuttLow",
"HeadbuttHigh",
"LandMorning",
"LandDay",
"LandNight",
"BugContest",
"RainMorn", #
"RainDay", #
"RainNight" #
]
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], #
[20,20,10,10,10,10,5,5,4,4,1,1], #
[20,20,10,10,10,10,5,5,4,4,1,1] #
]
EnctypeDensities = [25,10,10,0,0,0,0,0,0,25,25,25,25,25,25,25] #
EnctypeCompileDens = [ 1, 2, 3,0,0,0,0,0,0, 1, 1, 1, 1, 1, 1, 1] #
end
Code:
def isGrass?
return false if @density==nil
return (@enctypes[EncounterTypes::Land] ||
@enctypes[EncounterTypes::LandMorning] ||
@enctypes[EncounterTypes::LandDay] ||
@enctypes[EncounterTypes::LandNight] ||
@enctypes[EncounterTypes::RainMorn] || #
@enctypes[EncounterTypes::RainDay] || #
@enctypes[EncounterTypes::RainNight] #
@enctypes[EncounterTypes::BugContest]) ? true : false
end
def isRegularGrass?
return false if @density==nil
return (@enctypes[EncounterTypes::Land] ||
@enctypes[EncounterTypes::LandMorning] ||
@enctypes[EncounterTypes::LandDay] ||
@enctypes[EncounterTypes::LandNight] ||
@enctypes[EncounterTypes::RainMorn] || #
@enctypes[EncounterTypes::RainDay] || #
@enctypes[EncounterTypes::RainNight]) ? true : false #
end
Code:
def pbEncounterType
if $PokemonGlobal && $PokemonGlobal.surfing
return EncounterTypes::Water
elsif self.isCave?
return EncounterTypes::Cave
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)
case $game_screen.weather_type #
when PBFieldWeather::Rain #|| PBFieldWeather::HeavyRain #
enctype = EncounterTypes::RainNight if self.hasEncounter?(EncounterTypes::RainNight) && PBDayNight.isNight?(time) #
enctype = EncounterTypes::RainDay if self.hasEncounter?(EncounterTypes::RainDay) && PBDayNight.isDay?(time) #
enctype = EncounterTypes::RainMorn if self.hasEncounter?(EncounterTypes::RainMorn) && PBDayNight.isMorning?(time) #
end #
if pbInBugContest? && self.hasEncounter?(EncounterTypes::BugContest)
enctype = EncounterTypes::BugContest
end
return enctype
end
return -1
end
I didn't make any other changes in PField_Encounters. What did I do wrong?