FANDOM


Adding themes to the Pokegear
This tutorial was written by PocketPlays.

This tutorial is related to the following pages:

Click here for more tutorials!


This tutorial will show you how to create more themes for the Pokégear.

Making the Themes Affect the base Pokégear

Paste this in place of line 11 in PScreen_Pokegear

    # Add more buttons here
    fembutton=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearButtonf"))
    # copy below to add more themes

This is does nothing but remind you where to add more buttons. Trust me its useful.

Now once that is pasted in, there is an if statement under the comment that looks like this:

if $Trainer.isFemale? && fembutton

change the if statement to look like this:

if $theme == 0 && fembutton

This change makes it so we can change the button color to the female version. The variable $theme won't do anything yet, but we'll get there.

Okay, now that you got those in the script, go to line 98 and paste this in:

     # add more backgrounds here
    femback=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearbgf"))
    # copy below to add more themes

Again, this is to remind you where to add the backgrounds.

Now change the if statement below the comment to this:

if $theme == 0 && femback

This will make it so we can change the background to the female version.

Before we do anything, we need to make an option to change the theme, so lets do that! After line 85 add this:

@cmdTheme=-1

After line 90 add this:

commands[@cmdTheme=commands.length]=_INTL("Change Theme")

After line 166 add this:

      if @cmdTheme>=0 && @sprites["command_window"].index==@cmdTheme
        pbPlayDecisionSE()
        $scene = Scene_Pokeoptions.new
      end

If you pay careful attention to the above lines you will notice the Pokeoptions scene, this is where the fun happens!

Making the Pokéoptions scene

The script below is just a copy of the Pokégear script with modifications to allow the changing of themes. Create a new script page and put it above main:

class PokegearButton < SpriteWrapper
  attr_reader :index
   attr_reader :name
   attr_accessor :selected
 
   def initialize(x,y,name="",index=0,viewport=nil)
    super(viewport)
    @index=index
    @name=name
     @selected=false
    # Add more buttons here
    fembutton=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearButtonf"))
    # copy below to add more themes
    if $theme == 0 && fembutton
      @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButtonf")
    else
       @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButton")
    end
     @contents=BitmapWrapper.new(@button.width,@button.height)
    self.bitmap=@contents
    self.x=x
     self.y=y
     refresh
     update
   end
 
   def dispose
     @button.dispose
    @contents.dispose
    super
   end
 
   def refresh
     self.bitmap.clear
    self.bitmap.blt(0,0,@button.bitmap,Rect.new(0,0,@button.width,@button.height))
    pbSetSystemFont(self.bitmap)
    textpos=[          # Name is written on both unselected and selected buttons
       [@name,self.bitmap.width/2,10,2,Color.new(248,248,248),Color.new(40,40,40)],
       [@name,self.bitmap.width/2,62,2,Color.new(248,248,248),Color.new(40,40,40)]
    ]
     pbDrawTextPositions(self.bitmap,textpos)
    icon=sprintf("Graphics/Pictures/pokegear"+@name)
    imagepos=[         # Icon is put on both unselected and selected buttons
       [icon,18,10,0,0,-1,-1],
       [icon,18,62,0,0,-1,-1]
    ]
     pbDrawImagePositions(self.bitmap,imagepos)
  end
 
   def update
     if self.selected
      self.src_rect.set(0,self.bitmap.height/2,self.bitmap.width,self.bitmap.height/2)
    else
       self.src_rect.set(0,0,self.bitmap.width,self.bitmap.height/2)
    end
     super
   end
 end
 
 
 
 #===============================================================================
# - Scene_Pokeoptions
#-------------------------------------------------------------------------------
# Copied the Pokegear script to the options similar
# All credits go to the people who made the Pokegear
# 
 # 
 #===============================================================================
class Scene_Pokeoptions
  #-----------------------------------------------------------------------------
  # initialize
   #-----------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
   #-----------------------------------------------------------------------------
  # main
   #-----------------------------------------------------------------------------
  def main
     commands=[]
 # OPTIONS - If you change these, you should also change update_command below.
    @cmdBoy=-1
     @cmdGirl=-1
     commands[@cmdBoy=commands.length]=_INTL("Boy")
    commands[@cmdGirl=commands.length]=_INTL("Girl")
    
     @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=99999
    @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButton")
    @sprites={}
     @sprites["background"] = IconSprite.new(0,0)
    # add more themes here
    femback=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearbgf"))
    # copy below to add more themes
    if $theme == 0 && femback
      @sprites["background"].setBitmap("Graphics/Pictures/pokegearbgf")
    else
       @sprites["background"].setBitmap("Graphics/Pictures/pokegearbg")
    end
     @sprites["command_window"] = Window_CommandPokemon.new(commands,160)
    @sprites["command_window"].visible = false
    @sprites["command_window"].index = @menu_index
    for i in 0...commands.length
      x=118
       y=196 - (commands.length*24) + (i*48)
      @sprites["button#{i}"]=PokegearButton.new(x,y,commands[i],i,@viewport)
      @sprites["button#{i}"].selected=(i==@sprites["command_window"].index)
      @sprites["button#{i}"].update
    end
     Graphics.transition
    loop do
       Graphics.update
      Input.update
      update
       if $scene != self
        break
       end
     end
     Graphics.freeze
    pbDisposeSpriteHash(@sprites)
  end
   #-----------------------------------------------------------------------------
  # update the scene
  #-----------------------------------------------------------------------------
  def update
     for i in 0...@sprites["command_window"].commands.length
      sprite=@sprites["button#{i}"]
      sprite.selected=(i==@sprites["command_window"].index) ? true : false
     end
     pbUpdateSpriteHash(@sprites)
    #update command window and the info if it's active
    if @sprites["command_window"].active
      update_command
      return
     end
   end
   #-----------------------------------------------------------------------------
  # update the command window
  #-----------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
      pbPlayCancelSE()
      $scene = Scene_Pokegear.new
      return
     end
     # Boy theme
     if Input.trigger?(Input::C)
      if @cmdBoy>=0 && @sprites["command_window"].index==@cmdBoy
        pbPlayDecisionSE()
        $theme=1
        $scene = Scene_Pokeoptions.new
      end
     # Girl theme
      if @cmdGirl>=0 && @sprites["command_window"].index==@cmdGirl
        pbPlayDecisionSE()
        $theme=0
           $scene = Scene_Pokeoptions.new
      end
       return
     end
   end
 end

Now the $theme variable is in play. Basically what you do to add more themes is make a new background and button png (copy the ones in the Picture folder and do whatever you want to them) and declare them in the places specified in both scripts.

Hopefully you enjoyed the themes you make and the simple changes needed to make it.

If you find any bugs or it somehow doesn't work, tell me please.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.