Alright.
In Poccil's kit, if you specify a regional dex, it's always on. No matter what.
I need to know how to add a national dex, like so I can see all 493 and not the 160 I specified for the regional dex.
and err, thanks if you can find a code that I can put in an event to add a national dex.
In Poccil's kit, if you specify a regional dex, it's always on. No matter what.
I need to know how to add a national dex, like so I can see all 493 and not the 160 I specified for the regional dex.
Code:
class Window_Pokedex < SpriteWindow_Selectable
attr_reader :baseColor
attr_reader :shadowColor
def initialize(x,y,width,height)
@starting=true
super(x,y,width,height)
@selarrow=BitmapCache.load_bitmap("Graphics/Pictures/selarrow.png")
@pokeball=BitmapCache.load_bitmap("Graphics/Pictures/pokeball.png")
@baseColor=Color.new(9<<3,9<<3,9<<3)
@shadowColor=Color.new(26<<3,26<<3,26<<3)
self.index=0
@commands=[]
@item_max=0
@starting=false
refresh
end
def commands=(value)
@commands=value
refresh
end
def dispose
@selarrow.dispose
@pokeball.dispose
super
end
def species
return @commands.length==0 ? 0 : @commands[self.index][0]
end
def refresh
return if @starting
@item_max=@commands.length
dheight=self.height-32
dwidth=self.width-32
if !self.contents || self.contents.disposed? ||
self.contents.height<dheight || self.contents.width<dwidth
self.contents.dispose if self.contents
self.contents=Bitmap.new([1,dwidth].max,[1,dheight].max)
pbSetSystemFont(self.contents)
end
self.contents.clear
contentsWidth=self.contents.width
ypos=0
for i in 0...@item_max
if i<self.top_row || i>self.top_row+self.page_row_max
next
end
pbCopyBitmap(self.contents,@selarrow,0,ypos) if self.index==i
indexNumber=@commands[i][4]
species=@commands[i][0]
if $Trainer.seen[species]
j=self.top_row
if $Trainer.owned[species]
pbCopyBitmap(self.contents,@pokeball,210,(i-j)*32)
end
text=_ISPRINTF("No.{1:03d} {2:s}",indexNumber,@commands[i][1])
else
text=_ISPRINTF("No.{1:03d} ----------",indexNumber)
end
self.contents.font.color=@shadowColor
pbDrawShadow(self.contents,16,ypos,self.contents.width-16,32,text)
self.contents.font.color=@baseColor
self.contents.draw_text(16,ypos,self.contents.width-16,32,text)
ypos+=32
end
end
def update
dorefresh=false
oldindex=self.index
super
dorefresh=(self.index!=oldindex)
refresh if dorefresh
end
end
class Window_ComplexCommandPokemon < SpriteWindow_Selectable
attr_reader :baseColor
attr_reader :shadowColor
attr_reader :commands
def getAutoDims(commands,dims,width=nil)
windowheight=commands.length*32+32
windowheight=33 if windowheight<33
if !width || width<0
width=0
tmpbitmap=Bitmap.new(1,1)
pbSetSystemFont(tmpbitmap)
for i in commands
width=[width,tmpbitmap.text_size(i).width].max
end
width+=64
tmpbitmap.dispose
else
width=[33,width].max
end
dims[0]=width
dims[1]=windowheight
end
def initialize(commands,width=nil)
@starting=true
@commands=commands
dims=[]
getAutoDims(commands,dims,width)
super(0,0,dims[0],dims[1])
@item_max=commands.length
@selarrow=BitmapCache.load_bitmap("Graphics/Pictures/selarrow.png")
@index=0
self.active=true
@baseColor=Color.new(12*8,12*8,12*8)
@shadowColor=Color.new(26*8,26*8,25*8)
refresh
@starting=false
end
def self.newEmpty(x,y,width,height,viewport=nil)
ret=self.new([],width)
ret.x=x
ret.y=y
ret.width=width
ret.height=height
ret.viewport=viewport
return ret
end
def index=(value)
super
refresh if !@starting
end
def indexToCommand(index)
curindex=0
i=0; loop do break unless i<@commands.length
return [i/2,-1] if index==curindex
curindex+=1
return [i/2,index-curindex] if index-curindex<commands[i+1].length
curindex+=commands[i+1].length
i+=2
end
return [-1,-1]
end
def getText(array,index)
cmd=indexToCommand(index)
return "" if cmd[0]==-1
return array[cmd[0]*2] if cmd[1]<0
return array[cmd[0]*2+1][cmd[1]]
end
def commands=(value)
@commands=value
@item_max=commands.length
self.index=self.index
end
def width=(value)
super
if !@starting
self.index=self.index
end
end
def height=(value)
super
if !@starting
self.index=self.index
end
end
def resizeToFit(commands)
dims=[]
getAutoDims(commands,dims)
self.width=dims[0]
self.height=dims[1]
end
def dispose
@selarrow.dispose
super
end
def baseColor=(value)
@baseColor=value
refresh
end
def shadowColor=(value)
@shadowColor=value
refresh
end
def refresh
dwidth=self.width-32
dheight=self.height-32
@item_max=0
i=0; loop do break unless i<@commands.length
@item_max+=1+@commands[i+1].length
i+=2
end
if !self.contents || self.contents.disposed? ||
self.contents.width<dwidth ||
self.contents.height<dheight
self.contents.dispose if self.contents
self.contents=Bitmap.new([1,dwidth].max,[1,dheight].max)
pbSetSystemFont(self.contents)
end
self.contents.clear
contentsWidth=self.contents.width
ypos=0
icommand=0
i=0; loop do break unless i<@commands.length
if icommand>=self.top_row && icommand<self.top_row+self.page_row_max
self.contents.font.color=self.shadowColor
pbDrawShadow(self.contents,0,ypos,contentsWidth,32,@commands[i])
self.contents.font.color=self.baseColor
self.contents.draw_text(0,ypos,contentsWidth,32,@commands[i])
ypos+=32
end
icommand+=1
for j in 0...@commands[i+1].length
if icommand>=self.top_row && icommand<self.top_row+self.page_row_max
pbCopyBitmap(self.contents,@selarrow,0,ypos) if self.index==icommand
self.contents.font.color=self.shadowColor
pbDrawShadow(self.contents,16,ypos,contentsWidth-16,32,@commands[i+1][j])
self.contents.font.color=self.baseColor
self.contents.draw_text(16,ypos,contentsWidth-16,32,@commands[i+1][j])
ypos+=32
end
icommand+=1
end
i+=2
end
end
def update
oldindex=self.index
super
refresh if self.index!=oldindex
end
end
class PokemonPokedexScene
def setIconBitmap(file)
@sprites["icon"].setBitmap(file)
if @sprites["icon"].bitmap
@sprites["icon"].ox=@sprites["icon"].bitmap.width/2
@sprites["icon"].oy=@sprites["icon"].bitmap.height/2
end
end
#
# Gets the region used for displaying Pokedex entries.
# Species will be listed according to the given region's
# numbering and the returned region can have any value
# defined in the town map data file. It's currently
# set to the return value of pbGetCurrentRegion,
# and thus will change according to the current map's
# MapPosition metadata setting.
#
def pbGetPokedexRegion
return pbGetCurrentRegion()
end
def pbStartScene
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["pokedex"]=Window_Pokedex.new(
160,0,Graphics.width-160,Graphics.height)
@sprites["pokedex"].viewport=@viewport
@sprites["dexentry"]=SpriteWrapper.new(@viewport)
@sprites["dexentry"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/dexentry.png")
@sprites["dexentry"].visible=false
@sprites["overlay"]=SpriteWrapper.new(@viewport)
@sprites["overlay"].bitmap=Bitmap.new(Graphics.width,Graphics.height)
pbSetSystemFont(@sprites["overlay"].bitmap)
@sprites["overlay"].x=0
@sprites["overlay"].y=0
@sprites["overlay"].visible=false
@sprites["iconback"]=IconWindow.new(0,0,160,160)
@sprites["iconback"].viewport=@viewport
@sprites["auxlist"]=Window_CommandPokemon.newEmpty(272,0,208,224,@viewport)
@sprites["searchlist"]=Window_ComplexCommandPokemon.newEmpty(0,0,272,224,@viewport)
@sprites["infowindow"]=Window_UnformattedTextPokemon.newWithSize("",0,160,160,160,@viewport)
@sprites["messagebox"]=Window_UnformattedTextPokemon.new("")
pbBottomLeftLines(@sprites["messagebox"],2)
@sprites["messagebox"].letterbyletter=false
@sprites["messagebox"].visible=false
@sprites["messagebox"].viewport=@viewport
@sprites["auxlist"].visible=false
@sprites["searchlist"].visible=false
addBackgroundPlane(@sprites,"searchbg","searchbg.png",@viewport)
=begin
# Suggestion for changing the background depending on region. You
# can change the line below with the following:
if pbGetPokedexRegion()==-1 # Using national Pokedex
addBackgroundPlane(@sprites,"background","pokedexbg_national.png",@viewport)
elsif pbGetPokedexRegion()==0 # Using regional Pokedex
addBackgroundPlane(@sprites,"background","pokedexbg_regional.png",@viewport)
end
=end
addBackgroundPlane(@sprites,"background","pokedexbg.png",@viewport)
@sprites["searchbg"].visible=false
@sprites["icon"]=IconSprite.new(80,80,@viewport)
@searchResults=false
pbRefreshDexList($PokemonGlobal.pokedexIndex)
pbFadeInAndShow(@sprites)
end
def pbDexSearchCommands(commands,selitem,helptexts=nil)
ret=-1
auxlist=@sprites["auxlist"]
messagebox=@sprites["messagebox"]
auxlist.commands=commands
auxlist.index=selitem
messagebox.text=helptexts ? helptexts[auxlist.index] : ""
loop do
Graphics.update
Input.update
oldindex=auxlist.index
auxlist.update
if auxlist.index!=oldindex && helptexts
messagebox.text=helptexts[auxlist.index]
end
if Input.trigger?(Input::B)
ret=selitem
break
end
if Input.trigger?(Input::C)
ret=auxlist.index
break
end
end
@sprites["auxlist"].commands=[]
Input.update
return ret
end
def pbCanAddForModeList?(mode,nationalSpecies)
case mode
when 0
return true
when 1
return $Trainer.seen[nationalSpecies]
when 2, 3, 4, 5
return $Trainer.owned[nationalSpecies]
end
end
def pbCanAddForModeSearch?(mode,nationalSpecies)
case mode
when 0, 1
return $Trainer.seen[nationalSpecies]
when 2, 3, 4, 5
return $Trainer.owned[nationalSpecies]
end
end
def pbGetDexList()
dexlist=[]
dexdata=pbOpenDexData
region=pbGetPokedexRegion()
regionalSpecies=pbAllRegionalSpecies(region)
if regionalSpecies.length==1
# No regional species defined,
# use national Pokedex order
for i in 1..PBSpecies.getCount
regionalSpecies.push(i)
end
end
for i in 1...regionalSpecies.length
nationalSpecies=regionalSpecies[i]
if pbCanAddForModeList?($PokemonGlobal.pokedexMode,nationalSpecies)
pbDexDataOffset(dexdata,nationalSpecies,33)
height=dexdata.fgetw
weight=dexdata.fgetw
# Pushing national species, name, height, weight, index number
dexlist.push([nationalSpecies,
PBSpecies.getName(nationalSpecies),height,weight,i])
end
end
dexdata.close
return dexlist
end
def pbRefreshDexList(index=0)
dexlist=pbGetDexList()
case $PokemonGlobal.pokedexMode
when 0 # Numerical mode
# Remove species not seen from the list
i=0; loop do break unless i<dexlist.length
break if $Trainer.seen[dexlist[i][0]]
dexlist[i]=nil
i+=1
end
i=dexlist.length-1; loop do break unless i>=0
break if !dexlist[i] || $Trainer.seen[dexlist[i][0]]
dexlist[i]=nil
i-=1
end
dexlist.compact!
# Sort species in ascending order by
# index number, not national species
dexlist.sort!{|a,b| a[4]<=>b[4]}
when 1 # Alphabetical mode
dexlist.sort!{|a,b| a[1]<=>b[1]}
when 2 # Heaviest mode
dexlist.sort!{|a,b| b[3]<=>a[3]}
when 3 # Lightest mode
dexlist.sort!{|a,b| a[3]<=>b[3]}
when 4 # Tallest mode
dexlist.sort!{|a,b| b[2]<=>a[2]}
when 5 # Smallest mode
dexlist.sort!{|a,b| a[2]<=>b[2]}
end
if !@searchResults
@sprites["infowindow"].text=_ISPRINTF("SEEN: {1:d}\r\nOWN: {2:d}\r\nZ: MENU\r\nF5: SEARCH",$Trainer.pokedexSeen,$Trainer.pokedexOwned)
else
@sprites["infowindow"].text=_INTL("X: BACK\r\nZ: MENU\r\nF5: SEARCH")
end
@dexlist=dexlist
@sprites["pokedex"].commands=@dexlist
@sprites["pokedex"].index=index
@sprites["pokedex"].refresh
iconspecies=@sprites["pokedex"].species
iconspecies=0 if !$Trainer.seen[iconspecies]
setIconBitmap(pbPokemonBitmapFile(iconspecies,false))
end
def pbSearchDexList(params)
dexlist=pbGetDexList()
if params[0]!=0 # Filter by name
nameCommands=[
"",_INTL("ABC"),_INTL("DEF"),_INTL("GHI"),
_INTL("JKL"),_INTL("MNO"),_INTL("PQR"),
_INTL("STU"),_INTL("VWX"),_INTL("YZ")
]
scanNameCommand=nameCommands[params[0]].scan(/./)
dexlist=dexlist.find_all {|item|
firstChar=item[1][0,1]
next scanNameCommand.any? { |v| v==firstChar }
}
end
if params[1]!=0 # Filter by color
dexlist=dexlist.find_all {|item|
dexdata.pos=76*(item[0]-1)+6
color=dexdata.fgetb
next color==params[1]-1
}
end
if params[2]!=0 || params[3]!=0 # Filter by type
typeCommands=[
-1,0,1,2,3,4,5,6,7,8,
10,11,12,13,14,15,16,17
]
stype1=typeCommands[params[2]]
stype2=typeCommands[params[3]]
dexlist=dexlist.find_all {|item|
dexdata.pos=76*(item[0]-1)+8
type1=dexdata.fgetb
type2=dexdata.fgetb
if stype1>=0 && stype2>=0
# Find species that match both types
next (stype1==type1 && stype2==type2) ||
(stype1==type2 && stype2==type1)
elsif stype1>=0
# Find species that match first type entered
next type1==stype1 || type2==stype1
else
# Find species that match second type entered
next type1==stype2 || type2==stype2
end
}
end
dexdata.close
case params[4]
when 0 # Numerical mode
# Sort by index number, not
# national number
dexlist.sort!{|a,b| a[4]<=>b[4]}
when 1 # Alphabetical mode
dexlist.sort!{|a,b| a[1]<=>b[1]}
when 2 # Heaviest mode
dexlist.sort!{|a,b| b[3]<=>a[3]}
when 3 # Lightest mode
dexlist.sort!{|a,b| a[3]<=>b[3]}
when 4 # Tallest mode
dexlist.sort!{|a,b| b[2]<=>a[2]}
when 5 # Smallest mode
dexlist.sort!{|a,b| a[2]<=>b[2]}
end
return dexlist
end
def pbRefreshDexSearch(params)
searchlist=@sprites["searchlist"]
messagebox=@sprites["messagebox"]
searchlist.commands=[
_INTL("SEARCH"),[
_ISPRINTF("NAME: {1:s}",@nameCommands[params[0]]),
_ISPRINTF("COLOR: {1:s}",@colorCommands[params[1]]),
_ISPRINTF("TYPE 1: {1:s}",@typeCommands[params[2]]),
_ISPRINTF("TYPE 2: {1:s}",@typeCommands[params[3]]),
_ISPRINTF("ORDER: {1:s}",@orderCommands[params[4]]),
_INTL("START SEARCH")
],
_INTL("SHIFT"),[
_ISPRINTF("ORDER: {1:s}",@orderCommands[params[5]]),
_INTL("START SHIFT")
],
_INTL("OTHER"),[
_INTL("CANCEL")
]
]
helptexts=[
_INTL("Search for Pokémon based on selected parameters."),[
_INTL("List by the first letter in the name.\r\nSpotted Pokémon only."),
_INTL("List by body color.\r\nSpotted Pokémon only."),
_INTL("List by type.\r\nOwned Pokémon only."),
_INTL("List by type.\r\nOwned Pokémon only."),
_INTL("Select the Pokédex listing mode."),
_INTL("Execute search."),
],
_INTL("Switch Pokédex listings."),[
_INTL("Select the Pokédex listing mode."),
_INTL("Execute switch."),
],
_INTL("Return to the Pokédex."),[
_INTL("Return to the Pokédex.")
]
]
messagebox.text=searchlist.getText(helptexts,searchlist.index)
end
def pbChangeToDexEntry(species)
@sprites["dexentry"].visible=true
@sprites["overlay"].visible=true
@sprites["overlay"].bitmap.clear
basecolor=Color.new(0,0,0)
shadowcolor=Color.new(184,184,184)
indexNumber=pbGetRegionalNumber(pbGetPokedexRegion(),species)
indexNumber=species if indexNumber==0
textpos=[
[_ISPRINTF("No. {1:03d} {2:s}",indexNumber,PBSpecies.getName(species)),96*2,24*2,0,basecolor,shadowcolor],
[sprintf(_INTL("HT")),96*2,56*2,0,basecolor,shadowcolor],
[sprintf(_INTL("WT")),96*2,72*2,0,basecolor,shadowcolor]
]
if $Trainer.owned[species]
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,species,33)
height=dexdata.fgetw
weight=dexdata.fgetw
dexdata.close
kind=pbGetMessage(MessageTypes::Kinds,species)
dexentry=pbGetMessage(MessageTypes::Entries,species)
inches=(height/0.254).round
pounds=(weight/0.45359).round
textpos.push([_ISPRINTF("{1:s} POKéMON",kind),100*2,40*2,0,basecolor,shadowcolor])
textpos.push([_ISPRINTF("{1:.1f} m",height/10.0),184*2,56*2,1,basecolor,shadowcolor])
textpos.push([_ISPRINTF("{1:.1f} kg",weight/10.0),184*2,72*2,1,basecolor,shadowcolor])
# textpos.push([_ISPRINTF("{1:d}'{2:02d}\"",inches/12,inches%12),146*2,56*2,0,basecolor,shadowcolor])
# textpos.push([_ISPRINTF("{1:4.1f} lbs.",pounds/10),184*2,72*2,1,basecolor,shadowcolor])
drawTextEx(@sprites["overlay"].bitmap,
8*2,96*2,232*2,4,dexentry,basecolor,shadowcolor)
else
textpos.push([_INTL("????? POKéMON"),100*2,40*2,0,basecolor,shadowcolor])
textpos.push([_INTL("???.? m"),184*2,56*2,1,basecolor,shadowcolor])
textpos.push([_INTL("???.? kg"),184*2,72*2,1,basecolor,shadowcolor])
# textpos.push([_INTL("??'??\""),146*2,56*2,0,basecolor,shadowcolor])
# textpos.push([_INTL("???.? lbs."),184*2,72*2,1,basecolor,shadowcolor])
end
pbDrawTextPositions(@sprites["overlay"].bitmap,textpos)
pkmnbitmap=BitmapCache.load_bitmap(pbPokemonBitmapFile(species,false))
@sprites["overlay"].bitmap.blt(
40-(pkmnbitmap.width-128)/2,
48-(pkmnbitmap.height-128)/2,
pkmnbitmap,pkmnbitmap.rect)
pkmnbitmap.dispose
pbPlayCry(species)
pbFadeInAndShow(@sprites)
end
def pbStartDexEntryScene(species)
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["dexentry"]=SpriteWrapper.new(@viewport)
@sprites["dexentry"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/dexentry.png")
@sprites["dexentry"].visible=false
@sprites["overlay"]=SpriteWrapper.new(@viewport)
@sprites["overlay"].bitmap=Bitmap.new(Graphics.width,Graphics.height)
pbSetSystemFont(@sprites["overlay"].bitmap)
@sprites["overlay"].x=0
@sprites["overlay"].y=0
@sprites["overlay"].visible=false
pbChangeToDexEntry(species)
end
def pbMiddleDexEntryScene
loop do
Graphics.update
Input.update
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
break
end
end
end
def pbDexEntry(index)
oldsprites=pbFadeOutAndHide(@sprites)
pbChangeToDexEntry(@dexlist[index][0])
curindex=index
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
pbFadeOutAndHide(@sprites)
scene=PokemonAreaMapScene.new
screen=PokemonAreaMap.new(scene)
screen.pbStartScreen(@dexlist[curindex][0])
pbChangeToDexEntry(@dexlist[curindex][0])
elsif Input.trigger?(Input::B)
break
elsif Input.trigger?(Input::A)
pbPlayCry(@dexlist[curindex][0])
elsif Input.trigger?(Input::UP)
nextindex=-1
i=curindex-1; loop do break unless i>=0
if $Trainer.seen[@dexlist[i][0]]
nextindex=i
break
end
i-=1
end
if nextindex>=0
Input.update
pbFadeOutAndHide(@sprites)
pbChangeToDexEntry(@dexlist[nextindex][0])
curindex=nextindex
end
next
elsif Input.trigger?(Input::DOWN)
nextindex=-1
for i in [email=curindex+1...@dexlist.length]curindex+1...@dexlist.length[/email]
if $Trainer.seen[@dexlist[i][0]]
nextindex=i
break
end
end
if nextindex>=0
Input.update
pbFadeOutAndHide(@sprites)
pbChangeToDexEntry(@dexlist[nextindex][0])
curindex=nextindex
end
next
end
end
pbFadeOutAndHide(@sprites)
$PokemonGlobal.pokedexIndex=curindex if !@searchResults
@sprites["pokedex"].index=curindex
@sprites["pokedex"].refresh
iconspecies=@sprites["pokedex"].species
iconspecies=0 if !$Trainer.seen[iconspecies]
setIconBitmap(pbPokemonBitmapFile(iconspecies,false))
pbFadeInAndShow(@sprites,oldsprites)
end
def pbDexSearch
oldsprites=pbFadeOutAndHide(@sprites)
params=[]
params[0]=0
params[1]=0
params[2]=0
params[3]=0
params[4]=0
params[5]=$PokemonGlobal.pokedexMode
@nameCommands=[
_INTL("DON'T SPECIFY"),
_INTL("ABC"),_INTL("DEF"),_INTL("GHI"),
_INTL("JKL"),_INTL("MNO"),_INTL("PQR"),
_INTL("STU"),_INTL("VWX"),_INTL("YZ")
]
@typeCommands=[
_INTL("NONE"),
_INTL("NORMAL"),_INTL("FIGHTING"),_INTL("FLYING"),
_INTL("POISON"),_INTL("GROUND"),_INTL("ROCK"),
_INTL("BUG"),_INTL("GHOST"),_INTL("STEEL"),
_INTL("FIRE"),_INTL("WATER"),_INTL("GRASS"),
_INTL("ELECTRIC"),_INTL("PSYCHIC"),_INTL("ICE"),
_INTL("DRAGON"),_INTL("DARK")
]
@colorCommands=[
_INTL("DON'T SPECIFY"),
_INTL("RED"),_INTL("BLUE"),_INTL("YELLOW"),
_INTL("GREEN"),_INTL("BLACK"),_INTL("BROWN"),
_INTL("PURPLE"),_INTL("GRAY"),_INTL("WHITE"),_INTL("PINK")
]
@orderCommands=[
_INTL("NUMERIC MODE"),
_INTL("A TO Z MODE"),
_INTL("HEAVIEST MODE"),
_INTL("LIGHTEST MODE"),
_INTL("TALLEST MODE"),
_INTL("SMALLEST MODE")
]
@orderHelp=[
_INTL("Pokémon are listed according to their number."),
_INTL("Spotted and owned Pokémon are listed alphabetically."),
_INTL("Owned Pokémon are listed from the heaviest to the lightest."),
_INTL("Owned Pokémon are listed from the lightest to the heaviest."),
_INTL("Owned Pokémon are listed from the tallest to the smallest."),
_INTL("Owned Pokémon are listed from the smallest to the tallest.")
]
@sprites["searchlist"].index=1
searchlist=@sprites["searchlist"]
messagebox=@sprites["messagebox"]
@sprites["messagebox"].visible=true
@sprites["auxlist"].visible=true
@sprites["searchlist"].visible=true
@sprites["searchbg"].visible=true
pbRefreshDexSearch(params)
pbFadeInAndShow(@sprites)
loop do
Graphics.update
Input.update
oldindex=searchlist.index
searchlist.update
if searchlist.index!=oldindex
pbRefreshDexSearch(params)
end
if Input.trigger?(Input::C)
command=searchlist.indexToCommand(searchlist.index)
if command==[2,0]
break
end
if command==[0,0]
params[0]=pbDexSearchCommands(@nameCommands,params[0])
pbRefreshDexSearch(params)
elsif command==[0,1]
params[1]=pbDexSearchCommands(@colorCommands,params[1])
pbRefreshDexSearch(params)
elsif command==[0,2]
params[2]=pbDexSearchCommands(@typeCommands,params[2])
pbRefreshDexSearch(params)
elsif command==[0,3]
params[3]=pbDexSearchCommands(@typeCommands,params[3])
pbRefreshDexSearch(params)
elsif command==[0,4]
params[4]=pbDexSearchCommands(@orderCommands,params[4],@orderHelp)
pbRefreshDexSearch(params)
elsif command==[0,5]
dexlist=pbSearchDexList(params)
if dexlist.length==0
Kernel.pbMessage(_INTL("No matching Pokémon were found."))
else
@dexlist=dexlist
@sprites["pokedex"].commands=@dexlist
@sprites["pokedex"].index=0
@sprites["pokedex"].refresh
iconspecies=@sprites["pokedex"].species
iconspecies=0 if !$Trainer.seen[iconspecies]
@sprites["infowindow"].text=_INTL("X: BACK\r\nZ: MENU\r\nF5: SEARCH")
setIconBitmap(pbPokemonBitmapFile(iconspecies,false))
@searchResults=true
break
end
elsif command==[1,0]
params[5]=pbDexSearchCommands(@orderCommands,params[5],@orderHelp)
pbRefreshDexSearch(params)
elsif command==[1,1]
$PokemonGlobal.pokedexMode=params[5]
pbRefreshDexList
break
end
elsif Input.trigger?(Input::B)
break
end
end
pbFadeOutAndHide(@sprites)
pbFadeInAndShow(@sprites,oldsprites)
Input.update
return 0
end
def pbMenu
ret=0
commands=[_INTL("BACK TO LIST"),_INTL("LIST TOP"),_INTL("LIST BOTTOM"),_INTL("CLOSE POKéDEX")]
using(cmdwindow=Window_CommandPokemon.new(commands)) {
cmdwindow.viewport=@viewport
cmdwindow.resizeToFit(cmdwindow.commands)
pbBottomRight(cmdwindow)
loop do
Graphics.update
Input.update
cmdwindow.update
if Input.trigger?(Input::B)
ret=0
break
end
if Input.trigger?(Input::C)
ret=cmdwindow.index
break
end
end
}
return ret
end
def pbCloseSearch
oldsprites=pbFadeOutAndHide(@sprites)
@searchResults=false
pbRefreshDexList($PokemonGlobal.pokedexIndex)
pbFadeInAndShow(@sprites,oldsprites)
end
def pbPokedex
loop do
Graphics.update
Input.update
oldindex=@sprites["pokedex"].index
@sprites["pokedex"].update
if oldindex!=@sprites["pokedex"].index
$PokemonGlobal.pokedexIndex=@sprites["pokedex"].index if !@searchResults
iconspecies=@sprites["pokedex"].species
iconspecies=0 if !$Trainer.seen[iconspecies]
setIconBitmap(pbPokemonBitmapFile(iconspecies,false))
end
@sprites["icon"].update
if Input.trigger?(Input::B)
if @searchResults
pbCloseSearch
else
break
end
elsif Input.trigger?(Input::C)
if $Trainer.seen[@sprites["pokedex"].species]
pbDexEntry(@sprites["pokedex"].index)
end
elsif Input.trigger?(Input::F5)
pbDexSearch
elsif Input.trigger?(Input::A)
retval=pbMenu
case retval
when 1 # List Top
@sprites["pokedex"].index=1
when 2 # List Bottom
@sprites["pokedex"].index=@sprites["pokedex"].count-1
when 3
if @searchResults
pbCloseSearch
else
break
end
end
end
end
end
def pbEndScene
pbFadeOutAndHide(@sprites)
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
end
class PokemonPokedex
def initialize(scene)
@scene=scene
end
def pbDexEntry(species)
@scene.pbStartDexEntryScene(species)
@scene.pbMiddleDexEntryScene
@scene.pbEndScene
end
def pbStartScreen
@scene.pbStartScene
@scene.pbPokedex
@scene.pbEndScene
end
end
and err, thanks if you can find a code that I can put in an event to add a national dex.