More Save Slots
#1
Extended Save
HonorBlade
Jun 29 2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


First, I have to admit this script is rather poorly done, with very little comments. But it should be working at least. It allows you to have as many save slots as you want, instead of just 4. It modifies the following classes: Window_SaveFile, Scene_File, Scene_Load, Scene_Title. Instructions how to use or modify it are included in its header.
Code:
#==================================
# Extended Save
# by HonorBlade, June 29, 2005
#
# this allows you to have as many save slots as you want
# place this somewhere before Main and after all these:
# Window_SaveFile, Scene_File, Scene_Load, Scene_Title
#
# by default you have 40 slots, to change this replace all
# 40s with N and all 39s with N-1,
# where N is the number of save slots you want to have
# (lines marked # EDIT)
#==================================

#==================================
class Window_SaveFile < Window_Base

def initialize(file_index, filename)
   super(0, 64, 640, 104)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype  # "File" (File #) window font
   self.contents.font.size = $defaultfontsize
   @file_index = file_index
   @filename = "Save#{@file_index + 1}.sav"
   @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)
     @total_sec = @frame_count / Graphics.frame_rate
     file.close
   end
   refresh
   @selected = false
end
end

#==================================
class Scene_File

def main
   # ヘルプウィンドウを作æˆ?
   @help_window = Window_Help.new
   @help_window.set_text(@help_text)
   # セーブファイルウィンドã‚�
�を作�
   # 最後ã?«æ“?作ã?—ã?Ÿãƒ•ã‚¡ã‚¤ãƒ«ã‚’é?¸æ� ž
   @file_index = $game_temp.last_file_index
   # NEW now we only have 1 window to display
   @savefile_window = Window_SaveFile.new(@file_index, make_filename(@file_index))
   @savefile_window.selected = true
   # トランジション実行
   Graphics.transition
   # メインループ
   loop do
     # ゲーãƒ� ç”»é?¢ã‚’æ›´æ–°
     Graphics.update
     # å…¥å� ›æƒ…å� ±ã‚’æ›´æ–°
     Input.update
     # フレーãƒ� æ›´æ–°
     update
     # ç”»é?¢ã?Œåˆ‡ã‚� 替ã‚?ã?£ã?Ÿã‚‰ãƒ«ãƒ¼ãƒ—を中断
     if $scene != self
       break
     end
   end
   # トランジション準備
   Graphics.freeze
   # ウィンドウを解放
   @help_window.dispose
   @savefile_window.dispose
end

def update
   # ウィンドウを更新
   @help_window.update
   @savefile_window.update
   # C ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::C)
     # メソッド on_decision (継承先ã?§å®šç¾©) を呼ã?¶
     on_decision(make_filename(@file_index))
     $game_temp.last_file_index = @file_index
     return
   end
   # B ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::B)
     # メソッド on_cancel (継承先ã?§å®šç¾©) を呼ã?¶
     on_cancel
     return
   end
   # æ–¹å?‘ボタンã?®ä¸‹ã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.repeat?(Input::DOWN)
     # æ–¹å?‘ボタンã?®ä¸‹ã?®æ� ¼ä¸‹ç� ¶æ…‹ã?Œãƒªãƒ”ートã?§ã?ªã?„å� ´å?ˆã?‹ã€?
     # ã?¾ã?Ÿã?¯ã‚«ãƒ¼ã‚½ãƒ«ä½?ç½®ã?Œ 3 よã‚� å‰?ã?®å� ´å?ˆ
       # カーソル SE ã‚’æ¼”å¥?
       $game_system.se_play($data_system.cursor_se)
       # カーソルを下ã?«ç§»å‹•
       # EDIT
       @file_index = (@file_index + 1) % 40
       # NEW recreate window with new contents
       @savefile_window.dispose
       @savefile_window = Window_SaveFile.new(@file_index, make_filename(@file_index))
       @savefile_window.selected = true
       return
   end
   # æ–¹å?‘ボタンã?®ä¸� ã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.repeat?(Input::UP)
     # æ–¹å?‘ボタンã?®ä¸� ã?®æ� ¼ä¸‹ç� ¶æ…‹ã?Œãƒªãƒ”ートã?§ã?ªã?„å� ´å?ˆã?‹ã€?
     # ã?¾ã?Ÿã?¯ã‚«ãƒ¼ã‚½ãƒ«ä½?ç½®ã?Œ 0 よã‚� 後ã‚?ã?®å� ´å?ˆ
       # カーソル SE ã‚’æ¼”å¥?
       $game_system.se_play($data_system.cursor_se)
       # カーソルをä¸� ã?«ç§»å‹•
       # EDIT
       @file_index = (@file_index + 39) % 40
       # NEW recreate window with new contents
       @savefile_window.dispose
       @savefile_window = Window_SaveFile.new(@file_index, make_filename(@file_index))
       @savefile_window.selected = true
       return
   end
end
end

#==================================
class Scene_Load < Scene_File

def initialize
   # ãƒ� ンãƒ?ラリオブジェクトをå� ?作æˆ?
   $game_temp = Game_Temp.new
   # タイãƒ� スタンプã?Œæœ€æ–°ã?®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é?¸æ� ž
   $game_temp.last_file_index = 0
   latest_time = Time.at(0)
   # EDIT
   for i in 0..39
     filename = make_filename(i)
     if FileTest.exist?(filename)
       file = File.open(filename, "r")
       if file.mtime > latest_time
         latest_time = file.mtime
         $game_temp.last_file_index = i
       end
       file.close
     end
   end
   super("Load from which file")
end
end

#==================================  
class Scene_Title

def main
   # 戦闘ãƒ� ストã?®å� ´å?ˆ
   if $BTEST
     battle_test
     return
   end
   # データベースをロード
   $data_actors        = load_data("Data/Actors.rxdata")
   $data_classes       = load_data("Data/Classes.rxdata")
   $data_skills        = load_data("Data/Skills.rxdata")
   $data_items         = load_data("Data/Items.rxdata")
   $data_weapons       = load_data("Data/Weapons.rxdata")
   $data_armors        = load_data("Data/Armors.rxdata")
   $data_enemies       = load_data("Data/Enemies.rxdata")
   $data_troops        = load_data("Data/Troops.rxdata")
   $data_states        = load_data("Data/States.rxdata")
   $data_animations    = load_data("Data/Animations.rxdata")
   $data_tilesets      = load_data("Data/Tilesets.rxdata")
   $data_common_events = load_data("Data/CommonEvents.rxdata")
   $data_system        = load_data("Data/System.rxdata")
   # シスãƒ� ãƒ� オブジェクトを作æˆ?
   $game_system = Game_System.new
   # タイトルグラフィックを作
�
   @sprite = Sprite.new
   @sprite.bitmap = RPG::Cache.title($data_system.title_name)
   # コマンドウィンドウを作æˆ?
   s1 = "New Game"
   s2 = "Continue"
   s3 = "Exit"
   @command_window = Window_Command.new(192, [s1, s2, s3])
   @command_window.back_opacity = 160
   @command_window.x = 320 - @command_window.width / 2
   @command_window.y = 288
   # コンãƒ� ィニュー有å� ¹åˆ¤å®š
   # セーブファイルã?Œã?²ã?¨ã?¤ã?§ã‚‚存在ã?™ã‚‹ã?‹ã?©ã?� ã?‹ã‚’調ã?¹ã‚‹
   # 有å� ¹ã?ªã‚‰ @continue_enabled ã‚’ trueã€?ç„¡å� ¹ã?ªã‚‰ false ã?«ã?™ã‚‹
   @continue_enabled = false
   # EDIT
   for i in 0..39
     if FileTest.exist?("Save#{i+1}.sav")
       @continue_enabled = true
     end
   end
   # コンãƒ� ィニューã?Œæœ‰å� ¹ã?ªå� ´å?ˆã€?カーソルをコンãƒ� ィニューã?«å?ˆã‚?ã?›ã‚‹
   # ç„¡å� ¹ã?ªå� ´å?ˆã€?コンãƒ� ィニューã?®æ–‡å­—をグレー表示ã?«ã?™ã‚‹
   if @continue_enabled
     @command_window.index = 1
   else
     @command_window.disable_item(1)
   end
   # タイトル BGM ã‚’æ¼”å¥?
   $game_system.bgm_play($data_system.title_bgm)
   # MEã€?BGS ã?®æ¼”å¥?ã‚’å?œæ­¢
   Audio.me_stop
   Audio.bgs_stop
   # トランジション実行
   Graphics.transition
   # メインループ
   loop do
     # ゲーãƒ� ç”»é?¢ã‚’æ›´æ–°
     Graphics.update
     # å…¥å� ›æƒ…å� ±ã‚’æ›´æ–°
     Input.update
     # フレーãƒ� æ›´æ–°
     update
     # ç”»é?¢ã?Œåˆ‡ã‚� 替ã‚?ã?£ã?Ÿã‚‰ãƒ«ãƒ¼ãƒ—を中断
     if $scene != self
       break
     end
   end
   # トランジション準備
   Graphics.freeze
   # コマンドウィンドウを解æ”�

   @command_window.dispose
   # タイトルグラフィックを解
放
   @sprite.bitmap.dispose
   @sprite.dispose
end

end
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Automatic save-slot selection Jimmie 0 2,592 05-01-2009, 01:00 PM
Last Post: Jimmie
  Zelda Style Save winter-chaos 0 2,684 03-21-2009, 01:00 PM
Last Post: winter-chaos
  Personal Save Files XP polraudio 0 2,644 11-05-2008, 01:00 PM
Last Post: polraudio
  Personal Save Files polraudio 0 2,502 07-08-2008, 01:00 PM
Last Post: polraudio
  Many Many Save Files!! stupidstormy36 0 2,578 04-10-2008, 01:00 PM
Last Post: stupidstormy36



Users browsing this thread: 2 Guest(s)