设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 124|回复: 0

[转载发布] Single Save File System

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-1 12:22:59 | 显示全部楼层 |阅读模式
    Made a script that required one save file system in the request board awhile back
    and found an urge to make the whole one save file script.
    So here it is! Single Save File System!
     

     
    Features:
    [1] Able to change the default save file name to whatever you want.
    [2] Save/Load without the need to enter save/load menu.
    [3] Display Saving Message and Icon on save
    [4] Hide Load Command in Title Scene when there is no save file
    [5] Confirmation on Restarting a new game if save file exist.
    [6] Auto delete save file when restarting a new game.
    [7] Able to change all text message/command text in the script's Settings.
    [8] Opening Save Menu using Eventing will directly save the game.
     
    How to Use:
    [1] Paste this script in your script editor below Material and above Main.
    [2] Set up your preferences in the script's SETTINGS AREA
     
    Note:
    Event's Open Save Menu will directly save the game. Please use that if you wish to force save the game.
     
    Compatibility:
    This script overwrites how the save/load is handled in game as well as some of the GUI in Title Scene.
    If you have custom script overwriting the methods this script uses, there's a chance of conflict.
     
    Terms of Use:
    Free for both commercial and non-commercial.
     
    Script:

    Spoiler                Code:       
    1. #==============================================================================# ■ Meow Face Single Save File System#------------------------------------------------------------------------------# Change the game save/load system to work on one save file only.#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] Set your preferences save file name in the script's SETTINGS AREA#==============================================================================module MeowSaveFileManager #DO NOT REMOVE!!#==============================================================================# Settings Area#==============================================================================  #---------------#  # Save File Name  #  #---------------#  FILE_NAME = "meow.dat" #save file name and extension  #--------------#  # Saving a Game #  #--------------#  SAVE_MESSAGE = "Now Saving..." #save message to display  SAVE_ICON = 286 #(icon id) set which icon to be displayed with the save message  #----------------------#  # Restarting A New Game  #  #----------------------#  CONFIRM_MESSAGE = "Are you sure to restart a new game?" #Confirmation message  OVERWRITE_WARNING = "Warning!! You will lost your current progress!" #Warning Message  YES = "I'm Sure!"  NO = "No Way!"#==============================================================================# End of Settings Area# Edit anything past this line at your own risk!#==============================================================================endmodule DataManager  def self.save_file_exists? #overwrite    !Dir.glob(MeowSaveFileManager::FILE_NAME).empty?  end  def self.savefile_max #overwrite    return 1  end  def self.make_filename(index) #overwrite    sprintf(MeowSaveFileManager::FILE_NAME, index + 1)  endendclass Game_Map  attr_accessor :sm_show  alias meow_setup_sm setup  def setup(map_id) #alias    meow_setup_sm(map_id)    @sm_show = false  end  def show_sm    SceneManager.scene.show_save_message    @sm_show = false  end  alias meow_update_sm update  def update(main = false) #alias    meow_update_sm(main)     show_sm if @sm_show  endendclass Game_Interpreter  def command_352 #overwrite    return if $game_party.in_battle    if DataManager.save_game(0)      Sound.play_save      $game_map.sm_show = true    else      Sound.play_buzzer    end  endendclass Window_SaveMessage < Window_Base  def initialize    super(Graphics.width - window_width, Graphics.height - fitting_height(1), window_width, fitting_height(1))    self.opacity = 0    self.contents_opacity = 0    @show_count = 0    refresh  end  def window_width    return 240  end  def update    super    if @show_count > 0 && $game_map.name_display      update_fadein      @show_count -= 1    else      update_fadeout    end  end  def update_fadein    self.contents_opacity += 16  end  def update_fadeout    self.contents_opacity -= 16  end  def open    refresh    @show_count = 150    self.contents_opacity = 0    self  end  def close    @show_count = 0    self  end  def refresh    contents.clear    draw_background(contents.rect)    draw_icon(MeowSaveFileManager::SAVE_ICON, contents.rect.width-24, 0)    draw_icon(MeowSaveFileManager::SAVE_ICON, contents.rect.x, 0)    draw_text(contents.rect.x,contents.rect.y,contents.rect.width, fitting_height(0), MeowSaveFileManager::SAVE_MESSAGE, 1)  end  def draw_background(rect)    temp_rect = rect.clone    temp_rect.width /= 2    contents.gradient_fill_rect(temp_rect, back_color2, back_color1)    temp_rect.x = temp_rect.width    contents.gradient_fill_rect(temp_rect, back_color1, back_color2)  end  def back_color1    Color.new(0, 0, 0, 192)  end  def back_color2    Color.new(0, 0, 0, 0)  endendclass Window_TitleCommand < Window_Command  def make_command_list #overwrite    add_command(Vocab::new_game, :new_game)    add_command(Vocab::continue, :continue, continue_enabled) if DataManager.save_file_exists?    add_command(Vocab::shutdown, :shutdown)  endendclass Window_StartNewAsk < Window_Base  def initialize    super((Graphics.width - window_width)/2, (Graphics.height - fitting_height(5))/2, window_width, fitting_height(5))    create_message  end  def window_width    return Graphics.width - 40  end  def create_message    draw_text(contents.rect.x,contents.rect.y,contents.rect.width, fitting_height(0), MeowSaveFileManager::CONFIRM_MESSAGE, 1)    draw_text(contents.rect.x,contents.rect.y+fitting_height(0),contents.rect.width, fitting_height(0), MeowSaveFileManager::OVERWRITE_WARNING, 1)    draw_text(contents.rect.x,contents.rect.y+fitting_height(2),contents.rect.width, fitting_height(0), "/", 1)  endendclass Window_StartNewConfirm < Window_HorzCommand  def initialize    super(0, 0)    update_placement    self.opacity = 0  end  def window_width    return 240  end  def col_max    return 2  end  def spacing    return 12  end  def update_placement    self.x = (Graphics.width - window_width) / 2  end  def make_command_list    add_command(MeowSaveFileManager::YES, :ok)    add_command(MeowSaveFileManager::NO,   :cancel)  endendclass Scene_Title < Scene_Base  alias meow_st_start_sm start  def start    meow_st_start_sm    create_ask_window    create_confirm_window  end  def mf_start_new_game    DataManager.setup_new_game    close_command_window    fadeout_all    $game_map.autoplay    SceneManager.goto(Scene_Map)  end  def create_ask_window    @ask_window = Window_StartNewAsk.new    @ask_window.hide  end  def create_confirm_window    @confirm_select_window = Window_StartNewConfirm.new    @confirm_select_window.y = @ask_window.y + (24*3)    @confirm_select_window.set_handler(:ok,     method(:on_confirm_ok))    @confirm_select_window.set_handler(:cancel, method(:on_confirm_cancel))    @confirm_select_window.hide.deactivate  end  def on_confirm_ok    @ask_window.close    @confirm_select_window.close    DataManager.delete_save_file(0)    mf_start_new_game  end  def on_confirm_cancel    @ask_window.hide    @confirm_select_window.hide.deactivate    @command_window.show.activate  end  def command_new_game #overwrite    if DataManager.save_file_exists?      @command_window.hide.deactivate      @ask_window.show      @confirm_select_window.show.activate    else      mf_start_new_game    end  end  def command_continue #overwrite    close_command_window    if DataManager.load_game(0)      Sound.play_load      fadeout_all      $game_system.on_after_load      SceneManager.goto(Scene_Map)    else      Sound.play_buzzer    end  endendclass Scene_Map < Scene_Base  def create_save_message_window    @sm_window = Window_SaveMessage.new  end  def show_save_message    @sm_window.open  end  alias meow_sm_caw_sm create_all_windows  def create_all_windows #alias    meow_sm_caw_sm    create_save_message_window  endendclass Scene_Menu < Scene_MenuBase  def command_save #overwrite    if DataManager.save_game(0)      Sound.play_save      $game_map.sm_show = true      return_scene    else      Sound.play_buzzer    end  endend
    复制代码








    本贴来自国际rpgmaker官方论坛作者:MeowFace处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/single-save-file-system.53139/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 23:18 , Processed in 0.125032 second(s), 59 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表