ECITEM=:ENCOUNTERTABLET # Change this and the item.txt if you wish another name
ECBACKPATH= "Graphics/Pictures/EncounterTablet" # You can change if you wish
class EncounterCheckerScene
def startScene
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z = 999999
typecount = 0
encountercount = 0
pagecount = 0 if pagecount = nil
pagecount=($game_variables[104]*3)
@sprites={}
@sprites["bg"] = Sprite.new
@sprites["bg"].z = 999999
@sprites["bg"].bitmap = Bitmap.new(ECBACKPATH)
@sprites["bg"].x = 0
@sprites["bg"].y = 0
encdata = load_data("Data/encounters.dat")
if $game_switches[388]
Kernel.pbOutbreakInformation(1,1)
end
enctypes=encdata[56][1] if $DEBUG
enctypes=encdata[$game_map.map_id][1] if !$DEBUG
if $game_screen.weather_type==PBFieldWeather::Rain
weathericons= "Graphics/Pictures/EncounterRain"
elsif $game_screen.weather_type==PBFieldWeather::Storm
weathericons= "Graphics/Pictures/EncounterStorm"
elsif $game_screen.weather_type==PBFieldWeather::Snow
weathericons= "Graphics/Pictures/EncounterSnow"
elsif $game_screen.weather_type==PBFieldWeather::Blizzard
weathericons= "Graphics/Pictures/EncounterBlizzard"
elsif $game_screen.weather_type==PBFieldWeather::Sandstorm
weathericons= "Graphics/Pictures/EncounterSandstorm"
elsif $game_screen.weather_type==PBFieldWeather::Sunny
weathericons= "Graphics/Pictures/EncounterSunny"
elsif $game_screen.weather_type==PBFieldWeather::Ashy
weathericons= "Graphics/Pictures/EncounterAshy"
elsif $game_screen.weather_type==PBFieldWeather::Foggy
weathericons= "Graphics/Pictures/EncounterFoggy"
else
weathericons= "Graphics/Pictures/EncounterClear"
end
if $PokemonGlobal.currentOutbreak && $game_switches[388]
@sprites["outbreakwindow"] = Sprite.new
@sprites["outbreakwindow"].z = 999999
@sprites["outbreakwindow"].bitmap = Bitmap.new("Graphics/Pictures/EncounterOutbreak")
@sprites["outbreakwindow"].x = 376
@sprites["outbreakwindow"].y = 170
icon=getID(PBSpecies,$game_variables[68][0])
@sprites["outbreakicon"] = PokemonSpeciesIconSprite.new(icon)
@sprites["outbreakicon"].z = 999999
@sprites["outbreakicon"].x = 380
@sprites["outbreakicon"].y = 170
sp = Window_AdvancedTextPokemon.new("#{$game_variables[69]}")
sp.z = 999999
sp.baseColor = Color.new(210,210,208)
sp.shadowColor = Color.new(105,105,105)
sp.x = 760
sp.y = 450
sp.zoom_x = 0.5
sp.zoom_y= 0.5
sp.windowskin = nil
end
if $PokemonTemp.pokeradar
@sprites["outbreakwindow"] = Sprite.new
@sprites["outbreakwindow"].z = 999999
@sprites["outbreakwindow"].bitmap = Bitmap.new("Graphics/Pictures/EncounterOutbreak")
@sprites["outbreakwindow"].x = 376
@sprites["outbreakwindow"].y = 258
#icon=getID(PBSpecies,$game_variables[105][0])
@sprites["outbreakicon"] = PokemonSpeciesIconSprite.new($game_variables[105])
@sprites["outbreakicon"].z = 999999
@sprites["outbreakicon"].x = 380
@sprites["outbreakicon"].y = 258
sp = Window_AdvancedTextPokemon.new("Chain: #{$PokemonTemp.pokeradar[2]}")
sp.z = 999999
sp.baseColor = Color.new(210,210,208)
sp.shadowColor = Color.new(105,105,105)
sp.x = 760
sp.y = 626
sp.zoom_x = 0.5
sp.zoom_y= 0.5
sp.windowskin = nil
end
@sprites["weathericon"] = Sprite.new
@sprites["weathericon"].z = 999999
@sprites["weathericon"].bitmap = Bitmap.new(weathericons)
@sprites["weathericon"].x = 427
@sprites["weathericon"].y = 86
encounter=enctypes
encable=[]
return encable if !encounter
if $game_switches[527]==false
sp = Window_AdvancedTextPokemon.new("#{$game_map.name}")
sp.z = 999999
sp.baseColor = Color.new(210,210,208)
sp.shadowColor = Color.new(105,105,105)
sp.x = 12
sp.y = 24
sp.zoom_x = 1
sp.zoom_y= 1
sp.windowskin = nil
for i in pagecount..encounter.length
next if !encounter[i]
if typecount>=3
break
end
encounters = EncounterTypes::Names[i]
sp = Window_AdvancedTextPokemon.new("#{encounters}")
sp.z = 999999
sp.baseColor = Color.new(210,210,208)
sp.shadowColor = Color.new(105,105,105)
sp.x = 16
sp.y = 70+(80*typecount)
sp.windowskin = nil
for j in 0...encounter[i].length
icons = encable.push(encounter[i][j][0])
end
for poke in 0...icons.size
icon = icons[poke]
@sprites["pokeicon"] = PokemonSpeciesIconSprite.new(icon)
@sprites["pokeicon"].z = 999999
if encountercount >= 7
@sprites["pokeicon"].x = 26 + (@sprites["pokeicon"].bitmap.width / 4 * (poke-7)) - 2
@sprites["pokeicon"].y = 112 + (82 * typecount + 22)
else
@sprites["pokeicon"].x = 26 + (@sprites["pokeicon"].bitmap.width / 4 * poke) - 2
@sprites["pokeicon"].y = 112 + (78 * typecount)
end
@sprites["pokeicon"].zoom_x = 0.5
@sprites["pokeicon"].zoom_y= 0.5
@sprites["pokeicon"].color = Color.new(70,70,70) if !$Trainer.seen[icon]
encountercount+=1
end
typecount+=1
encountercount=0
encable=[]
end
end
if $game_switches[527]==true
activeWeather={}
activeWeatherWater={}
weathername={}
if $game_screen.weather_type==PBFieldWeather::Rain
activeWeather=RainCHECK
activeWeatherWater=RainWATERCHECK
weathername = "Raining"
elsif $game_screen.weather_type==PBFieldWeather::Storm
activeWeather=StormCHECK
activeWeatherWater=StormWATERCHECK
weathername = "Storm"
elsif $game_screen.weather_type==PBFieldWeather::Snow
activeWeather=SnowCHECK
activeWeatherWater=SnowWATERCHECK
weathername = "Snowing"
elsif $game_screen.weather_type==PBFieldWeather::Blizzard
activeWeather=BlizzardCHECK
activeWeatherWater=BlizzardWATERCHECK
weathername = "Blizzard"
elsif $game_screen.weather_type==PBFieldWeather::Sandstorm
activeWeather=SandstormCHECK
activeWeatherWater=SandstormWATERCHECK
weathername = "Sandstorm"
elsif $game_screen.weather_type==PBFieldWeather::Sunny
activeWeather=SunnyCHECK
activeWeatherWater=SunnyWATERCHECK
weathername = "Sunny"
elsif $game_screen.weather_type==PBFieldWeather::Ashy
activeWeather=AshyCHECK
activeWeatherWater=AshyWATERCHECK
weathername = "Ashy"
elsif $game_screen.weather_type==PBFieldWeather::Foggy
activeWeather=FoggyCHECK
activeWeatherWater=FoggyWATERCHECK
weathername = "Foggy"
end
sp = Window_AdvancedTextPokemon.new("#{weathername}")
sp.z = 999999
sp.baseColor = Color.new(210,210,208)
sp.shadowColor = Color.new(105,105,105)
sp.x = 12
sp.y = 24
sp.windowskin = nil
sp = Window_AdvancedTextPokemon.new("Land")
sp.z = 999999
sp.baseColor = Color.new(210,210,208)
sp.shadowColor = Color.new(105,105,105)
sp.x = 16
sp.y = 70
sp.windowskin = nil
sp = Window_AdvancedTextPokemon.new("Water")
sp.z = 999999
sp.baseColor = Color.new(210,210,208)
sp.shadowColor = Color.new(105,105,105)
sp.x = 16
sp.y = 70+(80)
sp.windowskin = nil
for poke in 0...activeWeather.length
icon=getID(PBSpecies,activeWeather[poke][0])
@sprites["pokeicon"] = PokemonSpeciesIconSprite.new(icon)
@sprites["pokeicon"].z = 999999
if encountercount >= 7
@sprites["pokeicon"].x = 26 + (@sprites["pokeicon"].bitmap.width / 4 * (poke-7)) - 2
@sprites["pokeicon"].y = 112 + (0 + 22)
else
@sprites["pokeicon"].x = 26 + (@sprites["pokeicon"].bitmap.width / 4 * poke) - 2
@sprites["pokeicon"].y = 112 + (0)
end
@sprites["pokeicon"].zoom_x = 0.5
@sprites["pokeicon"].zoom_y= 0.5
@sprites["pokeicon"].color = Color.new(70,70,70) if !$Trainer.seen[icon]
encountercount+=1
end
encountercount=0
for poke in 0...activeWeatherWater.length
icon=getID(PBSpecies,activeWeatherWater[poke][0])
@sprites["pokeicon"] = PokemonSpeciesIconSprite.new(icon)
@sprites["pokeicon"].z = 999999
if encountercount >= 7
@sprites["pokeicon"].x = 26 + (@sprites["pokeicon"].bitmap.width / 4 * (poke-7)) - 2
@sprites["pokeicon"].y = 112 + (82 + 22)
else
@sprites["pokeicon"].x = 26 + (@sprites["pokeicon"].bitmap.width / 4 * poke) - 2
@sprites["pokeicon"].y = 112 + (78)
end
@sprites["pokeicon"].zoom_x = 0.5
@sprites["pokeicon"].zoom_y= 0.5
@sprites["pokeicon"].color = Color.new(70,70,70) if !$Trainer.seen[icon]
encountercount+=1
end
encountercount=0
activeWeather={}
activeWeatherWater={}
end
loop do
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
$game_variables[104]=0
break
end
if Input.trigger?(Input::RIGHT)
if $game_variables[104]>=((encounter.length/3)-1)
$game_variables[104]=0
$game_switches[526]=true
break
else
$game_variables[104]+=1
$game_switches[526]=true
break
end
end
if Input.trigger?(Input::X)
if $game_switches[527]==false && !$game_screen.weather_type
$game_switches[527]=true
$game_variables[104]=0
$game_switches[526]=true
break
end
end
if Input.trigger?(Input::Z)
if $game_switches[527]==true
$game_switches[527]=false
$game_variables[104]=0
$game_switches[526]=true
break
end
end
Graphics.update
Input.update
self.update
end
encable|=[]
end
#def middleScene
# loop do
# Graphics.update
# Input.update
# self.update
# if Input.trigger?(Input::B) || Input.trigger?(Input::C)
# break
# end
# end
#end
def update
pbUpdateSpriteHash(@sprites)
end
def endScene
pbFadeOutAndHide(@sprites) { update }
pbDisposeSpriteHash(@sprites)
@viewport.dispose
#pageswitch=false if pageswitch = nil
if $game_switches[526]
$game_switches[526]=false
scene=EncounterCheckerScene.new
screen=EncounterChecker.new(scene)
screen.startScreen
end
end
end
class EncounterChecker
def initialize(scene)
@scene=scene
end
def startScreen
@scene.startScene
#@scene.middleScene
@scene.endScene
end
end
# Item handlers
ItemHandlers.addUseFromBag(ECITEM, proc {|item|
encdata = load_data("Data/encounters.dat")
enctypes=encdata[56][1] if $DEBUG
enctypes=encdata[$game_map.map_id][1] if !$DEBUG
encounter=enctypes
if !encounter
Kernel.pbMessage(_INTL("Can't use that here."))
next 1 # Continue
else
pbFadeOutIn(99999){
scene=EncounterCheckerScene.new
screen=EncounterChecker.new(scene)
screen.startScreen
next 1 # Continue
}
end
})
ItemHandlers.addUseInField(ECITEM, proc {|item|
encdata = load_data("Data/encounters.dat")
enctypes=encdata[56][1] if $DEBUG
enctypes=encdata[$game_map.map_id][1] if !$DEBUG
encounter=enctypes
if !encounter
Kernel.pbMessage(_INTL("Can't use that here."))
next 1 # Continue
else
pbFadeOutIn(99999){
scene=EncounterCheckerScene.new
screen=EncounterChecker.new(scene)
screen.startScreen
next 1 # Continue
}
end
})