View Single Post
Old September 13th, 2012 (12:59 PM).
IceGod64's Avatar
IceGod64 IceGod64 is offline
My imagination.
Join Date: Oct 2008
Location: Castelia City
Age: 28
Gender: Male
Nature: Naive
Posts: 610

Quote originally posted by jim42:
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:

# 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={},0,Graphics.width,Graphics.height) @viewport.z=99999 addBackgroundPlane(@sprites,"bg","starterbg",@viewport) @sprites["overlay"],Graphics.height,@viewport) pbSetSystemFont(@sprites["overlay"].bitmap) pbDrawStarterSelection pbFadeInAndShow(@sprites) { update } end

def pbDrawStarterSelection [email protected]["overlay"].bitmap overlay.clear,72,72),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) { 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:

def pbCreatePoke,25,$Trainer)
  poke.abilityflag = 2
  poke.item = PBItems::ORANBERRY
  poke.obtainLevel = 5
  poke.natureflag =  12

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:

if pbDisplayConfirm(_INTL("is this the Pokémon you want?"))
 $scene =

You might need to copy the def pbDisplayConfirm from another script (I think it's in PokemonSave)but that should do what you want.


Reply With Quote