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

[转载发布] Change Switches/Self Switches/Variables to Global Save Data

[复制链接]
累计送礼:
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:52:36 | 显示全部楼层 |阅读模式
    Made for a request here.

    This script changes the default game Switches/Self Switches/Variables into global save at the developer's choice.

    Allowing them to be shared across the game saved files/new game.

    Features:

    [1] Able to change default Switches/Variables/Self Switches into global shared data

    [2] Auto update global data when players save their game

    [3] Global data is shared among all loaded game/new game

    [4] Able to choose which set of data to be changed into global save data

    [5] Able to set the name of the save file

    How to Use:

    [1] Paste this below Material and above all your custom scripts in the script editor.

    [2] Use this script call to force save the global data only.

    force_global_saveCompatibility:

    This script overwrites the save/load method of the default engine.

    It might conflicts with custom scripts that overwrite the save/load method.

    Try place this script above all your custom scripts to avoid problems.

    Note that Save files made before installing this script will not be usable after the installation.

    Any changes made to the script after installation will require a new set of save files after that too.

    Terms of Use:

    Free for both commercial and non-commercial

    Script:

    Spoiler                Code:       
    1. #==============================================================================# ■ Meow Face Global Data Manager#------------------------------------------------------------------------------# Change Self Switches / Switches / Variables into Global#==============================================================================# How to Use:# [1] Paste this below Material and above All your Custom Scripts# [2] Use this script call to force save global file only#     force_global_save#==============================================================================module MeowDataManager #Do Not Remove!!#==============================================================================# Settings Area#==============================================================================  FILENAME = "Save00.rvdata2"     #File Name for Global Save  GLOBAL_SWITCH = true              #Use Global Switch? (true/false)  GLOBAL_VARIABLE = true           #Use Global Variable? (true/false)  GLOBAL_SELF_SWITCH = false      #Use Global Self Switch? (true/false)#==============================================================================# End of Settings Area# Edit anything past this line at your own risk!#==============================================================================endmodule DataManager  def self.make_save_contents #overwrite    contents = {}    contents[:system]        = $game_system    contents[:timer]         = $game_timer    contents[:message]       = $game_message    contents[:switches]      = $game_switches if !MeowDataManager::GLOBAL_SWITCH    contents[:variables]     = $game_variables if !MeowDataManager::GLOBAL_VARIABLE    contents[:self_switches] = $game_self_switches if !MeowDataManager::GLOBAL_SELF_SWITCH    contents[:actors]        = $game_actors    contents[:party]         = $game_party    contents[:troop]         = $game_troop    contents[:map]           = $game_map    contents[:player]        = $game_player    contents  end  def self.extract_save_contents(contents) #overwrite    $game_system        = contents[:system]    $game_timer         = contents[:timer]    $game_message       = contents[:message]    $game_switches      = contents[:switches] if !MeowDataManager::GLOBAL_SWITCH    $game_variables     = contents[:variables] if !MeowDataManager::GLOBAL_VARIABLE    $game_self_switches = contents[:self_switches] if !MeowDataManager::GLOBAL_SELF_SWITCH    $game_actors        = contents[:actors]    $game_party         = contents[:party]    $game_troop         = contents[:troop]    $game_map           = contents[:map]    $game_player        = contents[:player]  end  def self.make_global_contents #new    contents = {}    contents[:switches]      = $game_switches if MeowDataManager::GLOBAL_SWITCH    contents[:variables]     = $game_variables if MeowDataManager::GLOBAL_VARIABLE    contents[:self_switches] = $game_self_switches if MeowDataManager::GLOBAL_SELF_SWITCH    contents  end  def self.extract_global_contents(contents) #new    $game_switches      = contents[:switches] if MeowDataManager::GLOBAL_SWITCH    $game_variables     = contents[:variables] if MeowDataManager::GLOBAL_VARIABLE    $game_self_switches = contents[:self_switches] if MeowDataManager::GLOBAL_SELF_SWITCH  end  def self.save_game_without_rescue(index) #overwrite    File.open(make_filename(index), "wb") do |file|      $game_system.on_before_save      Marshal.dump(make_save_header, file)      Marshal.dump(make_save_contents, file)      @last_savefile_index = index    end    self.global_save    return true  end  def self.load_game_without_rescue(index) #overwrite    File.open(make_filename(index), "rb") do |file|      Marshal.load(file)      extract_save_contents(Marshal.load(file))      reload_map_if_updated      @last_savefile_index = index    end    self.global_load    return true  end  def self.global_save #new    File.open(MeowDataManager::FILENAME, "wb") do |file|      Marshal.dump(make_global_contents, file)    end    return true  end  def self.global_load #new    File.open(MeowDataManager::FILENAME, "rb") do |file|      extract_global_contents(Marshal.load(file))      reload_map_if_updated    end    return true  end  def self.setup_new_game #overwrite    create_game_objects    $game_party.setup_starting_members    $game_map.setup($data_system.start_map_id)    if File.exist?(MeowDataManager::FILENAME)      self.global_load    end    $game_player.moveto($data_system.start_x, $data_system.start_y)    $game_player.refresh    Graphics.frame_count = 0  endendclass Game_Interpreter  def force_global_save #new    DataManager.global_save  endend
    复制代码








    本贴来自国际rpgmaker官方论坛作者:MeowFace处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/change-switches-self-switches-variables-to-global-save-data.54165/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 23:23 , Processed in 0.135645 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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