Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

kind of pokedex

not really a pokedex, but I want works like one. it's basically a menu that works the following way...
-Similar to a pokedex, it is updated after you collect stuff (in this case ancient stones, not pokemons)
-It works based on switches (like switch 001: got "this")
-Includes picture per item (big one but leaving space for the other stuff)
-small space for stone name and description

that's it, thx in advance
 
I have an idea of how I'd do this...can I have a sample picture (or just the size of the pictures), the number of runes you will have, and an example of a description so I can see what length to expect?
 
I've got this:
http://i78.photobucket.com/albums/j92/chastity_belted/gotnostones.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/stones.png[/IMG]
Oh look, a typo ^^ lol
Code:
#================================
# Stone Collection Script by ToriVerly @rmxp.org
#----------------------------------------------------------------
# Call $ancient_stones.get_new('stonename')
# to add a stone to the player's collection
# Call $ancient_stones.got?('stonename')
# to check if the player has collected that stone
# Call $ancient_stones.stone_pic('stoneindex')
# to access a picture with the same filename in
# the Game/Pictures folder.
# Call $ancient_stones.name('stoneindex'),
# $ancient_stones.loc('stoneindex') or
# $ancient_stones.spec('stoneindex') to get the name,
# location or specialty of the stone with that index (order)
# in this array:
#----------------------------------------------------------------
   AncientStones = ['stone1', 'stone2', 'stone3', 'etc']
#----------------------------------------------------------------
# Set the specialities of the stones in this array:
#----------------------------------------------------------------
   StoneSpecialities = ['Fire', 'Water', 'Earth', 'Example']
#----------------------------------------------------------------
# Set the locations of the stones in this array:
#----------------------------------------------------------------
   StoneLocations = ['In a pie', 'Underwater', 'Canada', 'Exampleville']
#----------------------------------------------------------------
# Acient Stones class
#================================
class Ancient_Stones
  attr_reader   :stones
  attr_reader   :name
  attr_reader   :spec
  attr_reader   :loc
  attr_reader   :stones_collected
  def initialize
    @stones = AncientStones
    @specialities = StoneSpecialities
    @locations = StoneLocations
    @stones_collected = []
  end
  def get_new(stone)
      if !got?(stone)
        @stones_collected.push(stone)
        @stones_collected.sort!
      end
    end
  def got?(stone)
    return true if @stones_collected.include?(stone)
    return false
  end
  def stone_name(stoneindex)
    return @stones[stoneindex]
  end
  def stone_pic(stone_index)
    return RPG::Cache.picture(@stones[stone_index])
  end
  def get_stone_description(stoneindex)
    @name = stone_name(stoneindex)
    @spec = @specialities[stoneindex]
    @loc = @locations[stoneindex]
    end
end
#---------------------------------------------------------------
# Initiates Acient_Stones class on new game
#---------------------------------------------------------------
class Scene_Title
  alias new_game command_new_game
  def command_new_game
    $ancient_stones = Ancient_Stones.new
    new_game
  end
end
#---------------------------------------------------------------
# Allows stone collection to be viewed from the menu
#---------------------------------------------------------------
class Scene_Menu
  def main
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Stone Collection"
    s5 = "Status"
    s6 = "Save"
    s7 = "Exit"
  @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
  @command_window.index = @menu_index
    if $game_party.actors.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = @command_window.height
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = @playtime_window.y + @playtime_window.height
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.actors.size == 0 and @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Stones.new
      when 4
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 5
        if $game_system.save_disabled
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Save.new
      when 6 
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_End.new        
      end
      return
    end
  end
end
class Window_Steps
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Steps")
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120, 32, $game_party.steps.to_s, 2)
  end
end
#---------------------------------------------------------------
# Window displaying list of stones
#---------------------------------------------------------------
class Stone_Collection_Window < Window_Selectable
    attr_reader   :selected
    def initialize
    super(0, 0, 160, 480 - 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    self.active = false
    self.index = 0
    @column_max = 1
    update
  end
   def update
      self.contents.clear
      @item_max = $ancient_stones.stones_collected.size
      for i in 0...@item_max
        x = 32
        y = i * 32
        name = $ancient_stones.stones_collected[i]
        self.contents.draw_text(x, y, 160, 32, name)
      end
#---------------------------------------------------------------    
      if Input.repeat?(Input::DOWN) and @item_max != 0
        if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
           @index < @item_max - @column_max
          $game_system.se_play($data_system.cursor_se)
          @index = (@index + @column_max) % @item_max
        end
      end
      if Input.repeat?(Input::UP) and @item_max != 0
        if (@column_max == 1 and Input.trigger?(Input::UP)) or
           @index >= @column_max
          $game_system.se_play($data_system.cursor_se)
          @index = (@index - @column_max + @item_max) % @item_max
        end
      end
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Menu.new(0)
        return
      end
      update_cursor_rect
    end
#---------------------------------------------------------------   
  def update_cursor_rect
      if @index < 0
       self.cursor_rect.empty
      else
        self.cursor_rect.set(0, @index * 32, self.width - 32, 32)
      end
    end
#---------------------------------------------------------------    
  def selected
    for stone_index in 0...$ancient_stones.stones.size
      if $ancient_stones.stones[stone_index] == $ancient_stones.stones_collected[@index]
        return stone_index
      end
    end
  end
end
#---------------------------------------------------------------
# Window displaying pictures of stones
#---------------------------------------------------------------
class Collection_Pictures_Window < Window_Base
  def initialize
    super(160, 0, 480, 240)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
  end
  def update(stone_index)
    self.contents.clear
    bitmap =  $ancient_stones.stone_pic(stone_index)
    c = 480 - bitmap.width
    self.contents.blt(c/2 -32, 0, bitmap, Rect.new(0, 0, 480, 240))
  end
end
#---------------------------------------------------------------
# Window displaying descriptions of stones
#---------------------------------------------------------------
class Stone_Description_Window <Window_Base
  def initialize
    super(160, 240, 480, 240)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
  end
  def update(stoneindex)
    self.contents.clear
    $ancient_stones.get_stone_description(stoneindex)
    self.contents.font.size = 28
    self.contents.font.color = system_color
    x = 4
    y = 4
    list_number = stoneindex + 1
    self.contents.draw_text(344, y, 100, 32, "#" + list_number.to_s, 2)
    self.contents.draw_text(x, y+20, 150, 32, "Name:")
    self.contents.draw_text(x, y+40, 150, 32, "Speciality:")
    self.contents.draw_text(x, y+60, 150, 32, "Location:")
    self.contents.font.size = $defaultfontsize
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 200, y+20, 220, 32, $ancient_stones.name.to_s)
    self.contents.draw_text(x + 200, y+40, 160, 32, $ancient_stones.spec.to_s)
    self.contents.draw_text(x + 200, y+60, 160, 32, $ancient_stones.loc.to_s)
  end
end
#---------------------------------------------------------------
# Collection veiwing scene
#---------------------------------------------------------------
class Scene_Stones
  def main
    @collection = Stone_Collection_Window.new
    @picture = Collection_Pictures_Window.new
    @description = Stone_Description_Window.new
    @help = Window_Help.new
    @help.y = 480 - 64
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @collection.dispose
    @picture.dispose
    @description.dispose
    @help.dispose
  end
  def update
    @collection.update
    if $ancient_stones.stones_collected.size != 0
      @picture.update(@collection.selected) 
      @description.update(@collection.selected)
    end
    @help.update
    @help.set_text("Acienct stones you have collected.", 1)
    @help.set_text("You have no stones.", 1) if $ancient_stones.stones_collected.size == 0
  end
end
Oh yeah, and it's called RuneScript because I confused your request with another one lol. Acient Stones make me think of Runes :)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top