If you find your players stumble and struggle in the only 4 save slots by default, you can use this script to liberate them.
The player can start to use save slot from the first one. Once they saved they got a second, empty one. Once they saved in the second slot the got a third one, and so on.
I personally tested ~1500 saves, without any performance issues or glitches.
Terms of Use:
1. Please keep the second line of this script in your game.
2. Free to use in any kind of game.
3. Redistributions are OK, but secondary development is not allowed for this script.
You can also download a demo in the attachment. But sadly enough, the base RGSS scripts are in mandarin owing to the version I'm using.
Ruby:
#============================================================================== # ■ Unlimited Saves by SailCat #------------------------------------------------------------------------------ # Introduction: # This script allows unlimited number (albeit limited by disk space) of # saves to a game. # # Installation Guide: # Insert this script before the "Main" section, preferably lower in your # set of plugin scripts. # # Date of release: # Sep. 2, 2024 (version 1.0) # # Effects: # 1. Players can now save in unlimited slots instead of four. # * The "unlimited" number is done by checking a number sequence starting # from 1, and provide an empty slot always available. In this way, in the # first run of the game, where in the folder no saves exist. There can be # seen only one save slot instead of four. Don't worry, you save here and # you get a second empty slot next time you save, and a third, and more... # # How to use: # To move cursor up or down by 1, press UP or DOWN arrows. # To move cursor up or down by 4, press LEFT or RIGHT arrows. # To move cursor up or down by 16, press Ctrl+UP or Ctrl+DOWN. # To move cursor up or down by 64, press Ctrl+LEFT or Ctrl+RIGHT. # To move cursor up or down by 256, press PGUP or PGDN keys. # To move cursor to the top or bottom, press Ctrl+PGUP or Ctrl+PGDN. #============================================================================== class Scene_File #-------------------------------------------------------------------------- # ● Additional Attributes #-------------------------------------------------------------------------- attr_reader :top_index # Top index of save file unless method_defined? :sailcat_initialize alias sailcat_initialize initialize end #-------------------------------------------------------------------------- # ● Initialize # help_text : the text to help #-------------------------------------------------------------------------- def initialize(help_text) sailcat_initialize(help_text) @file_count ||= save_count end #-------------------------------------------------------------------------- # ● Set top index and redraw the next four windows # index : new top index #-------------------------------------------------------------------------- def top_index=(index) index = [0, [index / 4 * 4, @file_count - 1].min].max if @top_index != index @top_index = index redraw_windows end end #-------------------------------------------------------------------------- # ● Main processing #-------------------------------------------------------------------------- def main @help_window = Window_Help.new @help_window.set_text(@help_text) @file_index = [@file_count - 1, $game_temp.last_file_index].min self.top_index = @file_index @savefile_windows[@file_index % 4].selected = true Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @help_window.dispose for i in @savefile_windows i.dispose end end #-------------------------------------------------------------------------- # ● Update windows #-------------------------------------------------------------------------- def update @help_window.update for i in @savefile_windows[0..3] i.update end if Input.trigger?(Input::C) on_decision(make_filename(@file_index)) $game_temp.last_file_index = @file_index return end if Input.trigger?(Input::B) on_cancel return end if Input.repeat?(Input::DOWN) move_index(Input.press?(Input::CTRL) ? 16 : 1) return end if Input.repeat?(Input::UP) move_index(Input.press?(Input::CTRL) ? -16 : -1) return end if Input.repeat?(Input::LEFT) move_index(Input.press?(Input::CTRL) ? -64 : -4) return end if Input.repeat?(Input::RIGHT) move_index(Input.press?(Input::CTRL) ? 64 : 4) return end if Input.trigger?(Input::R) Input.press?(Input::CTRL) ? set_index(-1) : move_index(256) return end if Input.trigger?(Input::L) Input.press?(Input::CTRL) ? set_index(0) : move_index(-256) return end end #-------------------------------------------------------------------------- # ● Make filename # file_index : index of file (0 to 3) #-------------------------------------------------------------------------- def make_filename(file_index) return "Save#{file_index + 1}.rxdata" end #-------------------------------------------------------------------------- # ● Move cursor # distance : move by distance #-------------------------------------------------------------------------- def move_index(distance) if @file_index == 0 and distance < 0 set_index(-1) elsif @file_index == @file_count - 1 and distance > 0 set_index(0) else set_index([0, [@file_index + distance, @file_count - 1].min].max) end end #-------------------------------------------------------------------------- # ● Set cursor # new_index : new cursor index #-------------------------------------------------------------------------- def set_index(new_index) new_index += @file_count if new_index < 0 $game_system.se_play($data_system.cursor_se) @savefile_windows[@file_index % 4].selected = false @file_index = new_index self.top_index = new_index @savefile_windows[@file_index % 4].selected = true end #-------------------------------------------------------------------------- # ● Test count of save files #-------------------------------------------------------------------------- def save_count i = 0 while FileTest.exists?(make_filename(i)) i += 1 end return self.is_a?(Scene_Save) ? i + 1 : i end #-------------------------------------------------------------------------- # ● Redraw windows #-------------------------------------------------------------------------- def redraw_windows @savefile_windows.each { |i| i.dispose } unless @savefile_windows == nil @savefile_windows = [] for i in @top_index...[@top_index + 4, @file_count].min filename = make_filename(i) window = Window_SaveFile.new(i, filename) window.y = i % 4 * 104 + 64 @savefile_windows.push(window) end (4 - @savefile_windows.size).times do |i| window = Window_Base.new(0, 376 - i * 104, 640, 104) window.opacity = window.back_opacity = 128 @savefile_windows.push(window) end end end class Scene_Load < Scene_File #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize $game_temp = Game_Temp.new $game_temp.last_file_index = 0 latest_time = Time.at(0) @file_count = save_count for i in 0...@file_count File.open(make_filename(i), "r") do |f| if f.mtime > latest_time latest_time = f.mtime $game_temp.last_file_index = i end end end super("Which file to load?") end end 复制代码
本贴来自国际rpgmaker官方论坛作者:SailCat处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/unlimited-save-slots-for-xp.171617/