Status
Not open for further replies.
Joined
Apr 17, 2013
Messages
146
Reaction score
9
First Language
English
Primarily Uses
N/A
Hey. My game uses custom scripts to turn the 1st save slot into an Autosave slot, and the 2nd one into a Quick-Save slot. Can anyone make a mini-script that disables manually saving into either of these slots so players don't accidentally lose their progress (but does not inhibit the either the auto or quick-save)?

The following are the save-related scripts my game uses:

Code:
module ADIK
  module QUICK
   
    #Is the system enabled?
    ENABLED = true
   
    #Save file index to be used by Quick save/load
    #Note that by default the first file is index 0
    INDEX = 1
   
    #SaveLoad Keybindings
    #Default are L and R keys (Q/W at the keyboard by default)
    SAVE_KEY = :L
    LOAD_KEY = :L
   
    #Set these if you want to use a button "combo" to activate the system
    #Example if SAVE_KEY is set as :L and SAVE_KEY_2 is set as :A
    #then you need to press both to activate the quick save
    SAVE_KEY_2 = nil
    LOAD_KEY_2 = :A
   
    #Is the system allowed in battle scene?
    #I suggest keeping this as false
    ALLOW_AT_BATTLE = false
   
    #Is the system allowed during the Show Text event command?
    ALLOW_AT_TEXT = false
   
  end
end

# DO NOT EDIT BELOW THIS LINE

if ADIK::QUICK::ENABLED

  class Scene_Quick < Scene_File
   
    attr_accessor :quick_save
    attr_accessor :quick_load
   
    def create_help_window
    end
    def help_window_text
    end
    #def create_savefile_viewport
      #@savefile_viewport = Viewport.new
      #@savefile_viewport.rect.y = 0
     # @savefile_viewport.rect.height = 0
    #end
    #def create_savefile_windows
     # @savefile_windows = Array.new(item_max) do |i|
       # Window_SaveFile.new(savefile_height, i)
      #end
     # @savefile_windows.each {|window| window.viewport = @savefile_viewport; window.hide }
    #end
    def init_selection
    end
   
    def update
      if @quick_save
        if DataManager.save_game(ADIK::QUICK::INDEX)
          Sound.play_save
        else
          Sound.play_buzzer
        end
        @quick_save = false
        SceneManager.return
      end
      if @quick_load
        if DataManager.load_game(ADIK::QUICK::INDEX)
          Sound.play_load
          $game_system.on_after_load
          @quick_load = false
          SceneManager.goto(Scene_Map)
        else
          Sound.play_buzzer
          @quick_load = false
          SceneManager.return
        end
      end
    end
   
    def quicksave
      @quick_save = true
    end
   
    def quickload
      @quick_load = true
    end
   
  end
 
  class Scene_Base
   
    def quicksave
      SceneManager.call(Scene_Quick)
      SceneManager.scene.quicksave
    end
   
    def quickload
      SceneManager.call(Scene_Quick)
      SceneManager.scene.quickload
    end
   
    def is_quicksave
      if ADIK::QUICK::SAVE_KEY_2 != nil
        return (Input.trigger?(ADIK::QUICK::SAVE_KEY) and Input.press?(ADIK::QUICK::SAVE_KEY_2))
      else
        if ADIK::QUICK::LOAD_KEY_2 != nil
          return false if Input.press?(ADIK::QUICK::LOAD_KEY_2)
        end
        return Input.trigger?(ADIK::QUICK::SAVE_KEY)
      end
    end
   
    def is_quickload
      if ADIK::QUICK::LOAD_KEY_2 != nil
        return (Input.trigger?(ADIK::QUICK::LOAD_KEY) and Input.press?(ADIK::QUICK::LOAD_KEY_2))
      else
        if ADIK::QUICK::SAVE_KEY_2 != nil
          return false if Input.press?(ADIK::QUICK::SAVE_KEY_2)
        end
        return Input.trigger?(ADIK::QUICK::LOAD_KEY)
      end
    end

   
    def quicksystem
      if is_quicksave and not SceneManager.scene_is?(Scene_Save)
        if SceneManager.scene_is?(Scene_Battle) then
          if ADIK::QUICK::ALLOW_AT_BATTLE
            quicksave
          end
        else
          quicksave
        end
        return
      end
      if is_quickload and not SceneManager.scene_is?(Scene_Load)
        if SceneManager.scene_is?(Scene_Battle) then
          if ADIK::QUICK::ALLOW_AT_BATTLE
            quickload
          end
        else
          quickload
        end
        return
      end
    end
   
    alias update_quicksystem update
    def update
      update_quicksystem
      quicksystem
    end
   
  end
 
  class Game_Interpreter
 
    def wait_for_message
      while $game_message.busy?
        SceneManager.scene.quicksystem
        Fiber.yield  
      end
    end
     
  end
 
end

Autosave by V.M of D.T

Code:
module DataManager
  def self.save_game_without_rescue(index)
    File.open(make_filename(index), "wb") do |file|
      $game_system.on_before_save
      scene = SceneManager.scene
      scene.dispose_lights if scene.is_a?(Scene_Map)
      Marshal.dump(make_save_header, file)
      Marshal.dump(make_save_contents, file)
      scene.setup_lights if scene.is_a?(Scene_Map)
      @last_savefile_index = index
    end
    return true
  end
end

class Scene_Map
  def dispose_lights; @spriteset.dispose_lights; end
  def setup_lights; @spriteset.setup_lights; end
end

Mog's Scene File A

Whoever helps, your names will be added in the game's credits.
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,368
Reaction score
799
First Language
English
Primarily Uses
RMVXA
What are you using for specifying how many save slots are in the game?
default is 16.
You could simply modify these so that they used slots 17 & 18.
Otherwise something will have to be made to block slots 0 & 1.
And that will require a modification to the script you have that saves the game manually.
If it is the default, then I can work on a solution.
Works for default
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Block Save Slots             ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║     Block player from saving        ╠════════════════════╣
# ║     into specific save slots        ║    18 Sep 2021     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   Specify the slots to block in the array                ║
# ║     Blocked = [1,4]                                      ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use:                       ║
# ║ Free for all uses in RPG Maker      ║
# ╚═════════════════════════════════════╝
module R2_Save_Block
  Blocked = [0,1]
end

class Scene_Save < Scene_File
  def on_savefile_ok
    super
    if R2_Save_Block::Blocked.include?(@index)
      Sound.play_buzzer
    else
      if DataManager.save_game(@index)
        on_save_success
      else
        Sound.play_buzzer
      end
    end
  end
end
 
Last edited:
Joined
Apr 17, 2013
Messages
146
Reaction score
9
First Language
English
Primarily Uses
N/A
What are you using for specifying how many save slots are in the game?
default is 16.
You could simply modify these so that they used slots 17 & 18.
Otherwise something will have to be made to block slots 0 & 1.
And that will require a modification to the script you have that saves the game manually.
If it is the default, then I can work on a solution.
Works for default
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Block Save Slots             ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║     Block player from saving        ╠════════════════════╣
# ║     into specific save slots        ║    18 Sep 2021     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   Specify the slots to block in the array                ║
# ║     Blocked = [1,4]                                      ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use:                       ║
# ║ Free for all uses in RPG Maker      ║
# ╚═════════════════════════════════════╝
module R2_Save_Block
  Blocked = [0,1]
end

class Scene_Save < Scene_File
  def on_savefile_ok
    super
    if R2_Save_Block::Blocked.include?(@index)
      Sound.play_buzzer
    else
      if DataManager.save_game(@index)
        on_save_success
      else
        Sound.play_buzzer
      end
    end
  end
end
I want the player to see those 2 saves (auto and quick) as the first ones when he tries to load, so unfortunately, I can't move them to the end of the stack.
Edit: Oh... Your solution pretty much works even with the Mog Scene script on. Thanks Ronin.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,114
Reaction score
5,965
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Making games is the only thing I'm good at. Real talk.
So, uh... where's the RPG Maker MZ update with the MV animation system? Is there a release date confirmed?
Also I'm kind of brave enough to admit this. I... I have a crush on Sephiroth.
Please don't call me anything offensive. I'm naturally crazy.
thanks to a lot of lunatic coding... my game finally has a stun mechanic that I feel really good about. damage enemy's mental psyche (mp), and once empty, hitting with certain attacks trigger combos that can stack the damage.
Waiting for the 1.40 update before testing out my copy of MZ so that I don't end up adding unnecessary work to my plate. Meanwhile the current fourth draft for my story is taking shape, and I'm fleshing out the lore as I realize how things would make better sense here and there for the world that I'm building.
Sword_of_Dusk wrote on BCj's profile.
Just found out about your complications. I'm so sorry that you're going through this. I wish I could do something substantial for you, but our distance from each other makes that an impossibility. Still, if you ever need to talk or vent, I'm here.

Forum statistics

Threads
117,112
Messages
1,104,680
Members
153,149
Latest member
gabbothedead
Top