Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Polraudio

Custom Save System Needed

Recommended Posts

I been thinking about how the save system sucks and i need a new one to reflect the style of my game. Its kind of a simple system.

 

Here is what it looks like.

savesystem.png

 

Each save is a different window and beind the windows i will have a picture. Each window should have an oppacity setting so you can see the picture a little.

 

Graphic: I have a 3 person menu system so all i need is it to display the 3 characters sprites facing down.

Date/Time: Should display the date/time of the save with PM and AM after(will also settle for military time)

Chapter: Will display a variable i set in game that is used to show the chapter your on.

The rest you should know.

 

I need the same type of layout for loading.

 

Before you load/save it will ask you if you are sure you want to save/load and for saving if theres a file there it asks if you want to overwrite.

 

Some of the items may be hard to fit but try your best and if you need any more info feel free to ask.

If you think the order of the items are not good feel free to change it.

 

Reward: 5000 Points

 

Thanks in advance :)

Share this post


Link to post
Share on other sites

Lemme See About This I Probably Can Do This So Ill See The Default Save And Work With That...

Also I Dont Think I Can Make it Exactly The Way You Will Want It But I'll Try My Best...

Peace!!!

 

EDIT: I Tried My Best But I Cant Get The Windows Aligned Like Yours Though I Got The Date/Time , Month/Day/Year , Playtime Good But I Wasnt Able To Do It All

Im Sorry :(

Edited by viraniz

Share this post


Link to post
Share on other sites

Pol, I <3 you. You gave a beautiful description and examples, so it was really easy to make :)

 

Here is the script:

(note: All you need to configure is the constant in Window_SaveFile: set CHAPTER_VAR to the ingame variable ID of whatever the chapter variable is, and the constant in Scene_File: set SAVE_BG to the filename in the pictures folder :3)

 

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

class Window_SaveFile
 #--------------------------------------------------------------------------
 # * Constants
 #--------------------------------------------------------------------------
 CHAPTER_VAR = 1 # Change this to the variable id that stores the chapter
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :filename                 # file name
 attr_reader   :selected                 # selected
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     file_index : save file index (0-3)
 #     filename   : file name
 #--------------------------------------------------------------------------
 def initialize(file_index, filename)
   super(210 * (file_index % 3) + 10, 6 + file_index / 3 * 236, 200, 232)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.back_opacity = 160
   @file_index = file_index
   @filename = "Save#{@file_index + 1}.rxdata"
   @time_stamp = Time.at(0)
   @file_exist = FileTest.exist?(@filename)
   if @file_exist
     file = File.open(@filename, 'r')
     @time_stamp         = file.mtime
     @characters         = Marshal.load(file)
     @frame_count        = Marshal.load(file)
     @game_system        = Marshal.load(file)
     @game_switches      = Marshal.load(file)
     @game_variables     = Marshal.load(file)
     @game_self_switches = Marshal.load(file)
     @game_screen        = Marshal.load(file)
     @game_actors        = Marshal.load(file)
     @game_party         = Marshal.load(file)
     @total_sec = @frame_count / Graphics.frame_rate
     file.close
   end
   refresh
   @selected = false
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   # Draw file number
   self.contents.font.color = normal_color
   # If save file exists
   if @file_exist
     # Draw character
     w = (self.contents.width - @characters.size * 48) / 2
     @characters.each_index {|i|
       bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
       cw = bitmap.rect.width / 4
       ch = bitmap.rect.height / 4
       src_rect = Rect.new(0, 0, cw, ch)
       x = i * 48 + w + 6
       self.contents.blt(x, 0, bitmap, src_rect)
     }
     # Draw play time
     hour = @total_sec / 60 / 60
     min = @total_sec / 60 % 60
     sec = @total_sec % 60
     time_string = sprintf('%02d:%02d:%02d', hour, min, sec)
     self.contents.font.color = normal_color
     self.contents.draw_text(0, 80, self.contents.width, 32, time_string, 1)
     # Draw timestamp
     self.contents.font.color = normal_color
     time_string = @time_stamp.strftime('%Y/%m/%d %H:%M')
     self.contents.draw_text(0, 48, self.contents.width, 32, time_string, 1)
     # Draw Chapter
     chapter = "Chapter #{@game_variables[CHAPTER_VAR].to_i}"
     self.contents.draw_text(0, 112, self.contents.width, 32, chapter, 1)
     # Draw Gold
     self.contents.font.color = system_color
     self.contents.draw_text(0, 144, self.contents.width, 32, $data_system.words.gold, 1)
     self.contents.font.color = normal_color
     self.contents.draw_text(0, 170, self.contents.width, 32, @game_party.gold.to_s, 1)
   end
 end
 #--------------------------------------------------------------------------
 # * Set Selected
 #     selected : new selected (true = selected, false = unselected)
 #--------------------------------------------------------------------------
 def selected=(selected)
   @selected = selected
   update_cursor_rect
 end
 #--------------------------------------------------------------------------
 # * Cursor Rectangle Update
 #--------------------------------------------------------------------------
 def update_cursor_rect
   if @selected
     self.cursor_rect.set(0, 0, self.contents.width, self.contents.height)
   else
     self.cursor_rect.empty
   end
 end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This is a superclass for the save screen and load screen.
#==============================================================================

class Scene_File
 #--------------------------------------------------------------------------
 # * Constants
 #--------------------------------------------------------------------------
 # This is the name of the bitmap used for the save/load background, 
 # change as necessary
 SAVE_BG = '001-Title01'
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(help_text)
   # Does nothing, because I was too lazy to overwrite 
   # Scene_Save/Scene_Load's initializations...XD
 end
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Make Background
   @background = Sprite.new
   @background.bitmap = RPG::Cache.picture(SAVE_BG)
   # Make save file window
   @savefile_windows = []
   6.times {|i| @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))}
   # Select last file to be operated
   @file_index = $game_temp.last_file_index
   @savefile_windows[@file_index].selected = true
   # Execute transition
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @background.dispose
   @savefile_windows.each {|window| window.dispose }
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @savefile_windows.each {|window| window.update }
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Call method: on_decision (defined by the subclasses)
     on_decision(make_filename(@file_index))
     $game_temp.last_file_index = @file_index
     return
   end
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Call method: on_cancel (defined by the subclasses)
     on_cancel
     return
   end
   # If the down directional button was pressed
   if Input.repeat?(Input::DOWN)
     # Play cursor SE
     $game_system.se_play($data_system.cursor_se)
     # Move cursor down
     @savefile_windows[@file_index].selected = false
     @file_index = (@file_index + 3) % 6
     @savefile_windows[@file_index].selected = true
     return
   end
   # If the up directional button was pressed
   if Input.repeat?(Input::UP)
     # Play cursor SE
     $game_system.se_play($data_system.cursor_se)
     # Move cursor up
     @savefile_windows[@file_index].selected = false
     @file_index = (@file_index + 9) % 6
     @savefile_windows[@file_index].selected = true
     return
   end
   # if the left directional button was pressed
   if Input.repeat?(Input::LEFT)
     # Play cursor SE
     $game_system.se_play($data_system.cursor_se)
     # Move Cursor left
     @savefile_windows[@file_index].selected = false
     @file_index = (@file_index + 5) % 6
     @savefile_windows[@file_index].selected = true
     return
   end
   # If the right directional button was pressed
   if Input.repeat?(Input::RIGHT)
     # Play cursor SE
     $game_system.se_play($data_system.cursor_se)
     # Move Cursor Right
     @savefile_windows[@file_index].selected = false
     @file_index = (@file_index + 1) % 6
     @savefile_windows[@file_index].selected = true
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Make File Name
 #     file_index : save file index (0-3)
 #--------------------------------------------------------------------------
 def make_filename(file_index)
   return "Save#{file_index + 1}.rxdata"
 end
end

 

 

and

@viraniz: feel free to look at my code if you wanna see how i did it :3

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...