View Single Post
  #2    
Old September 13th, 2012 (12:59 PM).
IceGod64's Avatar
IceGod64 IceGod64 is offline
In the Lost & Found bin!
     
    Join Date: Oct 2008
    Location: Castelia City
    Age: 29
    Gender: Male
    Nature: Naive
    Posts: 623
    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
        [email protected]["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.
    __________________

    Reply With Quote