< >
Hello, guest! Please log in or register.

The PokéCommunity

Go Back     The PokéCommunity Forums > Create & Discover > Game Development > Scripts & Tutorials Essentials tutorial How to add more features to the Pokégear

Notices

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply Post Reply
 
Thread Tools
  #1    
Old May 8th, 2013 (4:06 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Map, Phone and Jukebox aren't enough features for you? Let's add more!

In Pokégear script section, after line [email protected]=-1' add [email protected]=-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"].[email protected]
        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.
Reply With Quote

Relevant Advertising!

  #2    
Old May 8th, 2013 (6:41 PM).
Tayuya of the Sound Four's Avatar
Tayuya of the Sound Four Tayuya of the Sound Four is offline
 
Join Date: Jan 2013
Gender: Female
Posts: 31
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
Reply With Quote
  #3    
Old May 11th, 2013 (2:54 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Quote:
Originally Posted by Tayuya of the Sound Four View Post
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=([email protected]["background"].bitmap.width)/2
    @sprites["background"].y=([email protected]["background"].bitmap.height)/2
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    pbSetSystemFont(@sprites["overlay"].bitmap)
    [email protected]["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.
Reply With Quote
  #4    
Old August 16th, 2013 (2:42 AM).
bartyboy6's Avatar
bartyboy6 bartyboy6 is offline
 
Join Date: Sep 2010
Gender: Male
Posts: 56
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)
Reply With Quote
  #5    
Old August 18th, 2013 (8:07 AM). Edited August 9th, 2014 by FL.
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Quote:
Originally Posted by bartyboy6 View Post
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"].[email protected] # 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"].[email protected]
        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 [email protected]
            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'
Reply With Quote
  #6    
Old August 23rd, 2013 (6:42 AM).
linkthehero's Avatar
linkthehero linkthehero is offline
 
Join Date: Sep 2012
Gender: Male
Posts: 66
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

Quote:
---------------------------
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
---------------------------
Reply With Quote
  #7    
Old August 27th, 2013 (9:04 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Quote:
Originally Posted by linkthehero View Post
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.
Reply With Quote
  #8    
Old August 30th, 2013 (11:14 PM). Edited August 30th, 2013 by linkthehero.
linkthehero's Avatar
linkthehero linkthehero is offline
 
Join Date: Sep 2012
Gender: Male
Posts: 66
sorry but i god some problems to fix it.please help me
Quote:
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)
[email protected]
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"[email protected])
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],i,@viewport)
@sprites["button#{i}"].selected=([email protected]["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
[email protected]["button#{i}"]
sprite.selected=([email protected]["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"].[email protected]
pbPlayDecisionSE()
pbFadeOutIn(99999) {
scene=PokemonRegionMapScene.new
screen=PokemonRegionMap.new(scene)
screen.pbStartScreen
}
end
if @cmdPhone>=0 && @sprites["command_window"].[email protected]
pbPlayDecisionSE()
pbFadeOutIn(99999) {
PokemonPhoneScene.new.start
}
end
if @cmdJukebox>=0 && @sprites["command_window"].[email protected]
pbPlayDecisionSE()
$scene = Scene_Jukebox.new
end
if @cmdPension>=0 && @sprites["command_window"].[email protected]
pbPlayDecisionSE()
pbFadeOutIn(99999) {
scene=DayCareCheckerScene.new
screen=DayCareChecker.new(scene)
screen.startScreen
}
end
if @cmdPension>=0 && @sprites["command_window"].[email protected]
pbPlayDecisionSE()
pbFadeOutIn(99999) {
scene=pbVoltorbFlip.new
screen=pbVoltorbFlip.new(scene)
screen.pbStartScreen
}
end
return
end
end
end
Reply With Quote
  #9    
Old September 1st, 2013 (9:51 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Quote:
Originally Posted by linkthehero View Post
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"].[email protected]' line should be 'if @cmdVoltorbFlip>=0 && @sprites["command_window"].[email protected]'. Change
Code:
pbFadeOutIn(99999) { 
  scene=pbVoltorbFlip.new
  screen=pbVoltorbFlip.new(scene)
  screen.pbStartScreen
}
to 'pbVoltorbFlip'
Reply With Quote
  #10    
Old September 1st, 2013 (11:37 AM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Posts: 5,111
You'll also need the line @cmdPension=-1 in there somewhere. You could also try saying what your problems actually are.
Reply With Quote
  #11    
Old September 2nd, 2013 (6:51 AM).
linkthehero's Avatar
linkthehero linkthehero is offline
 
Join Date: Sep 2012
Gender: Male
Posts: 66
thank you so much for the help
it works perfect =)
Reply With Quote
  #12    
Old December 28th, 2013 (8:36 AM).
linkthehero's Avatar
linkthehero linkthehero is offline
 
Join Date: Sep 2012
Gender: Male
Posts: 66
how is it posibal to put the bike in
could someone help me please
Reply With Quote
  #13    
Old January 1st, 2014 (12:15 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Quote:
Originally Posted by linkthehero View Post
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"].[email protected] #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'.
Reply With Quote
  #14    
Old January 1st, 2014 (3:00 PM).
linkthehero's Avatar
linkthehero linkthehero is offline
 
Join Date: Sep 2012
Gender: Male
Posts: 66
ok thank you but the stuff with the pause menu is not needed i use another menu =)
thank you =)
Reply With Quote
  #15    
Old January 27th, 2014 (6:50 AM).
TheMarkCrafter TheMarkCrafter is offline
roses are red, violets are blue, i used to break rules but now im new.
 
Join Date: Jan 2011
Location: Kalos
Gender: Male
Nature: Serious
Posts: 549
Drawing app?

How do I add a drawing app?
winter is here.
back at 12/23/15
Reply With Quote
  #16    
Old January 27th, 2014 (8:44 AM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Posts: 5,111
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.
Reply With Quote
  #17    
Old August 6th, 2014 (12:31 PM).
LenSho's Avatar
LenSho LenSho is offline
 
Join Date: Sep 2012
Gender: Male
Nature: Modest
Posts: 93
I tried to add the PokéDex to the PokéGear and got this error:

Reply With Quote
  #18    
Old August 9th, 2014 (2:49 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Quote:
Originally Posted by LenSho View Post
I tried to add the PokéDex to the PokéGear and got this error:

Just delete the both lines [email protected]' for Pokégear script. I updated my other post.
Reply With Quote
  #19    
Old August 9th, 2014 (7:29 PM).
LenSho's Avatar
LenSho LenSho is offline
 
Join Date: Sep 2012
Gender: Male
Nature: Modest
Posts: 93
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.
Reply With Quote
  #20    
Old October 25th, 2015 (6:16 AM).
Darkattributes197's Avatar
Darkattributes197 Darkattributes197 is offline
 
Join Date: Oct 2015
Location: NO, never!
Gender: Male
Nature: Relaxed
Posts: 21
Question, can I put a quest system in the Pokegear? I know there is one, but how do I insert it into the Pokegear?
Welp...This is a thing...I'm making 5 projects! Main dev of Digimon Lunar Dusk, and Solar Dawn!
Stick around, you may see some of my other games!
Reply With Quote
  #21    
Old November 1st, 2015 (3:14 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Quote:
Originally Posted by Darkattributes197 View Post
Question, can I put a quest system in the Pokegear? I know there is one, but how do I insert it into the Pokegear?
Did you follow the tutorial? What happened?
Reply With Quote
  #22    
Old April 1st, 2016 (9:03 AM). Edited April 1st, 2016 by Maruno.
Rabbit Heaven's Avatar
Rabbit Heaven Rabbit Heaven is offline
 
Join Date: Jul 2014
Gender: Male
Posts: 6
Hey, I hope this thread is still active. I looked at this tutorial and the steps, and I added some new options to my Pokégear-ish device (Including your Daycare-Checker, which I found working with no problems, thank you very much!).

Problem is, even after looking and experimenting with the scripts, copying/using parts I thought was neccesary from other pokegear functions, I cannot make the options show a scene I want, as I am not too experienced with ruby scripting as of now.

I used a bank system script by Black Eternity (Just sort of re-discovered PokeCommunity and can't link it, but it comes up first at google) to add a banking system to my game, which works nicely if I just activate the script from an npc, but I can't conjure up a proper scene in order to make a pokegear function check the amount of money that is currently deposited in the bank.


Could you by any means help me write a scene for this bank data pokegear function, or just help me write a basic scene in general? I understand if you do not have the time right now, but I hope you can help :)

Regards, Rabbit Heaven.
Reply With Quote
  #23    
Old April 1st, 2016 (3:41 PM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Posts: 5,111
Quote:
Originally Posted by Maruno View Post
Describing how to make a whole new screen is not a part of this tutorial.
I'll quote this, and let you figure out why your post is inappropriate here.
Reply With Quote
  #24    
Old April 2nd, 2016 (7:22 AM).
Rabbit Heaven's Avatar
Rabbit Heaven Rabbit Heaven is offline
 
Join Date: Jul 2014
Gender: Male
Posts: 6
Since I noticed similar questions in the thread I thought it wouldn't hurt asking, but I suppose I'll have to put this up somewhere else then, thanks for the heads-up
EDIT: Would by any chance know a place/thread where I can to script these things, or just basic ruby that I can apply to Essentials?
Reply With Quote
  #25    
Old April 6th, 2016 (2:17 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Quote:
Originally Posted by Rabbit Heaven View Post
Since I noticed similar questions in the thread I thought it wouldn't hurt asking, but I suppose I'll have to put this up somewhere else then, thanks for the heads-up
EDIT: Would by any chance know a place/thread where I can to script these things, or just basic ruby that I can apply to Essentials?
Here a good starter point for making scenes in Essentials.
Reply With Quote
Reply Post Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


  All times are GMT -8. The time now is 7:12 PM.


Contact Us Archive Privacy Statement Terms of Service Top