じ☆ve冰风 发表于 2026-8-2 11:34:06

Paramecium Save Extensions

Paramecium Save Extensions

This is a small script that allows multiple other scripts to change what the game does upon saving, loading, and starting a new game without interfering with one-another. For example, a script could use this to make the game save and load a global variable defined in that script and to initialize it when a new game is started.

Script

Spoiler($imported||={})["Paramecium Save Extensions"] = truemodule SaveExtensions        New_Game_Procs = []        Save_Procs = []        Load_Procs = []endmodule DataManager        def self.setup_new_game                create_game_objects                $game_party.setup_starting_members                $game_map.setup($data_system.start_map_id)                $game_player.moveto($data_system.start_x, $data_system.start_y)                $game_player.refresh                Graphics.frame_count = 0                SaveExtensions::New_Game_Procs.each{|fn|                        fn.call()                }        end        def self.make_save_contents                contents = {}                SaveExtensions::Save_Procs.each{|fn|                        fn.call(contents)                }                contents[:system]      = $game_system                contents[:timer]         = $game_timer                contents[:message]       = $game_message                contents[:switches]      = $game_switches                contents[:variables]   = $game_variables                contents[:self_switches] = $game_self_switches                contents[:actors]      = $game_actors                contents[
arty]         = $game_party                contents[:troop]         = $game_troop                contents[:map]         = $game_map                contents[
layer]      = $game_player                contents        end        def self.extract_save_contents(contents)                $game_system      = contents[:system]                $game_timer         = contents[:timer]                $game_message       = contents[:message]                $game_switches      = contents[:switches]                $game_variables   = contents[:variables]                $game_self_switches = contents[:self_switches]                $game_actors      = contents[:actors]                $game_party         = contents[
arty]                $game_troop         = contents[:troop]                $game_map         = contents[:map]                $game_player      = contents[
layer]                SaveExtensions::Load_Procs.each{|fn|                        fn.call(contents)                }        endend 



Usage

To extend what the game does when starting a new game, add a new Proc to SaveExtensions::New_Game_Procs.

To extend what the game does when saving a game, add a new Proc that takes an argument consisting of the data that will be saved to SaveExtensions::Save_Procs.

To extend what the game does when loading a game, add a new Proc that takes an argument consisting of the data that was loaded to SaveExtensions::Load_Procs.

Used In

Paramecium Core


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