PDA

View Full Version : [Essentials tutorial] How to add more features to the Pokégear


FL
May 8th, 2013, 4:06 PM
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:

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 (http://www.pokecommunity.com/showthread.php?t=278209) 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.

Tayuya of the Sound Four
May 8th, 2013, 6:41 PM
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
May 11th, 2013, 2:54 PM
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 themUse 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):

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 (http://www.pokecommunity.com/showthread.php?t=286554) for a better example.

bartyboy6
August 16th, 2013, 2:42 AM
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
August 18th, 2013, 8:07 AM
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:

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:

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


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

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'

linkthehero
August 23rd, 2013, 6:42 AM
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
August 27th, 2013, 9:04 AM
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 sceneI followed the instructions and manage it (I only used 'pbVoltorbFlip' after 'pbPlayDecisionSE()' in the last part). You probably done something wrong, try again.

linkthehero
August 30th, 2013, 11:14 PM
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)
[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

FL
September 1st, 2013, 9:51 AM
sorry but i god some problems to fix it.please help meLike 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
pbFadeOutIn(99999) {
scene=pbVoltorbFlip.new
screen=pbVoltorbFlip.new(scene)
screen.pbStartScreen
}
to 'pbVoltorbFlip'

Maruno
September 1st, 2013, 11:37 AM
You'll also need the line @cmdPension=-1 in there somewhere. You could also try saying what your problems actually are.

linkthehero
September 2nd, 2013, 6:51 AM
thank you so much for the help
it works perfect =)

linkthehero
December 28th, 2013, 8:36 AM
how is it posibal to put the bike in
could someone help me please

FL
January 1st, 2014, 12:15 PM
how is it posibal to put the bike in
could someone help me pleaseThe last part is:

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'.

linkthehero
January 1st, 2014, 3:00 PM
ok thank you but the stuff with the pause menu is not needed i use another menu =)
thank you =)

TheMarkCrafter
January 27th, 2014, 6:50 AM
Drawing app?

How do I add a drawing app?

Maruno
January 27th, 2014, 8:44 AM
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.

LenSho
August 6th, 2014, 12:31 PM
I tried to add the PokéDex to the PokéGear and got this error:

http://i.imgur.com/7fmz18n.png

FL
August 9th, 2014, 2:49 PM
I tried to add the PokéDex to the PokéGear and got this error:

http://i.imgur.com/7fmz18n.pngJust delete the both lines [email protected]' for Pokégear script. I updated my other post.

LenSho
August 9th, 2014, 7:29 PM
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.

Darkattributes197
October 25th, 2015, 6:16 AM
Question, can I put a quest system in the Pokegear? I know there is one, but how do I insert it into the Pokegear?

FL
November 1st, 2015, 3:14 AM
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?

Rabbit Heaven
April 1st, 2016, 9:03 AM
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 (http://www.pokecommunity.com/showthread.php?t=299771) (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.

Maruno
April 1st, 2016, 3:41 PM
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.

Rabbit Heaven
April 2nd, 2016, 7:22 AM
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? :)

FL
April 6th, 2016, 2:17 AM
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 (http://www.pokecommunity.com/showthread.php?t=286554).

Pokébook
April 7th, 2016, 3:37 AM
Hello FL. I love your Scripts and since december 2015 I tried to put your scripts into my game, but there appeared many error messages. Now I've got a clean Essentials (current version) v.16 and v.16.1 I paste the files on the data folder of essentials. Now I'm trying to put your Pokégear Scripts with all functions: Watch (already done), Daycare-system, Pokégear Radio, Storage-system, well I want to download all Scripts you made for the Pokégear and put it, can you plz help me with the storage system etc. I want to rename the Pokégear as PokéNav and make it look like as in R/S/E...
I need those pictures and can't find it elsewhere, if you could help me I would appreciate it.
I downloaded the pictures from the Daycare checker-item but I want it for the Pokégear, which I want to call it as PokéNav.. also need the trainer phone or a Vs seeker instead inside it.

FL
April 10th, 2016, 9:11 AM
Hello FL. I love your Scripts and since december 2015 I tried to put your scripts into my game, but there appeared many error messages. Now I've got a clean Essentials (current version) v.16 and v.16.1 I paste the files on the data folder of essentials. Now I'm trying to put your Pokégear Scripts with all functions: Watch (already done), Daycare-system, Pokégear Radio, Storage-system, well I want to download all Scripts you made for the Pokégear and put it, can you plz help me with the storage system etc. I want to rename the Pokégear as PokéNav and make it look like as in R/S/E...
I need those pictures and can't find it elsewhere, if you could help me I would appreciate it.
I downloaded the pictures from the Daycare checker-item but I want it for the Pokégear, which I want to call it as PokéNav.. also need the trainer phone or a Vs seeker instead inside it.For DayCareChecker, just follow main thread post, for Storage System, this post (http://www.pokecommunity.com/showpost.php?p=7791372&postcount=5). The trainer phone is default on Essentials, for VS Seeker, try using Mej71 one. My guess (untested): Follow the entire tutorial and, copy the code between "ItemHandlers::UseInField.add(:VSSEEKER,proc{|item|" and "})" pasting in a new "def". After adding the method, instead of adding

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

Add:

if @cmdVVSeeker>=0 && @sprites["command_window"].[email protected]
yourVSMethodCall
end

For PokéNav images, I suggest ripping from screens in this page (http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9Nav).

mej71
April 10th, 2016, 10:30 AM
For DayCareChecker, just follow main thread post, for Storage System, this post (http://www.pokecommunity.com/showpost.php?p=7791372&postcount=5). The trainer phone is default on Essentials, for VS Seeker, try using Mej71 one. My guess (untested): Follow the entire tutorial and, copy the code between "ItemHandlers::UseInField.add(:VSSEEKER,proc{|item|" and "})" pasting in a new "def". After adding the method, instead of adding

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

Add:

if @cmdVVSeeker>=0 && @sprites["command_window"].[email protected]
yourVSMethodCall
end

For PokéNav images, I suggest ripping from screens in this page (http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9Nav).

It's going to be slightly different, when you use the VS Seeker from your bag it will exit the bag since it's more of a field item, and then use it.