じ☆ve冰风 发表于 2026-8-2 14:44:29

Save/Load menu on button press, or quick save/load

You will find variations for what this script does, but I couldn't find one that only handled save/load functionality.

                Ruby:       
=begin
===============================================================================
Save Menu on button press (by Zero_G) v1.0
Version: RGSS3
===============================================================================
==Description ==
This script will open the save/load window on a button press.
If quick function is activate it will save/load to a determine slot
More actions for buttons can be done.

== Terms of Use ==
- Free for use in non-commercial projects with credits
- Free for use in commercial projects
- Please provide credits to Zero_G

== Credits ==
-Script modified from "Button Common Events" by "Yanfly"

== Usage ==
Just add the plugin before main.
-------------------------------------------------------------------------------
=end

module ZERO

SAVE_KEY = :L
LOAD = true    # Activate or deactivate load function
LOAD_KEY = :F9
QUICK = false# Actiavte or deactivate quick save/load function
SLOT = 0       # Slot to quick save/load

end

class Scene_Map < Scene_Base

#--------------------------------------------------------------------------
# alias method: update_scene
#--------------------------------------------------------------------------
alias scene_map_update_scene_bce update_scene
def update_scene
    scene_map_update_scene_bce
    unless scene_changing?
      # Save function
      if Input.trigger?(ZERO::SAVE_KEY)
            if ZERO::QUICK
                DataManager.save_game(ZERO::SLOT)
            Sound.play_save
            else
            SceneManager.call(Scene_Save)
          end
      end
      
      # Load function
      if Input.trigger?(ZERO::LOAD_KEY) && ZERO::LOAD
            if ZERO::QUICK
                Sound.play_load
            DataManager.load_game(ZERO::SLOT)
            SceneManager.goto(Scene_Map)
            else
            SceneManager.call(Scene_Load)
          end
      end
      #More inputs con be put here
      end
end
end # Scene_Map

#Actions during message window
class Window_Message < Window_Base
alias zero_save_update update
def update
    zero_save_update
    if Input.trigger?(ZERO::LOAD_KEY) && ZERO::LOAD
      if ZERO::QUICK
            Sound.play_load
          DataManager.load_game(ZERO::SLOT)
          SceneManager.goto(Scene_Map)
      else
          SceneManager.call(Scene_Load)
      end
    end
end
end # Window_message



If you want the functionality separated in two scripts.
SpoilerSave/Load menu on button press
Spoiler                Ruby:       
=begin
===============================================================================
Save Menu on button press (by Zero_G)
Version: RGSS3
===============================================================================
==Description ==
This script will open the save/load window on a button press.
More actions for buttons can be done.

== Terms of Use ==
- Free for use in non-commercial projects with credits
- Free for use in commercial projects
- Please provide credits to Zero_G

== Credits ==
-Script modified from "Button Common Events" by "Yanfly"

== Usage ==
Just add the plugin before main.
-------------------------------------------------------------------------------
=end

module ZERO

SAVE_KEY = :L
LOAD = true    #Activate or deactivate load function
LOAD_KEY = :F9

end

# Actions during normal play
class Scene_Map < Scene_Base
alias scene_map_update_scene_bce update_scene
def update_scene
    scene_map_update_scene_bce
    unless scene_changing?
      if Input.trigger?(ZERO::SAVE_KEY)
      SceneManager.call(Scene_Save) # Input code for button press here
      end
      if Input.trigger?(ZERO::LOAD_KEY) && ZERO::LOAD
      SceneManager.call(Scene_Load)
      end
      #More inputs con be put here
    end
end
end # Scene_Map

#Actions during message window
class Window_Message < Window_Base
alias zero_save_update update
def update
    zero_save_update
    if Input.trigger?(ZERO::LOAD_KEY) && ZERO::LOAD
      SceneManager.call(Scene_Load)
    end
end
end # Window_message






Quick save/load on button press
Spoiler                Ruby:       
=begin
===============================================================================
Save Quick on button press (by Zero_G)
Version: RGSS3
===============================================================================
==Description ==
This script will quick save/load to a determine slot
More actions for buttons can be done.

== Terms of Use ==
- Free for use in non-commercial projects with credits
- Free for use in commercial projects
- Please provide credits to Zero_G

== Credits ==
-Script modified from "Button Common Events" by "Yanfly"

== Usage ==
Just add the plugin before main.
-------------------------------------------------------------------------------
=end

module ZERO

SAVE_KEY = :L
LOAD = true    #Activate or deactivate load function
LOAD_KEY = :R
SLOT = 0

end

# Actions during normal play
class Scene_Map < Scene_Base
alias scene_map_update_scene_bce update_scene
def update_scene
    scene_map_update_scene_bce
    unless scene_changing?
      if Input.trigger?(ZERO::SAVE_KEY)
          DataManager.save_game(ZERO::SLOT)
          Sound.play_save
      end
      if Input.trigger?(ZERO::LOAD_KEY) && ZERO::LOAD
          Sound.play_load
          DataManager.load_game(ZERO::SLOT)
          SceneManager.goto(Scene_Map)
      end
      #More inputs con be put here
      end
end
end # Scene_Map

#Actions during message window
class Window_Message < Window_Base
alias zero_save_update update
def update
    zero_save_update
    if Input.trigger?(ZERO::LOAD_KEY) && ZERO::LOAD
      Sound.play_load
      DataManager.load_game(ZERO::SLOT)
      SceneManager.goto(Scene_Map)
    end
end
end # Window_message












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