Community

The PokéCommunity

We are still working on a better slogan!

Visit Index



Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Notices

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

Post Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old September 12th, 2012, 12:00 AM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
Hey guys,
I've been working on a starter selection screen for my game, and for the most part I have it working, with all the accompanying graphics and whatnot. Granted it's not the fanciest looking thing, but it does its job well enough. I just have a few things I need to address in order to continue working on it.

First up: at present, I've been hardcoding the starter Pokemon and their respective data, images etc into the script. I know I should really be using the @pokemon thing, and getting the names, types and number out of that, but I don't understand how it works, and I couldn't find like a def thing that describes how it operates or how to set it to a particular Pokemon. Oh, and at the completion of the screen, it should add the selected Pokemon to the party. Would someone please elaborate upon this function?

Secondly, I have some questions about message and choice windows. I was wondering if it was possible to display a smaller window, one line high, at the bottom of the screen, and containing text defined in the script. In addition, this window should have attached a choice window thingy with the yes and no thing, ensuring it aligns with the newer sized window. I've included an attachment to illustrate what I mean.

In addition, I've also included my current code. It's a bit messy, unfinished, and will be cleaned up in due time. Here it is:
Spoiler:
Code:
#==============================================================================#
# This is a script to display and handle a starter selection scene. It         #
# displays three Pokeballs, their corresponding Pokemon, and their basic data. #
# The player may use the arrow keys to select a Pokemon, and the C input to    #
# confirm their selection.                                                     #
#==============================================================================#
# Copyright Aaron J Richards, not to be used with the exception of testing for 
answers to my questions                     #
#==============================================================================#



class PokemonStarterSelectionScene
  def update
    pbUpdateSpriteHash(@sprites)
  end
  
  def pbStartScene
    @sprites={}
    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=99999
    addBackgroundPlane(@sprites,"bg","starterbg",@viewport)
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    pbSetSystemFont(@sprites["overlay"].bitmap)
    pbDrawStarterSelection
    pbFadeInAndShow(@sprites) { update }
  end
  
  def pbDrawStarterSelection
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    shadowColor=Color.new(72,72,72)
    baseColor=Color.new(185,185,185)
    textPositions=[]
    textPositions.push([_INTL("Which Pokémon would you like?"),108,330,0,
                       baseColor,shadowColor])
    textPositions.push([_INTL("WWWWWWWWWW"),35,240,0,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Electric"),477,204,1,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Fighting"),477,240,1,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Type"),477,276,1,
                       baseColor,shadowColor])
    #textPositions.push([pokename,35,220,0,
    #                   baseColor,shadowColor])
    #textPositions.push([_INTL("{1} Type",@pokemon.type1),477,220,1,
    #                   baseColor,shadowColor])
    pbDrawTextPositions(overlay,textPositions)
    
    imagePositions=[]
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",9,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",25,25,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",178,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",194,25,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",347,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",363,25,0,0,-1,-1])
    if $game_variables[26]==1
      imagePositions.push(["Graphics/Pictures/StarterSelector",25,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/252",176,165,0,0,-1,-1])
    elsif $game_variables[26]==2
      imagePositions.push(["Graphics/Pictures/StarterSelector",194,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/255",176,165,0,0,-1,-1])
    elsif $game_variables[26]==3
      imagePositions.push(["Graphics/Pictures/StarterSelector",363,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/258",176,165,0,0,-1,-1])
    end
    pbDrawImagePositions(overlay,imagePositions)
  end
  
  def pbStarterSelection
    loop do
      Graphics.update
      Input.update
      self.update
      if Input.trigger?(Input::LEFT)
        $game_variables[26]-=1
        if $game_variables[26]<1
          $game_variables[26]+=3
        end            
        pbPlayCursorSE()
        pbDrawStarterSelection
      elsif Input.trigger?(Input::RIGHT) 
        $game_variables[26]+=1
        if $game_variables[26]>3
          $game_variables[26]-=3
        end
        pbPlayCursorSE()
        pbDrawStarterSelection
      elsif Input.trigger?(Input::C)
        if $game_variables[26]==1
          #Sure?
          break
        elsif $game_variables[26]==2
          #Sure?
          break
        elsif $game_variables[26]==3
          #Sure?
          break
        end
      end       
    end 
  end
  
  def pbEndScene
    pbFadeOutAndHide(@sprites) { update }
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
  end
end

class PokemonStarterSelection
  def initialize(scene)
    @scene=scene
  end

  def pbStartScreen
    @scene.pbStartScene
    @scene.pbStarterSelection
    @scene.pbEndScene
  end
end
  
def pbShowStarterSelection
  pbFadeOutIn(99999) {
     scene=PokemonStarterSelectionScene.new
     screen=PokemonStarterSelection.new(scene)
     screen.pbStartScreen
  }
end

I also intend on somehow adding parameters to the script call such that the user can define their own starters without having to modify the code, but I'll get to that one I have to regular script working. Thanks in advance for any help, guys.
Cheers, Jim
Attached Thumbnails
demonstration.png‎  
  #2    
Old September 13th, 2012, 12:59 PM
IceGod64's Avatar
IceGod64
My imagination.
 
Join Date: Oct 2008
Location: Castelia City
Age: 26
Gender: Male
Nature: Naive
Quote:
Originally Posted by jim42 View Post
Hey guys,
I've been working on a starter selection screen for my game, and for the most part I have it working, with all the accompanying graphics and whatnot. Granted it's not the fanciest looking thing, but it does its job well enough. I just have a few things I need to address in order to continue working on it.

First up: at present, I've been hardcoding the starter Pokemon and their respective data, images etc into the script. I know I should really be using the @pokemon thing, and getting the names, types and number out of that, but I don't understand how it works, and I couldn't find like a def thing that describes how it operates or how to set it to a particular Pokemon. Oh, and at the completion of the screen, it should add the selected Pokemon to the party. Would someone please elaborate upon this function?

Secondly, I have some questions about message and choice windows. I was wondering if it was possible to display a smaller window, one line high, at the bottom of the screen, and containing text defined in the script. In addition, this window should have attached a choice window thingy with the yes and no thing, ensuring it aligns with the newer sized window. I've included an attachment to illustrate what I mean.

In addition, I've also included my current code. It's a bit messy, unfinished, and will be cleaned up in due time. Here it is:
Spoiler:
Code:
#==============================================================================#
# This is a script to display and handle a starter selection scene. It         #
# displays three Pokeballs, their corresponding Pokemon, and their basic data. #
# The player may use the arrow keys to select a Pokemon, and the C input to    #
# confirm their selection.                                                     #
#==============================================================================#
# Copyright Aaron J Richards, not to be used with the exception of testing for 
answers to my questions                     #
#==============================================================================#



class PokemonStarterSelectionScene
  def update
    pbUpdateSpriteHash(@sprites)
  end
  
  def pbStartScene
    @sprites={}
    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=99999
    addBackgroundPlane(@sprites,"bg","starterbg",@viewport)
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    pbSetSystemFont(@sprites["overlay"].bitmap)
    pbDrawStarterSelection
    pbFadeInAndShow(@sprites) { update }
  end
  
  def pbDrawStarterSelection
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    shadowColor=Color.new(72,72,72)
    baseColor=Color.new(185,185,185)
    textPositions=[]
    textPositions.push([_INTL("Which Pokémon would you like?"),108,330,0,
                       baseColor,shadowColor])
    textPositions.push([_INTL("WWWWWWWWWW"),35,240,0,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Electric"),477,204,1,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Fighting"),477,240,1,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Type"),477,276,1,
                       baseColor,shadowColor])
    #textPositions.push([pokename,35,220,0,
    #                   baseColor,shadowColor])
    #textPositions.push([_INTL("{1} Type",@pokemon.type1),477,220,1,
    #                   baseColor,shadowColor])
    pbDrawTextPositions(overlay,textPositions)
    
    imagePositions=[]
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",9,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",25,25,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",178,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",194,25,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",347,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",363,25,0,0,-1,-1])
    if $game_variables[26]==1
      imagePositions.push(["Graphics/Pictures/StarterSelector",25,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/252",176,165,0,0,-1,-1])
    elsif $game_variables[26]==2
      imagePositions.push(["Graphics/Pictures/StarterSelector",194,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/255",176,165,0,0,-1,-1])
    elsif $game_variables[26]==3
      imagePositions.push(["Graphics/Pictures/StarterSelector",363,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/258",176,165,0,0,-1,-1])
    end
    pbDrawImagePositions(overlay,imagePositions)
  end
  
  def pbStarterSelection
    loop do
      Graphics.update
      Input.update
      self.update
      if Input.trigger?(Input::LEFT)
        $game_variables[26]-=1
        if $game_variables[26]<1
          $game_variables[26]+=3
        end            
        pbPlayCursorSE()
        pbDrawStarterSelection
      elsif Input.trigger?(Input::RIGHT) 
        $game_variables[26]+=1
        if $game_variables[26]>3
          $game_variables[26]-=3
        end
        pbPlayCursorSE()
        pbDrawStarterSelection
      elsif Input.trigger?(Input::C)
        if $game_variables[26]==1
          #Sure?
          break
        elsif $game_variables[26]==2
          #Sure?
          break
        elsif $game_variables[26]==3
          #Sure?
          break
        end
      end       
    end 
  end
  
  def pbEndScene
    pbFadeOutAndHide(@sprites) { update }
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
  end
end

class PokemonStarterSelection
  def initialize(scene)
    @scene=scene
  end

  def pbStartScreen
    @scene.pbStartScene
    @scene.pbStarterSelection
    @scene.pbEndScene
  end
end
  
def pbShowStarterSelection
  pbFadeOutIn(99999) {
     scene=PokemonStarterSelectionScene.new
     screen=PokemonStarterSelection.new(scene)
     screen.pbStartScreen
  }
end

I also intend on somehow adding parameters to the script call such that the user can define their own starters without having to modify the code, but I'll get to that one I have to regular script working. Thanks in advance for any help, guys.
Cheers, Jim
Here's an example of properly creating a Pokemon with a script:

Code:
def pbCreatePoke
  poke=PokeBattle_Pokemon.new(PBSpecies::EEVEE,25,$Trainer)
  poke.abilityflag = 2
  poke.happiness=160
  poke.item = PBItems::ORANBERRY
  poke.obtainLevel = 5
  poke.natureflag =  12
  pbAddToParty(poke)
end
This is in the general ballpark of what kind of stuff you might want to do in terms of actually giving the Pokémon.

As for double checking is that's what the player wants, try something like:

Code:
if pbDisplayConfirm(_INTL("is this the Pokémon you want?"))
 pbCreatePoke
 $scene = Scene_Map.new
 return
else
 end
You might need to copy the def pbDisplayConfirm from another script (I think it's in PokemonSave)but that should do what you want.

  #3    
Old September 14th, 2012, 05:16 AM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
Thanks for the assistance, IceGod. I modified the add Pokemon script a bit and added it in the Input::C section, where it belongs, along with the confirmation message. Speaking of which, I didn't have to copy any scripts, I just had to use "Kernel.ConfirmMessage(blahblahblah)".

However, what you suggested only half answers my questions. I still have to hardcode the Pokemon data, and I still need to know how to display a smaller message window (assuming you can. I suspect one would). Thanks for what you did contribute, at least. Now the script actually adds Pokemon. :D
Cheers, Jim.
  #4    
Old September 16th, 2012, 09:55 AM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
To displays the message use:

Code:
    @sprites["msgwindow"]=Kernel.pbCreateMessageWindow(@viewport)
    Kernel.pbMessageDisplay(@sprites["msgwindow"],
        _INTL("Insert the text here"))
I suggest you to use '@starterchoice' rather than '$game_variables[26]'. Just put '@starterchoice=0' when the scene is starting. Also, take a look in http://pokemonessentials.wikia.com/w...es_introdution
  #5    
Old July 17th, 2013, 06:33 AM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
Okay so this is a huge necropost. Sorry if that's a problem. I've gone back to my Starter Selection screen, and rewritten it from the ground up in order to be able to accept parameters such that it can be initialised with any three Pokémon as specified in the method call.

What I've built seems more or less structurally sound, but I've come to realise the variables passed into the method call have no way of reaching their target destinations. The code compiles, but throws an exception when called due to the "missing" variable values.

As far as I've seen, the only self-contained way I can pass those variables all the way down to the required code is to pass them through each and every method along the way. It's pretty safe to say that with several variables this becomes quite lengthy and unpleasant to read. Is there an easier way by which I might pass these variables though to their intended code?

I've included the code below for your convenience.

Spoiler:
Code:
#==============================================================================#
# Pokémon Starter Selection module Version 1.1
#==============================================================================#
# This is a script to display and handle a basic starter selection scene. It   #
# displays three Pokeballs, their corresponding Pokemon, and their basic data. #
# The player may use the arrow keys to select a Pokemon, and the C input to    #
# confirm their selection.                                                     #
#                                                                              #
# The method can be called by using a script command in an event containing    #
# the string, "pbShowStarterSelection(<x>, <y>, <z>, <a>)", where <x>, <y> and #
# <z> are the species one wishes to display as starters, and where <a> is an   #
# optional value (false by default) to determine whether the acquisition and   #
# nicknaming prompts are displayed.
#==============================================================================#
# Copyright Aaron Richards a.k.a. BlackWaltzTheThird, 2012                     #
#==============================================================================#

#CHANGED 2153 27 JUN 13 included in new project
#CHANGED 2358 17 JUL 13 updated to version 1.1; changes too numerous to tag

class PokemonStarterSelectionScene
  def update
    pbUpdateSpriteHash(@sprites)
  end
  
  def pbStartScene
    @sprites={}
    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=99999
    addBackgroundPlane(@sprites,"bg","StarterSelectionBackground_BW3rd",@viewport)
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    pbSetSystemFont(@sprites["overlay"].bitmap)
    pbDrawStarterSelection
    pbFadeInAndShow(@sprites) { update }
  end
  
  def pbDrawStarterSelection
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    shadowColor=Color.new(72,72,72)
    baseColor=Color.new(185,185,185)
    textPositions=[]
    imagePositions=[]
    
    imagePositions.push(["Graphics/Pictures/StarterSelectionForeground_BW3rd",0,0,0,0,-1,-1])
    
    call variables need to get to this section mainly (starterOne, etc)    
    if $game_variables[26]!=0
      textPositions.push([_INTL("Pokémon"),370,72,1,
                         baseColor,shadowColor])
      if $game_variables[26]==1
        textPositions.push([_INTL("{1}",PBSpecies.getName(starterOne)),
                                  16,40,1, baseColor,shadowColor])
        textPositions.push([_INTL("{1}",pbGetMessage(MessageTypes::Kinds,starterOne)),
                                  370, 40, baseColor,shadowColor])
        imagePositions.push([_INTL("Graphics/Battlers/%03d",starterOne),180,8,0,0,-1,-1])
        imagePositions.push(["Graphics/Pictures/boxpoint2",96,170,0,0,-1,-1])
        pbPlayCry(starterOne)
      elsif $game_variables[26]==2
        textPositions.push([_INTL("{1}",PBSpecies.getName(starterTwo)),
                                  16,40,1, baseColor,shadowColor])
        textPositions.push([_INTL("{1}",pbGetMessage(MessageTypes::Kinds,starterTwo)),
                                  370, 40, baseColor,shadowColor])
        imagePositions.push([_INTL("Graphics/Battlers/%03d",starterTwo),180,8,0,0,-1,-1])
        imagePositions.push(["Graphics/Pictures/boxpoint2",240,200,0,0,-1,-1])
        pbPlayCry(starterTwo)
      elsif $game_variables[26]==3
        textPositions.push([_INTL("{1}",PBSpecies.getName(starterThree)),
                                  16,40,1, baseColor,shadowColor])
        textPositions.push([_INTL("{1}",pbGetMessage(MessageTypes::Kinds,starterThree)),
                                  370, 40, baseColor,shadowColor])
        imagePositions.push([_INTL("Graphics/Battlers/%03d",starterThree),180,8,0,0,-1,-1])
        imagePositions.push(["Graphics/Pictures/boxpoint2",400,170,0,0,-1,-1])
        pbPlayCry(starterThree)
      end
    end     
    
    pbDrawImagePositions(overlay,imagePositions)
    pbDrawTextPositions(overlay,textPositions)
    
    typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/pokedexTypes"))
    type1rect=Rect.new(0,CHANGEME*32,96,32)
    type2rect=Rect.new(0,CHANGEME2*32,96,32)
    @sprites["overlay"].bitmap.blt(16,72,typebitmap.bitmap,type1rect)
    @sprites["overlay"].bitmap.blt(50,72,typebitmap.bitmap,type2rect) if type1!=type2
    typebitmap.dispose
  end
  
  def pbStarterSelection
    loop do
      Graphics.update
      Input.update
      self.update
      if Input.trigger?(Input::LEFT)
        $game_variables[26]-=1
        if $game_variables[26]<1
          $game_variables[26]+=3
        end            
        pbPlayCursorSE()
        pbDrawStarterSelection
      elsif Input.trigger?(Input::RIGHT) 
        $game_variables[26]+=1
        if $game_variables[26]>3
          $game_variables[26]-=3
        end
        pbPlayCursorSE()
        pbDrawStarterSelection
      elsif Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Is this the Pokémon you want?"))
          if namelater
            pbAddToPartySilent(PokeBattle_Pokemon.new(pbGetStarterSelected,5,$Trainer))
          else
            pbAddToParty(PokeBattle_Pokemon.new(pbGetStarterSelected,5,$Trainer))
          end
          $game_variables[26]==0
          return
        end
      end       
    end 
  end
  
  def pbGetStarterSelected
    if $game_variables[26]==1
      starterchosen=starterOne
    elsif $game_variables[26]==2
      starterchosen=starterTwo
    elsif $game_variables[26]==3
      starterchosen=starterThree
    end
    return starterchosen
  end
  
  def pbEndScene
    pbFadeOutAndHide(@sprites) { update }
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
  end
end

class PokemonStarterSelection
  def initialize(scene)
    @scene=scene
  end

  def pbStartScreen
    @scene.pbStartScene
    @scene.pbStarterSelection
    @scene.pbEndScene
  end
end

method called here with three or four parameters.   
def pbShowStarterSelection(starterOne, starterTwo, starterThree, nameLater=false)
  pbFadeOutIn(99999) {
     scene=PokemonStarterSelectionScene.new
     screen=PokemonStarterSelection.new(scene)
     screen.pbStartScreen
  }
end
  #6    
Old July 21st, 2013, 12:14 PM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Instead of starter one, starter two, just use an Array, something like:

Code:
        starters=[PBSpecies::BULBASAUR, PBSpecies::CHARMANDER, PBSpecies::SQUIRTLE]
        index = $game_variables[26] - 1
        textPositions.push([_INTL("{1}",PBSpecies.getName(starters[index])),
                                  16,40,1, baseColor,shadowColor])
        textPositions.push([_INTL("{1}",pbGetMessage(MessageTypes::Kinds,starters[index)),
                                  370, 40, baseColor,shadowColor])
        imagePositions.push([_INTL("Graphics/Battlers/%03d",starters[index]),180,8,0,0,-1,-1])
        imagePositions.push(["Graphics/Pictures/boxpoint2",240,200,0,0,-1,-1])
        pbPlayCry(starters[index])
  #7    
Old July 21st, 2013, 07:23 PM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
I think you're missing the point of my rewrite, FL. That solution hardcodes the start selections into the script. I'm trying to make it such that it can use any three Pokémon as denoted by the script call. So, instead of calling pbShowStarterSelection and having to pick between Bulbasaur, Charmander or Squirtle, you could call pbShowStarterSelection(x,y,z) or pbShowStarterSelection(a,b,c) and have the script display choices for completely different sets of Pokémon.

The problem with that is that in order to pass x,y,z/a,b,c to the part of the script that actually displays the scene, I would have to add parameters to several method calls along the way, none of which actually use them. If I could put them straight into a set of quote-unquote "global" variables accessible from anywhere inside that script, that would be really helpful. It'd be kind of like the OO classes I've been writing in C++.
  #8    
Old July 23rd, 2013, 05:27 PM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Quote:
Originally Posted by jim42 View Post
I think you're missing the point of my rewrite, FL. That solution hardcodes the start selections into the script. I'm trying to make it such that it can use any three Pokémon as denoted by the script call. So, instead of calling pbShowStarterSelection and having to pick between Bulbasaur, Charmander or Squirtle, you could call pbShowStarterSelection(x,y,z) or pbShowStarterSelection(a,b,c) and have the script display choices for completely different sets of Pokémon.

The problem with that is that in order to pass x,y,z/a,b,c to the part of the script that actually displays the scene, I would have to add parameters to several method calls along the way, none of which actually use them. If I could put them straight into a set of quote-unquote "global" variables accessible from anywhere inside that script, that would be really helpful. It'd be kind of like the OO classes I've been writing in C++.
Sorry for my misunderstanding!

Since you call a method in a different class, you need, at least, put it in two parameters declarations, there ways to put in only one using a Global Variable ($), but this is really a bad idea, use an Instance Variable (@) instead:

Code:
def pbShowStarterSelection(starterOne, starterTwo, starterThree, nameLater=false)
  pbFadeOutIn(99999) {
     scene=PokemonStarterSelectionScene.new
     screen=PokemonStarterSelection.new(scene)
     screen.pbStartScreen(starterOne, starterTwo, starterThree) # You can put these parameters in the constructor.
  }
end

def pbStartScene(starterOne, starterTwo, starterThree) 
    # Some code
    @starterOne=starterOne
    @starterTwo=starterTwo
    @starterThree=starterThree
    # Some code
  end
So, only use @starterOne, @starterTwo and @starterThree in the rest of the class. For accessing these parameters in other classes, search about attr_accessor, attr_reader and attr_writer.
  #9    
Old July 25th, 2013, 06:55 AM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
Ah, thank you so much! Those instance variables worked a treat! I've got it up and running and working successfully with any given Pokémon, though I've noticed the species number has to be exactly three digits regardless of value; it makes playing the the rand() function slightly less amusing than it should be. In any case, it works exactly as I intended it to work. Again, thanks a bunch!

Spoiler:
I'm considering making it public. It's not the prettiest thing in the world, but it should be robust enough to withstand some modifications. Thoughts?
  #10    
Old July 25th, 2013, 09:01 AM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
If you're looking at the %03d part, that only applies to filenames (just like every other script dealing with file names). You can still use pbShowStarterSelection(4,25,1138) and it'll work just fine - filenames here will be 004, 025 and 1138.

%03d means that, when the number (d means "number" here) is turned into a string (% means "turn into string"), it is padded at the beginning so that it's at least 3 digits long. The character used for padding is 0.
  #11    
Old July 25th, 2013, 06:08 PM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
Ah, yes, so it does. It seems I had changed the %03d part to {1} at some point because it wasn't working. A few seconds of looking at other uses of %03d has led me to realise that you have to use sprintf instead of _INTL or it won't work. That must have been why I switched it to {1}, which now I realise takes the value literally and thus doesn't pad it to the required length. Helpful as ever, Maruno.
  #12    
Old July 30th, 2013, 12:03 AM
Kaito123
 
Join Date: Jul 2012
Gender: Male
Quote:
Originally Posted by Maruno View Post
If you're looking at the %03d part, that only applies to filenames (just like every other script dealing with file names). You can still use pbShowStarterSelection(4,25,1138) and it'll work just fine - filenames here will be 004, 025 and 1138.

%03d means that, when the number (d means "number" here) is turned into a string (% means "turn into string"), it is padded at the beginning so that it's at least 3 digits long. The character used for padding is 0.
how must I Chance my script, to call it how you say with pbCallPokemonSelect(4,25,1138)?
And how I can show the Name, Type-Picture (like in Summary) and the Graphic of the Pokémon?
Spoiler:
Code:
class PokemonPokemonSelectScene

def update
 pbUpdateSpriteHash(@sprites)
end

def pbStartScene
 @sprites={}
 @select=0
 @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
 @viewport.z=99999

 @sprites["bg"]=IconSprite.new(0,0,@viewport)
 @sprites["bg"].setBitmap("Graphics/Pictures/Starter_BG")

 pbFadeInAndShow(@sprites) { update }
end

def pbEndScene
  pbFadeOutAndHide(@sprites) { update }
  pbDisposeSpriteHash(@sprites)
  @viewport.dispose
end
    
def pbPokemonSelect
 loop do
  Graphics.update
  Input.update
  self.update
 
    @sprites["text"]=Window_AdvancedTextPokemon.new("")
    @sprites["text"].visible=false
    @sprites["text"].viewport=@viewport
    @sprites["text"].x=130
    @sprites["text"].y=695
    @sprites["text"].width=512
    @sprites["text"].height=96
    @sprites["text"].baseColor=Color.new(248,248,248)
    @sprites["text"].shadowColor=Color.new(0,0,0)
    @sprites["text"].windowskin=nil
    
    @sprites["pokemon"]=IconSprite.new(0,400,@viewport)
    @sprites["pokemon"].setBitmap("Graphics/Pictures/Starter_Pokeball")
  
  case @select
  when 0
    @sprites["hand"]=IconSprite.new(60,468,@viewport)
    @sprites["hand"].setBitmap("Graphics/Pictures/Starter_Hand")
    @sprites["ball"]=IconSprite.new(26,544,@viewport)
    @sprites["ball"].setBitmap("Graphics/Pictures/Starter_Select")
    @sprites["text"].visible=true  
    @sprites["text"].text=_INTL("Pflanzen-Pokémon")
  when 1
    @sprites["hand"]=IconSprite.new(230,468,@viewport)
    @sprites["hand"].setBitmap("Graphics/Pictures/Starter_Hand")
    @sprites["ball"]=IconSprite.new(194,544,@viewport)
    @sprites["ball"].setBitmap("Graphics/Pictures/Starter_Select")
    @sprites["text"].visible=true  
    @sprites["text"].text=_INTL("  Feuer-Pokémon")
  when 2
    @sprites["hand"]=IconSprite.new(398,468,@viewport)
    @sprites["hand"].setBitmap("Graphics/Pictures/Starter_Hand")
    @sprites["ball"]=IconSprite.new(364,544,@viewport)
    @sprites["ball"].setBitmap("Graphics/Pictures/Starter_Select")
    @sprites["text"].visible=true  
    @sprites["text"].text=_INTL(" Wasser-Pokémon")
  end
  
if Input.trigger?(Input::RIGHT) and @select==1
  @sprites["text"].visible=false
  @sprites["hand"].visible=false
  @sprites["ball"].visible=false
  pbWait(15)
 @select=2
end

if Input.trigger?(Input::RIGHT) and @select==0
  @sprites["text"].visible=false
  @sprites["hand"].visible=false
  @sprites["ball"].visible=false
  pbWait(15)
 @select=1
end

if Input.trigger?(Input::LEFT) and @select==1
  @sprites["text"].visible=false
  @sprites["hand"].visible=false
  @sprites["ball"].visible=false
  pbWait(15)
@select=0
end

if Input.trigger?(Input::LEFT) and @select==2
  @sprites["text"].visible=false
  @sprites["hand"].visible=false
  @sprites["ball"].visible=false
  pbWait(15)
@select=1
end

if Input.trigger?(Input::C)
case @select
  when 0 
    @sprites["msgwindow"]=Kernel.pbCreateMessageWindow(@viewport)
    Kernel.pbMessageDisplay(@sprites["msgwindow"],
        _INTL("Insert the text here0"))
  when 1
    @sprites["msgwindow"]=Kernel.pbCreateMessageWindow(@viewport)
    Kernel.pbMessageDisplay(@sprites["msgwindow"],
        _INTL("Insert the text here1"))
  when 2  
    @sprites["msgwindow"]=Kernel.pbCreateMessageWindow(@viewport)
    Kernel.pbMessageDisplay(@sprites["msgwindow"],
        _INTL("Insert the text here2"))
end
end

if pbMouseInArea?(25, 543, 124, 124)
  @sprites["hand"].visible=false
  @sprites["ball"].visible=false
  pbWait(15)
@select=0
end
if pbMouseInArea?(194, 543, 124, 124)
  @sprites["hand"].visible=false
  @sprites["ball"].visible=false
  pbWait(15)
@select=1
end
if pbMouseInArea?(363, 543, 124, 124)
  @sprites["hand"].visible=false
  @sprites["ball"].visible=false
  pbWait(15)
@select=2
end

end
end

end

class PokemonPokemonSelect

def initialize(scene)
 @scene=scene
end

def pbStartScreen
 @scene.pbStartScene
 @scene.pbPokemonSelect
 @scene.pbEndScene
    @starterOne=starterOne
    @starterTwo=starterTwo
    @starterThree=starterThree
end

end

def pbCallPokemonSelect
    scene=PokemonPokemonSelectScene.new
    screen=PokemonPokemonSelect.new(scene)
    screen.pbStartScreen
end
  #13    
Old July 30th, 2013, 08:37 PM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
First you want to add parameters to the relevant methods. I've outlined these in red below. That way, you can call "pbCallPokemonSelect(a,b,c)" like you want to. Then, you want to move those three lines with the instance variables "@blahblah" into the def, "pbStartScene", as indicated in blue. From now on, if you want to access those values from any method in that class, you only need to use "@blahblah". I'll let you figure out what to do with them after that.

Oh, and as a quick side note, there are better ways of encapsulating your left/right input triggers.

Code:
def pbStartScene(starterOne,starterTwo,starterThree)
 @sprites={}
 @select=0
 @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
 @viewport.z=99999

 @sprites["bg"]=IconSprite.new(0,0,@viewport)
 @sprites["bg"].setBitmap("Graphics/Pictures/Starter_BG")

 @starterOne=starterOne
 @starterTwo=starterTwo
 @starterThree=starterThree

 pbFadeInAndShow(@sprites) { update }
end

=================

def pbStartScreen(starterOne,starterTwo,starterThree)
 @scene.pbStartScene(starterOne,starterTwo,starterThree)
 @scene.pbPokemonSelect
 @scene.pbEndScene
end

end

def pbCallPokemonSelect(starterOne,starterTwo,starterThree)
    scene=PokemonPokemonSelectScene.new
    screen=PokemonPokemonSelect.new(scene)
    screen.pbStartScreen(starterOne,starterTwo,starterThree)
end
  #14    
Old July 31st, 2013, 05:15 AM
Kaito123
 
Join Date: Jul 2012
Gender: Male
thanks :D

but my problem now is, that I can't show the Battler-Picture of the Pokémon, I had used

Code:
imagePositions.push([_INTL("Graphics/Battlers/%03d",@starterOne),136,72,0,0,-1,-1])
or

Code:
@sprites["pokemon"]=IconSprite.new(136,72,@viewport)
@sprites["pokemon"].setBitmap("Graphics/Battlers/%03d",@starterOne)
or

Code:
imagePositions.push([sprintf("Graphics/Battlers/%03d",@starterOne),136,72,0,0,-1,-1])
but nothing happens.... I had use this scripts:

Code:
pbCallPokemonSelect(1,4,7)
and

Code:
pbCallPokemonSelect(001,004,007)
  #15    
Old July 31st, 2013, 08:14 AM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
Hmm, just looking at what you've posted you should be doing okay. I used the sprintf version of what you have up there and I'm not having any problems. There may be a logic error somewhere in your code. It's possible you may have misspelled a variable name or failed to set the value of @starterOne to that of the call parameter... I'd have to see your whole script to know for sure. Check over your code a few more times, call by call, to make sure that what you're coding makes sense.
  #16    
Old July 31st, 2013, 08:49 AM
Kaito123
 
Join Date: Jul 2012
Gender: Male
So, i solved my problem

how i can show the type-picture of my starter?

Last edited by Kaito123; July 31st, 2013 at 10:56 AM.
  #17    
Old July 31st, 2013, 05:26 PM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Have a look at how the Pokédex does it.
  #18    
Old July 31st, 2013, 11:47 PM
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
As an addendum to what Maruno said, take a look at which type-picture you want to display. The Pokédex uses a different source of type-pictures (pokedexTypes.png) to most other screens (types.png). They can both be drawn the same way, but since the latter is smaller, you'll need to use smaller offset values. It comes down to aesthetic preference, I guess.
  #19    
Old August 1st, 2013, 12:48 AM
Kaito123
 
Join Date: Jul 2012
Gender: Male
yes :D I had used the types.png :D

next question:

If I displayed this:

You want {1}, the {2}-Pokémon?

{1} = Pokemon-Name (thats not the problem)
{2} = The Pokemon-Type of this Pokémon (If it has two, I want Type1)

how I can show {2}?
  #20    
Old August 2nd, 2013, 04:54 PM
dexter1o6
 
Join Date: Jul 2013
Age: 26
Gender: Male
I found this:

Spoiler:
pbDisplayPaused(_INTL("{1} allows the use of only {2}!",
PBItems.getName(thispkmn.item),
PBMoves.getName(thispkmn.effects[PBEffects::ChoiceBand])))


So, maybe, make something like:

Spoiler:
pbwhatever(_INTL("You want {1}, the {2}-type Pokemon?",
PBPokemon.getName(thispkmn.name),
PBTypes.getName(thispkmn.type1)))

This in specific won't work (I don't know much of the specific names in the code yet), but it might help you find what you need. The second and third argument are what is displayed in the text message.
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 08:41 AM.

About Us
© 2002 - 2014 The PokéCommunity™, pokecommunity.com. Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.

Copyright
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com. PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator. Header artwork by Jordanice of deviantART.

Social Media
If you would like to stay up-to-date with us on the go, when we're down, or other such things, follow us on social media sites--most notibly Twitter, Facebook, and Google Plus--by clicking on the links provided.

Design presented by Peitharchia. Special thanks to Hiroshi Sotomura and Ausaudriel.