• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

[Archive] Pokemon Essentials: Starter Kit for RPG Maker XP

Status
Not open for further replies.
How do I edit the Encounter chances limit in the Encounters Editor? What I mean is right now it displays 20,20,10,10,10,10,5,5,4,4,1,1 but I want it to display 100,95,90...all the way down to 5. Where would I edit that in the scripts? I've already edited PokemonMap lines 288-300 so it has those encounter chance %'s.
I just want to make it more flexible, meaning having more choices for encounter chance.
 
how do i change the color of the text in battle to white?
[PokeCommunity.com] [Archive] Pokemon Essentials: Starter Kit for RPG Maker XP
 
Can anyone post the original pokegear script. I'm playing around with mine and screwed up it lol.
 
I'm sorry but I don't really get what you mean. I'm asking where in the Scripts do I edit to change the maximum Encounter Chances for the Encounter Editor.
I don't know.
But original game make custom encounters by making same species and leven and then count up all. example: rattata lv 2-4 to 20,20,10,10 and then in-game chance is 60%.
 
Can anyone post the original pokegear script. I'm playing around with mine and screwed up it lol.
Code:
#==============================================================================
# - Scene_Pokegear
#------------------------------------------------------------------------------
# Modified By Harshboy
# Modified by Peter O.
# Also Modified By OblivionMew
#==============================================================================
class Scene_Pokegear
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # main
  #--------------------------------------------------------------------------
  def main

# Main Menu settings you can add or change these
    commands=[
      _INTL("Map"),
      _INTL("Radio"),
      _INTL("Phone"),
      _INTL("Exit")
    ]
    @command_window = Window_CommandPokemon.new(commands,160)
    @command_window.index = @menu_index
    @command_window.x = (Graphics.width - @command_window.width) - 8
    @command_window.y = 640
    @card = GifSprite.new
    @card.setBitmap("Graphics/Pictures/Pokegearback")
    @card.x = 0
    @card.y = 0

 
    @map_icon = Sprite.new
    @map_icon.bitmap = RPG::Cache.picture("mapicon")
    @map_icon.x = 0
    @map_icon.y = 57
    @button_up = Sprite.new
    @button_up.bitmap = RPG::Cache.picture("buttonunp")
    @button_up.x = 320
    @button_up.y = 80
    @button_down = Sprite.new
    @button_down.bitmap = RPG::Cache.picture("buttonunp")
    @button_down.x = 320
    @button_down.y = 165
    @arr_icon=AnimatedSprite.create("Graphics/Pictures/selarr.png",8,1)
    @arr_icon.x = 60
    @arr_icon.y = 57
    @arr_icon.start
    @radio_icon = Sprite.new
    @radio_icon.bitmap = RPG::Cache.picture("radicon")
    @radio_icon.x = 0
    @radio_icon.y = 109
@arr_icon.z=99999
    @phone_icon = Sprite.new
    @phone_icon.bitmap = RPG::Cache.picture("phonicon")
    @phone_icon.x = 0
    @phone_icon.y = 161
 
    @exit_icon = Sprite.new
    @exit_icon.bitmap = RPG::Cache.picture("exicon")
    @exit_icon.x = 0
    @exit_icon.y = 265

    @trainer = Sprite.new
    @trainer.x = 360
    @trainer.y = 80
    @trainer.zoom_x = 1.0
    @trainer.zoom_y = 1.0
    @trainer.z = 99999
    @trainer.bitmap = RPG::Cache.character(
          sprintf("trainer%03d.png",$Trainer.trainertype),0
    )
    @info = Window_UnformattedTextPokemon.new("")
    @info.height = Graphics.height / 4 + 16
    @info.width = Graphics.width / 2 + 74
    @info.x = 160
    @info.y = Graphics.height - @info.height
    @info.z = 99999
    @info.letterbyletter=false
    @target_window = Window_UnformattedTextPokemon.new("")
    @target_window.visible = false
    @target_window.active = false
    @target_window.letterbyletter=false
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    @target_window.dispose
    Graphics.freeze
    @command_window.dispose
    @trainer.dispose
    @card.bitmap.dispose
    @info.dispose
    @arr_icon.dispose
    @map_icon.dispose
    @phone_icon.dispose
    @radio_icon.dispose
    @exit_icon.dispose
    @button_up.dispose
    @button_down.dispose
  end
  #--------------------------------------------------------------------------
  # update the scene
  #--------------------------------------------------------------------------
  def update
      @arr_icon.update
      @command_window.update
    @info.update
  if Input.press?(Input::UP)
   @button_up.bitmap = RPG::Cache.picture("buttonp")
 else
    @button_up.bitmap = RPG::Cache.picture("buttonunp")
  end
  
   if Input.press?(Input::DOWN)
   @button_down.bitmap = RPG::Cache.picture("buttonp")
 else
    @button_down.bitmap = RPG::Cache.picture("buttonunp")
    end
   case @command_window.index
   when 0
 @map_icon.x = 32
 @phone_icon.x = 0
 @radio_icon.x = 0
 @exit_icon.x = 0
@arr_icon.y=57
 when 1
 @map_icon.x = 0
 @phone_icon.x = 0
 @radio_icon.x = 32
  @exit_icon.x = 0
@arr_icon.y=109
 when 2
 @map_icon.x = 0 
 @phone_icon.x = 32
 @radio_icon.x = 0
 @exit_icon.x = 0
@arr_icon.y=161
when 3
 @map_icon.x = 0
 @phone_icon.x = 0
 @radio_icon.x = 0
 @exit_icon.x = 32
@arr_icon.y=265
  
end
    #update command window and the info if it's active
    if @command_window.active
      update_command
      update_info
      return
    end
 
  end
  #--------------------------------------------------------------------------
  # update the command window
  #--------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
 
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        pbFadeOutIn(99999) {
         scene=PokemonRegionMapScene.new
         screen=PokemonRegionMap.new(scene)
         screen.pbStartScreen
        } 
      when 1
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Jukebox.new
      when 2
        $game_system.se_play($data_system.decision_se)
        pbFadeOutIn(99999) {
           PokemonPhoneScene.new.start
        }
      when 3
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Map.new
      end
      return
    end
  end
  def update_info
    case @command_window.index
    when 0
      @info.text=_INTL("A Map\r\nShows visited Places.")
    when 1
      @info.text=_INTL("A Radio\r\nUsed to listen to Music.")
    when 2
      @info.text=_INTL("A Phone\r\nUsed to call People.")
    when 3
      @info.text=_INTL("Closes the PokeGear and returns to the game.")
    end
  end
end
 
Hey guys.. I know I asked this earlier, but no one answered, so bear with me...
I'm looking for basics on pokestarter advanced scripting. I already know how to make simple scripts, it's a bit easy.. :/

I just need a link.. I've tried searching but I can't seem to find much of 'basics' especially for pokestarter.
What I really want to find out how to do is making Input scripts and Timers.. I'd tell you my idea but I'm scared of getting it stolen.
 
Thanks! I tried using the Pokegear but I got this error:

Exception: Arguement Error
Message: Wrong number of arguments (0 for 1)
Pokegear: 31 in 'initialize'
Pokegear: 31 in 'new'
Pokegear: 31 in 'main'
Main: 44 in 'mainFunctionDebug'
Main: 23 in 'mainfunction'
Main: 23 in 'pbCriticalCode'
Main: 23 in 'mainfunction'
Main:51
Main: 50 in loop
Main:59

What's going on? Looks like a whole new language and I can't begin to comphrend whats going on.
 
Thanks! I tried using the Pokegear but I got this error:

Exception: Arguement Error
Message: Wrong number of arguments (0 for 1)
Pokegear: 31 in 'initialize'
Pokegear: 31 in 'new'
Pokegear: 31 in 'main'
Main: 44 in 'mainFunctionDebug'
Main: 23 in 'mainfunction'
Main: 23 in 'pbCriticalCode'
Main: 23 in 'mainfunction'
Main:51
Main: 50 in loop
Main:59

What's going on? Looks like a whole new language and I can't begin to comphrend whats going on.
The error occurs because the scripts I gave you were from a few versions back, before poccil started messing with displaying pictures. An oversight on my part.

Here's the fix. Remove all the lines in red and replace them with the ones in blue.
Code:
[FONT=monospace][COLOR=Red]- @command_window = Window_CommandPokemon.new(commands,160)
- @command_window.index = @menu_index
- @command_window.x = (Graphics.width - @command_window.width) - 8
- @command_window.y = 640
- @card = GifSprite.new
- @card.setBitmap("Graphics/Pictures/Pokegearback")
- @card.x = 0
- @card.y = 0
- @map_icon = Sprite.new
- @map_icon.bitmap = RPG::Cache.picture("mapicon")
- @map_icon.x = 0
- @map_icon.y = 57
- @button_up = Sprite.new
- @button_up.bitmap = RPG::Cache.picture("buttonunp")
- @button_up.x = 320
- @button_up.y = 80
- @button_down = Sprite.new
- @button_down.bitmap = RPG::Cache.picture("buttonunp")
- @button_down.x = 320
- @button_down.y = 165
- @arr_icon=AnimatedSprite.create("Graphics/Pictures/selarr.png",8,1)
- @arr_icon.x = 60
- @arr_icon.y = 57
- @arr_icon.start
- @radio_icon = Sprite.new
- @radio_icon.bitmap = RPG::Cache.picture("radicon")
- @radio_icon.x = 0
- @radio_icon.y = 109
- @arr_icon.z=99999
- @phone_icon = Sprite.new
- @phone_icon.bitmap = RPG::Cache.picture("phonicon")
- @phone_icon.x = 0
- @phone_icon.y = 161
- @exit_icon = Sprite.new
- @exit_icon.bitmap = RPG::Cache.picture("exicon")
- @exit_icon.x = 0
- @exit_icon.y = 265
- @trainer = Sprite.new
- @trainer.x = 360
- @trainer.y = 80
- @trainer.zoom_x = 1.0
- @trainer.zoom_y = 1.0
- @trainer.z = 99999
- @trainer.bitmap = RPG::Cache.character(
-       sprintf("trainer%03d.png",$Trainer.trainertype),0
- )
- @info = Window_UnformattedTextPokemon.new("")
- @info.height = Graphics.height / 4 + 16
- @info.width = Graphics.width / 2 + 74
- @info.x = 160
- @info.y = Graphics.height - @info.height
- @info.z = 99999
- @info.letterbyletter=false
- @target_window = Window_UnformattedTextPokemon.new("")
- @target_window.visible = false
- @target_window.active = false
- @target_window.letterbyletter=false[/COLOR]
[COLOR=RoyalBlue]+ @sprites={}
+ @sprites["command_window"] = Window_CommandPokemon.new(commands,160)
+ @sprites["command_window"].index = @menu_index
+ @sprites["command_window"].x = (Graphics.width - @sprites["command_window"].width) - 8
+ @sprites["command_window"].y = 640
+ @sprites["card"] = IconSprite.new(0,0)
+ @sprites["card"].setBitmap("Graphics/Pictures/Pokegearback")
+ @sprites["map_icon"] = IconSprite.new(0,57)
+ @sprites["map_icon"].setBitmap("Graphics/Pictures/mapicon")
+ @sprites["button_up"] = IconSprite.new(320,80)
+ @sprites["button_up"].setBitmap("Graphics/Pictures/buttonunp")
+ @sprites["button_down"] = IconSprite.new(320,165)
+ @sprites["button_down"].setBitmap("Graphics/Pictures/buttonunp")
+ @sprites["arr_icon"]=AnimatedSprite.create("Graphics/Pictures/selarr",8,1)
+ @sprites["arr_icon"].x = 60
+ @sprites["arr_icon"].y = 57
+ @sprites["arr_icon"].z=99999
+ @sprites["arr_icon"].start
+ @sprites["radio_icon"] = IconSprite.new(0,109)
+ @sprites["radio_icon"].setBitmap("Graphics/Pictures/radicon")
+ @sprites["phone_icon"] = IconSprite.new(0,161)
+ @sprites["phone_icon"].setBitmap("Graphics/Pictures/phonicon")
+ @sprites["exit_icon"] = IconSprite.new(0,265)
+ @sprites["exit_icon"].setBitmap("Graphics/Pictures/exicon")
+ @sprites["trainer"] = IconSprite.new(360,80)
+ @sprites["trainer"].setBitmap(sprintf("Graphics/Characters/trainer%03d",$Trainer.trainertype))
+ @sprites["trainer"].z = 99999
+ @sprites["info"] = Window_UnformattedTextPokemon.new("")
+ @sprites["info"].height = Graphics.height / 4 + 16
+ @sprites["info"].width = Graphics.width / 2 + 74
+ @sprites["info"].x = 160
+ @sprites["info"].y = Graphics.height - @sprites["info"].height
+ @sprites["info"].z = 99999
+ @sprites["info"].letterbyletter=false[/COLOR]
  Graphics.transition


[COLOR=Red]- @target_window.dispose[/COLOR]
  Graphics.freeze
[COLOR=Red]- @command_window.dispose
- @trainer.dispose
- @card.bitmap.dispose
- @info.dispose
- @arr_icon.dispose
- @map_icon.dispose
- @phone_icon.dispose
- @radio_icon.dispose
- @exit_icon.dispose
- @button_up.dispose
- @button_down.dispose[/COLOR]
[COLOR=RoyalBlue]+ pbDisposeSpriteHash(@sprites)[/COLOR][/FONT]
 
The old error's gone but now there's a new one:


Exception: No Method Error
Message: Undefined method create for AnimatedSprite:Class
Pokegear:40:in 'main'
Main:44 in mainFunctionDebug
Main 23 in mainFunction
Main 23 in pbCriticalCode
Main 23 in mainFunction
Main 51
Main 50 in loop
Main 59
 
The old error's gone but now there's a new one:


Exception: No Method Error
Message: Undefined method create for AnimatedSprite:Class
Pokegear:40:in 'main'
Main:44 in mainFunctionDebug
Main 23 in mainFunction
Main 23 in pbCriticalCode
Main 23 in mainFunction
Main 51
Main 50 in loop
Main 59
It doesn't know how to handle animated sprites, it seems. I recall there was a bit of a problem with them before. I don't know how to fix it, though; I'm not using a newer version of Essentials (as I said).

My advice is to look through a fresh copy of whatever version of Essentials you're using, and see what's going on. It's always sensible to keep a clean copy of whichever version you're using around, in case one changes the code too much. Personally, I quote out any line of code I change and put the changed code next to it, so I could theoretically (not that I ever will, of course) revert all the code back to its original version. It may make things a little messy, but I never make mistakes I can't easily fix.
 
Thanks trying to help though. I'll definitely look around.
 
Can I somehow change the "Sample Region" text show somewhwere else and only rectangle with name (not panel)? My map is here and most down city isn't visible in game.
 
Im using what I believe is the latest pokemon essentials starterkit and am trying to figure things out before I begin making a game.

I use the "$Trainer.pokedex=true" to give the pokedex to the player like it says in the notes, but when i try to use it i get this error.

---------------------------
Pokemon Essentials
---------------------------
Exception: NameError

Message: undefined local variable or method `center' for #<Window_Pokedex:0x9afc6b0>

PokemonPokedex:62:in `refresh'

PokemonPokedex:45:in `each'

PokemonPokedex:45:in `refresh'

PokemonPokedex:21:in `commands='

PokemonPokedex:412:in `pbRefreshDexList'

PokemonPokedex:295:in `pbStartScene'

PokemonPokedex:873:in `pbStartScreen'

PokemonMenu:145:in `pbStartPokemonMenu'

PokemonMenu:142:in `pbFadeOutIn'

PokemonMenu:142:in `pbStartPokemonMenu'



This exception was logged in errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
I know some other people are having the same problem from viewing their posts, but after digging I didn't see any answers...

Does anyone have an idea how to fix this? Or if not how to fix it, could someone post the script for a pokedex that works in PokemonEssentials?
 
I'm not sure how to help but you could try this pokedex script and see if it works:

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
  @[email protected]
  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
   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}",@commands[i][0],@commands[i][1])
   else
    text=_ISPRINTF("No.{1:03d} ----------",@commands[i][0])
   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

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_SimpleTextPokemon.newWithSize("",0,160,160,160,@viewport)
 @sprites["messagebox"]=Window_SimpleTextPokemon.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)
 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,species)
 case mode
  when 0
   return true
  when 1
   return $Trainer.seen[species]
  when 2, 3, 4, 5
   return $Trainer.owned[species]
 end
end

def pbCanAddForModeSearch?(mode,species)
 case mode
  when 0, 1
   return $Trainer.seen[species]
  when 2, 3, 4, 5
   return $Trainer.owned[species]
 end
end


def pbRefreshDexList(index=0)
 dexlist=[]
 dexdata=pbOpenDexData
 for i in 1..PBSpecies.getCount
  if pbCanAddForModeList?($PokemonGlobal.pokedexMode,i)
   pbDexDataOffset(dexdata,i,33)
   height=dexdata.fgetw
   weight=dexdata.fgetw
   dexlist.push([i,PBSpecies.getName(i),height,weight])
  end
 end
 dexdata.close
 case $PokemonGlobal.pokedexMode
  when 0 # Numerical mode
   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!
  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=[]
 dexdata=pbOpenDexData
 for i in 1..PBSpecies.getCount
  if pbCanAddForModeSearch?(params[4],i)
   pbDexDataOffset(dexdata,i,33)
   height=dexdata.fgetw
   weight=dexdata.fgetw
   dexlist.push([i,PBSpecies.getName(i),height,weight])
  end
 end
 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
     next (stype1==type1 && stype2==type2) ||
     (stype1==type2 && stype2==type1)
   elsif stype1>=0
     next type1==stype1 || type2==stype1
   else
     next type1==stype2 || type2==stype2
   end
  }
 end
 dexdata.close
 case params[4]
  when 0 # Numerical mode
   dexlist.sort!{|a,b| a[0]<=>b[0]}
  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 Pokemon based on selected parameters."),[
    _INTL("List by the first letter in the name.\r\nSpotted Pokemon only."),
    _INTL("List by body color.\r\nSpotted Pokemon only."),
    _INTL("List by type.\r\nOwned Pokemon only."),
    _INTL("List by type.\r\nOwned Pokemon only."),
    _INTL("Select the Pokedex listing mode."),
    _INTL("Execute search."),
  ],
  _INTL("Switch Pokedex listings."),[
    _INTL("Select the Pokedex listing mode."),
    _INTL("Execute switch."),
  ],
  _INTL("Return to the Pokedex."),[
   _INTL("Return to the Pokedex.")
  ]
 ]
 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)
 textpos=[
  [_ISPRINTF("No. {1:03d}  {2:s}",species,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
 pkmnwav=sprintf("Audio/SE/%03dCry",species)
 Audio.se_play(pkmnwav,100,100) rescue nil
 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)
      pkmnwav=sprintf("Audio/SE/%03dCry",@dexlist[curindex][0])
      Audio.se_play(pkmnwav,100,100) rescue nil
    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 protected]
       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("Pokemon are listed according to their number."),
        _INTL("Spotted and owned Pokemon are listed alphabetically."),
        _INTL("Owned Pokemon are listed from the heaviest to the lightest."),
        _INTL("Owned Pokemon are listed from the lightest to the heaviest."),
        _INTL("Owned Pokemon are listed from the tallest to the smallest."),
        _INTL("Owned Pokemon 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 Pokemon 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
 
Last edited:
I will ask this once more..
Hey guys.. I know I asked this earlier, but no one answered, so bear with me...
I'm looking for basics on pokestarter advanced scripting. I already know how to make simple scripts, it's a bit easy.. :/

I just need a link.. I've tried searching but I can't seem to find much of 'basics' especially for pokestarter.
What I really want to find out how to do is making Input scripts and Timers.. I'd tell you my idea but I'm scared of getting it stolen
 
Status
Not open for further replies.
Back
Top