• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

[Essentials Tutorial] How to add more features to the Pokégear

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Online now
Map, Phone and Jukebox aren't enough features for you? Let's add more!

In Pokégear script section, after line '@cmdJukebox=-1' add '@cmdSomething=-1', after line 'commands[@cmdJukebox=commands.length]=_INTL("Jukebox")' add 'commands[@cmdSomething=commands.length]=_INTL("Something")'. Before the last line 'return', add the scene call in a 'if' statement with the command index, something like:

Code:
      if @cmdSomething>=0 && @sprites["command_window"].index==@cmdSomething
        pbPlayDecisionSE()
        pbFadeOutIn(99999) {
           scene=SomethingScene.new
           screen=Something.new(scene)
           screen.pbStartScreen
        }
      end

Change all the "Something" for something (lol) like DayCareChecker (works with this script if you use 'screen.startScreen' instead of 'screen.pbStartScreen' in the scene call). You can put a icon if you match the name, like the pokégear icons in Graphics/Pictures folder.
 
31
Posts
11
Years
  • Seen Nov 9, 2013
Thanks n_n Say if I wanted to make a sort of, mail/email system, how would that work? I know how to make scenes, just not how to populate them
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Online now
Thanks n_n Say if I wanted to make a sort of, mail/email system, how would that work? I know how to make scenes, just not how to populate them
Use a selection for choosing the values in a list, I suggest something like Kernel.pbMessage("Choose something",["choice 1","choice 2","choice 3","Cancel",3)

For showing a text (you need to define the background IMAGEPATH):

Code:
 def pbStartScene
    @sprites={} 
    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=99999
    @sprites["background"]=IconSprite.new(0,0,@viewport)
    @sprites["background"].setBitmap(IMAGEPATH)
    @sprites["background"].x=(Graphics.width-@sprites["background"].bitmap.width)/2
    @sprites["background"].y=(Graphics.height-@sprites["background"].bitmap.height)/2
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    pbSetSystemFont(@sprites["overlay"].bitmap)
    overlay=@sprites["overlay"].bitmap
    overlay.clear 
    marginLeft=32
    marginRight=32
    baseColor=Color.new(72,72,72)
    shadowColor=Color.new(160,160,160)
    textPositions=["Title goes here",Graphics.width/2,0,2,baseColor,shadowColor]]
    pbDrawTextPositions(overlay,textPositions)
    text = "text text text text text text text text text text text text text text text"
    drawTextEx(overlay,marginLeft,64,Graphics.width-marginLeft-marginRight,8,
        text,baseColor,shadowColor)
    pbFadeInAndShow(@sprites) { update }
  end
Look at my diploma tutorial for a better example.
 
60
Posts
13
Years
  • Seen Jun 2, 2023
small question: I want the pokedex to be on the pokegear instead of in the menu screen along with a pokemon storage check (you can't move your pokemon from there but merely check their summary)
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Online now
small question: I want the pokedex to be on the pokegear instead of in the menu screen along with a pokemon storage check (you can't move your pokemon from there but merely check their summary)
Simply do the tutorial and for the last part (of each one) do something like:

Code:
      if @cmdPokedex>=0 && @sprites["command_window"].index==@cmdPokedex # I copied for menu script
        pbPlayDecisionSE()
        if DEXDEPENDSONLOCATION
          pbFadeOutIn(99999) {
             scene=PokemonPokedexScene.new
             screen=PokemonPokedex.new(scene)
             screen.pbStartScreen
          }
        else
          if $PokemonGlobal.pokedexViable.length==1
            $PokemonGlobal.pokedexDex=$PokemonGlobal.pokedexViable[0]
            $PokemonGlobal.pokedexDex=-1 if $PokemonGlobal.pokedexDex==$PokemonGlobal.pokedexUnlocked.length-1
            pbFadeOutIn(99999) {
               scene=PokemonPokedexScene.new
               screen=PokemonPokedex.new(scene)
               screen.pbStartScreen
            }
          else
            $scene = Scene_PokedexMenu.new # Changed
          end
        end
      end
      if @cmdStorage>=0 && @sprites["command_window"].index==@cmdStorage
        pbFadeOutIn(99999){
          scene=PokemonStorageScene.new
          screen=PokemonStorageScreen.new(scene,$PokemonStorage,false) # 3 parameters
          screen.pbStartScreen(2)
        }
      end

In PokemonStorage, change the line 'def initialize(scene,storage)' to:

Code:
  def initialize(scene,storage,actionsEnabled=true)
    @actionsEnabled = actionsEnabled


Change the second 'command=pbShowCommands(helptext,commands)' to:

Code:
          actionsDisabled=[
             _INTL("Move"),
             _INTL("Store"),
             _INTL("Withdraw"),
             _INTL("Item"),
             _INTL("Release")
          ]
          actionsDisabledPositions=[]
          if !@actionsEnabled
            count = commands.size
            while(count>0) # Goes backward to memorize the positions
              count-=1
              if actionsDisabled.include?(commands[count])
                actionsDisabledPositions.push(count)
                commands.delete_at(count)
              end  
            end
            actionsDisabledPositions.sort!
          end
          command=pbShowCommands(helptext,commands)
          for position in actionsDisabledPositions
            command+=1 if command>=position
          end

To make the back button in pokédex returns to PokéGear: In PokemonPokedex change every 'Scene_Map.new' to 'Scene_Pokegear.new'
 
Last edited:
63
Posts
11
Years
  • Seen Mar 17, 2015
thank you very much =) the day cary stuff works fine , but ice tried toput the voltorb flip in this event ,but i got this error ,when i end the voltorb flip scene

---------------------------
Pokemon 1
---------------------------
Exception: NoMethodError

Message: undefined method `new' for nil:NilClass

PokemonPokegear:178:in `update_command'

PokemonPokegear:177:in `pbFadeOutIn'

PokemonPokegear:177:in `update_command'

PokemonPokegear:135:in `update'

PokemonPokegear:116:in `main'

PokemonPokegear:113:in `loop'

PokemonPokegear:120:in `main'

PokemonUtilities:991:in `pbLoadRpgxpScene'

PokemonPauseMenu:147:in `pbStartPokemonMenu'

PokemonPauseMenu:142:in `loop'



This exception was logged in

C:\Users\Salem\Saved Games/Pokemon 1/errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Online now
thank you very much =) the day cary stuff works fine , but ice tried toput the voltorb flip in this event ,but i got this error ,when i end the voltorb flip scene
I followed the instructions and manage it (I only used 'pbVoltorbFlip' after 'pbPlayDecisionSE()' in the last part). You probably done something wrong, try again.
 
63
Posts
11
Years
  • Seen Mar 17, 2015
sorry but i god some problems to fix it.please help me
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
fembutton=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearButtonf"))
if $Trainer.gender==1 && 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
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
refresh
super
end
end



#===============================================================================
# - Scene_Pokegear
#-------------------------------------------------------------------------------
# Modified By Harshboy
# Modified by Peter O.
# Also Modified By OblivionMew
# Overhauled by Maruno
#===============================================================================
class Scene_Pokegear
#-----------------------------------------------------------------------------
# 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.
@cmdMap=-1
@cmdPhone=-1
@cmdJukebox=-1
@cmdVoltorbFlip=-1
commands[@cmdMap=commands.length]=_INTL("Map")
commands[@cmdPhone=commands.length]=_INTL("Phone") if $PokemonGlobal.phoneNumbers &&
$PokemonGlobal.phoneNumbers.length>0
commands[@cmdJukebox=commands.length]=_INTL("Jukebox")
commands[@cmdPension=commands.length]=_INTL("Pensionschecker") if pbGet(102)
commands[@cmdVoltorbFlip=commands.length]=_INTL("VoltorbFlip")
@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)
femback=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearbgf"))
if $Trainer.gender==1 && 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"].index = @menu_index
@sprites["command_window"].x = Graphics.width
@sprites["command_window"].y = 0
for i in 0...commands.length
x=118
y=196 - (commands.length*24) + (i*48)
@sprites["button#{i}"]=PokegearButton.new(x,y,commands,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
pbUpdateSpriteHash(@sprites)
for i in 0...@sprites["command_window"].commands.length
sprite=@sprites["button#{i}"]
sprite.selected=(i==@sprites["command_window"].index) ? true : false
end
#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_Map.new
return
end
if Input.trigger?(Input::C)
if @cmdMap>=0 && @sprites["command_window"].index==@cmdMap
pbPlayDecisionSE()
pbFadeOutIn(99999) {
scene=PokemonRegionMapScene.new
screen=PokemonRegionMap.new(scene)
screen.pbStartScreen
}
end
if @cmdPhone>=0 && @sprites["command_window"].index==@cmdPhone
pbPlayDecisionSE()
pbFadeOutIn(99999) {
PokemonPhoneScene.new.start
}
end
if @cmdJukebox>=0 && @sprites["command_window"].index==@cmdJukebox
pbPlayDecisionSE()
$scene = Scene_Jukebox.new
end
if @cmdPension>=0 && @sprites["command_window"].index==@cmdPension
pbPlayDecisionSE()
pbFadeOutIn(99999) {
scene=DayCareCheckerScene.new
screen=DayCareChecker.new(scene)
screen.startScreen
}
end
if @cmdPension>=0 && @sprites["command_window"].index==@cmdVoltorbFlip
pbPlayDecisionSE()
pbFadeOutIn(99999) {
scene=pbVoltorbFlip.new
screen=pbVoltorbFlip.new(scene)
screen.pbStartScreen
}
end
return
end
end
end
 
Last edited:

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Online now
sorry but i god some problems to fix it.please help me
Like I said: You done something wrong. 'if @cmdPension>=0 && @sprites["command_window"].index==@cmdVoltorbFlip' line should be 'if @cmdVoltorbFlip>=0 && @sprites["command_window"].index==@cmdVoltorbFlip'. Change
Code:
pbFadeOutIn(99999) { 
  scene=pbVoltorbFlip.new
  screen=pbVoltorbFlip.new(scene)
  screen.pbStartScreen
}
to 'pbVoltorbFlip'
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
You'll also need the line @cmdPension=-1 in there somewhere. You could also try saying what your problems actually are.
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Online now
how is it posibal to put the bike in
could someone help me please
The last part is:

Code:
      if @cmdBicycle>=0 && @sprites["command_window"].index==@cmdBicycle #gearmod
        if pbBikeCheck
          if $PokemonGlobal.bicycle
            Kernel.pbDismountBike
          else
            Kernel.pbMountBike 
          end
          $scene = Scene_Map.new
        end
      end

To close the menu, I suggest you to create a new flag at PokemonTemp. At pause menu script, when this variable is true, just closes the menu (break the loop). At this script, set this variable to true after line '$scene = Scene_Map.new'.
 
63
Posts
11
Years
  • Seen Mar 17, 2015
ok thank you but the stuff with the pause menu is not needed i use another menu =)
thank you =)
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
The first post explains how to call your drawing app scripts from the Pokégear.

Describing how to make a whole new screen is not a part of this tutorial.
 
94
Posts
11
Years
  • Seen May 4, 2018
I tried to add the PokéDex to the PokéGear and got this error:

7fmz18n.png
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Online now
I tried to add the PokéDex to the PokéGear and got this error:

7fmz18n.png
Just delete the both lines '@scene.pbRefresh' for Pokégear script. I updated my other post.
 
94
Posts
11
Years
  • Seen May 4, 2018
Oh I tried that, but then when I opened the Pokédex from that option the Dex List didn't show up at first, took me straight to the first Dex. I tried again and this time it showed up. This doesn't happen when catching new Pokémon though. They show up in the Pokédex right after catching/getting them.

I didn't get an error, just that tiny glitch.
 
Back
Top