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.

Save/load chapter names

Could someone make a script similar to the Chapter Number system, except it displays chapter names instead of numbers, and then have it post a picture if the player has a certain item? Basically, I would like to do this:

Chapter *number*: *Chapter Title*
*symbol for first item you can get* *symbol for second* *third* *fourth* *fifth* and it gets the symbols from the items sheet. Is that possible?
 

khmp

Sponsor

I knew I was forgetting something. :down: Forgive me. I should have something later today.

Code:
#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
#  This window displays save files on the save and load screens.
#==============================================================================

class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # * Constant Variables
  #--------------------------------------------------------------------------
  Chapter_Image_Dir = 'Graphics/Pictures/'
  #------------------------------------------------------------------------
  # - Chapter_Names
  #     This Hash holds each chapter name in incremental order. Feel free
  #     to change the strings or add to it when ever you want. The string
  #     that the chapter name string points to is the filename of the image
  #     to show. The default is the file name of the picture to show if an 
  #     image can not be loaded properly.
  #------------------------------------------------------------------------
  Chapter_Names = [
    ['Prelude', 'prelude'],
    ['Chapter 1', 'chapter1'],
    ['Chapter 2', 'chapter2'],
    ['Chapter 3', 'chapter3'],
    ['Chapter 4', 'chapter4'],
    ['Chapter 5', 'chapter5'],
  ]
  #------------------------------------------------------------------------
  # - Chapter_Name_Variable
  #     This variable is used to indicate what $game_variable index holds 
  #     the current chapter name. You may change it to whatever you wish.
  #------------------------------------------------------------------------
  Chapter_Name_Variable =  1
  #--------------------------------------------------------------------------
  # * Refresh !OVERRIDE!
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    name = Vocab::File + " #{@file_index + 1}"
    self.contents.draw_text(4, 0, 200, WLH, name)
    @name_width = contents.text_size(name).width
    if @file_exist
      unless Chapter_Names[@game_variables[Chapter_Name_Variable]].nil?
        # The name of the chapter.
        chapter_name = 
          Chapter_Names[@game_variables[Chapter_Name_Variable]][0]
        # The image file name of the chapter.
        chapter_image = 
          Chapter_Names[@game_variables[Chapter_Name_Variable]][1]
        # The bitmap of the chapter's image.
        chapter_bitmap = Bitmap.new(Chapter_Image_Dir + chapter_image)
        
        # Draw the chapter name.
        self.contents.draw_text(0, 0, width - 32, WLH, chapter_name, 1)
        # Draw the chapter image.
        self.contents.blt(60, 0, chapter_bitmap, Rect.new(0, 0, 24, 24))
      end

      draw_party_characters(152, 58)
      draw_playtime(0, 34, contents.width - 4, 2)
    end
  end
end

There's a couple of constants for you to play with. First off Chapter_Names. This guy holds the strings that will be displayed over the party members currently in your party at the time of the save. The second part to each name is the filename of the image associated with the chapter. There's also the index of the variable that holds the number of what chapter you are currently on. A quick word on the value at that index. This is designed so that the first value needs to be thought of as 0. It increments from there. Not that it needs to be thought of as a Prelude or Chapter 0 for it to work it can still be Chapter 1 but the value should start at 0. I hope I explained that well enough. Back to Chapter_Name_Variable, this number refers to the index of which game_variable holds what chapter index we are at.

Good luck with it Demosthenes2k8! :thumb:
 

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