VXAce Permanent / Global Switches?

Hello! I was wondering if anybody had or could make a script where when a Switch is turned on, in a new save file that same switch will remain turned on.

How I want to use this in my game is that the game I'm currently working on lets you choose between 4 Classes/Characters to play as. I had the idea that once you beat the game once you'd be able to unlock a new character or you could unlock new characters through ought the game as secrets. I'd do this by having specific Switches set that once they're on, you can see that there's new classes unlocked on the character/class select screen at the very start of a new save file.

I tried searching for a script like this, and I did find Hime's "Preserve Data" but it just isn't working out. I also keep seeing people link "Global Save File" by Skul, however, well. Just try clicking on the hyperlink. The site the script is on has seemed to shut down or something, it just keeps loading forever and ever for me before it stops loading and my browser just gives me a connection time out. I've seen a good few other posts with people wanting to do very similar things as I want to do for my game, and people say Skul's script is perfect for the job, and obviously I can't really get to that.

If anybody has a backup to Skul's script, or has some kind of alternative, or even wouldn't mind going out of their way to make a script their selves for this, it'd be a HUGE help!

Thanks a ton in advance! ^_^
This thread was moved from RGSS3 Scripts (RMVX Ace) to RGSS3 Script Requests.
Bumping this
If anybody has a backup to Skul's script, or has some kind of alternative, or even wouldn't mind going out of their way to make a script their selves for this, it'd be a HUGE help
It's actually a script by TheLeech.
Here's the original and the modded one by Theoallen making it compatible with other scripts.
Spoiler: Original
Ruby:
#==============================================================================
# # Global Save System [v1.0]
# # By theLEECH
#==============================================================================
# # Overwrites:
# # in module DataManager:
# # # self.load_game(index)
# # # self.save_game(index)
# # # self.setup_new_game
#==============================================================================
# ---INSTRUCTIONS---
# Put the numbers of the variables to save and the switches to save in the
# VARIABLES_TO_SAVE array, and the SWITCHES_TO_SAVE array.
# If you want to automatically load/update the globally saved data, set the
# SAVE_ON_SAVE LOAD_ON_LOAD and LOAD_ON_NEW flags to true accordingly.
#------------------------------------------------------------------------------
# You can load and save global data within an event, by using the script command
# and entering: "global_save" or "global_load" (Without qoutations)
#==============================================================================
#==============================================================================
# # LGlobalSave
#==============================================================================
$imported ||= {}
$imported[:lglobal_save] = 1.0

module LGlobalSave

  #==============================================================================
  # CONFIGURATION
  #==============================================================================
  # Whether or not the variables and switches in the global file should be
  # saved when the player saves the game
  SAVE_ON_SAVE = true
  # Whether or not the variables and switches in the global file should be
  # loaded when the player loads a save file
  LOAD_ON_LOAD = true
  # Whether or not the variables and switches in the global file should be
  # loaded when the player starts a new game
  LOAD_ON_NEW = true
  # An array that contains a list of variables to save in the global save file
  # Enter a list of variables, by number, seperated by commas.
  # You can use '..' to include all variables between two numbers
  # Example: 15..42
  # Will include all variables or switches between 15 and 42 (inclusive)
  # Leave blank to save none of that type
  VARIABLES_TO_SAVE = [25..30]
  # Same as above, but for switches
  SWITCHES_TO_SAVE = [25..27, 29, 101]
  # The name of the file to save global variables and switches in
  FILE_NAME = "Global.rvdata2"
  #==============================================================================
  # END OF CONFIGURATION
  #==============================================================================

  def self.saveTheFile(f)
    File.open(FILE_NAME, "wb") do |file|
      Marshal.dump(f, file)
    end
  end

  def self.loadTheFile
    if !File.exists?(LGlobalSave::FILE_NAME)
      f = makeNewFile
      return f
    else
      f = nil
      File.open(FILE_NAME, "rb") do |file|
        f = Marshal.load(file)
      end
      return f
    end
  end

  def self.makeNewFile
    return LGlobalSaveFile.new
  end

  def self.loadVariables(f)
    for i in VARIABLES_TO_SAVE
      $game_variables[i]= f.getVar(i)
    end
  end

  def self.loadSwitches(f)
    for i in SWITCHES_TO_SAVE
      $game_switches[i]= f.getSwitch(i)
    end
  end

  def self.saveVariables(f)
    for i in VARIABLES_TO_SAVE
      f.setVar(i, $game_variables[i])
    end
  end

  def self.saveSwitches(f)
    for i in SWITCHES_TO_SAVE
      f.setSwitch(i, $game_switches[i])
    end
  end

  def self.save
    f = makeNewFile
    saveVariables(f)
    saveSwitches(f)
    saveTheFile(f)
  end

  def self.load
    f = loadTheFile
    loadVariables(f)
    loadSwitches(f)
  end

end # end of module LGlobalSave

#==============================================================================
# ** LGlobalSaveFile
#------------------------------------------------------------------------------
# An object of this class is saved in the global.sav file
# It contains all the saved variables and switches
#==============================================================================
class LGlobalSaveFile

  def initialize # Initializes the object
    @var = []
    @switch = []
  end

  # @var holds the saved variables
  # set and get methods:
  def getVar(id)
    return @var[id]
  end
 
  def setVar(id, val)
    @var[id] = val
  end

  # @switch holds the saved switches
  # set and get methods:
  def getSwitch(id)
    return @switch[id]
  end
 
  def setSwitch(id, val)
    @switch[id] = val
  end

end # end of class LGlobalSaveFile

#==============================================================================
# These methods are for saving and loading the global save file from an event
#==============================================================================
def global_save
  LGlobalSave.save
end
def global_load
  LGlobalSave.load
end
#==============================================================================
# ** DataManager
#==============================================================================
module DataManager

  #--------------------------------------------------------------------------
  # overwrite method: self.setup_new_game
  #--------------------------------------------------------------------------
  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
    LGlobalSave.load if LGlobalSave::LOAD_ON_NEW
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.save_game(index)
  #--------------------------------------------------------------------------
  def self.save_game(index)
    begin
      save_game_without_rescue(index)
    rescue
      delete_save_file(index)
      false
    end
    LGlobalSave.save if LGlobalSave::SAVE_ON_SAVE
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.load_game(index)
  #--------------------------------------------------------------------------
  def self.load_game(index)
    load_game_without_rescue(index) rescue false
    LGlobalSave.load if LGlobalSave::LOAD_ON_LOAD
  end
end # end of module DataManager
Spoiler: Improved
Ruby:
#==============================================================================
# # Global Save System [v1.0b]
# # By theLEECH
# # Fixed by TheoAllen
#==============================================================================
# ---INSTRUCTIONS---
# Put the numbers of the variables to save and the switches to save in the
# VARIABLES_TO_SAVE array, and the SWITCHES_TO_SAVE array.
# If you want to automatically load/update the globally saved data, set the
# SAVE_ON_SAVE LOAD_ON_LOAD and LOAD_ON_NEW flags to true accordingly.
#------------------------------------------------------------------------------
# You can load and save global data within an event, by using the script command
# and entering: "global_save" or "global_load" (Without qoutations)
#==============================================================================
#==============================================================================
# # LGlobalSave
#==============================================================================
module LGlobalSave

#==============================================================================
# CONFIGURATION
#==============================================================================
# Whether or not the variables and switches in the global file should be
# saved when the player saves the game
  SAVE_ON_SAVE = false
# Whether or not the variables and switches in the global file should be
# loaded when the player loads a save file
  LOAD_ON_LOAD = false
# Whether or not the variables and switches in the global file should be
# loaded when the player starts a new game
  LOAD_ON_NEW = true
# An array that contains a list of variables to save in the global save file
# Enter a list of variables, by number, seperated by commas.
# You can use '..' to include all variables between two numbers
# Example: 15..42
# Will include all variables or switches between 15 and 42 (inclusive)
# Leave blank to save none of that type
  VARIABLES_TO_SAVE = [1]
# Same as above, but for switches
  SWITCHES_TO_SAVE = [1,13]
# The name of the file to save global variables and switches in
  FILE_NAME = "Global.rvdata2"
#==============================================================================
# END OF CONFIGURATION
#==============================================================================

  def self.saveTheFile(f)
    File.open(FILE_NAME, "wb") do |file|
      Marshal.dump(f, file)
    end
  end

  def self.loadTheFile
    if !File.exists?(LGlobalSave::FILE_NAME)
      f = makeNewFile
      return f
    else
      f = nil
      File.open(FILE_NAME, "rb") do |file|
        f = Marshal.load(file)
      end
      return f
    end
  end

  def self.makeNewFile
    return LGlobalSaveFile.new
  end

  def self.loadVariables(f)
    for i in VARIABLES_TO_SAVE
      $game_variables[i]= f.getVar(i)
    end
  end

  def self.loadSwitches(f)
    for i in SWITCHES_TO_SAVE
      $game_switches[i]= f.getSwitch(i)
    end
  end

  def self.saveVariables(f)
    for i in VARIABLES_TO_SAVE
      f.setVar(i, $game_variables[i])
    end
  end

  def self.saveSwitches(f)
    for i in SWITCHES_TO_SAVE
      f.setSwitch(i, $game_switches[i])
    end
  end

  def self.save
    f = makeNewFile
    saveVariables(f)
    saveSwitches(f)
    saveTheFile(f)
  end

  def self.load
    f = loadTheFile
    loadVariables(f)
    loadSwitches(f)
  end

end # end of module LGlobalSave

#==============================================================================
# ** LGlobalSaveFile
#------------------------------------------------------------------------------
# An object of this class is saved in the global.sav file
# It contains all the saved variables and switches
#==============================================================================
class LGlobalSaveFile

  def initialize # Initializes the object
    @var = []
    @switch = [1]
  end

# @var holds the saved variables
# set and get methods:
  def getVar(id)
    return @var[id]
  end
 
  def setVar(id, val)
    @var[id] = val
  end

# @switch holds the saved switches
# set and get methods:
  def getSwitch(id)
    return @switch[id]
  end
 
  def setSwitch(id, val)
    @switch[id] = val
  end

end # end of class LGlobalSaveFile

#==============================================================================
# These methods are for saving and loading the global save file from an event
#==============================================================================
def global_save
  LGlobalSave.save
end
def global_load
  LGlobalSave.load
end
#==============================================================================
# ** DataManager
#==============================================================================
module DataManager
  class << self
    alias glob_new_game setup_new_game
  end
  def self.setup_new_game
    glob_new_game
    LGlobalSave.load if LGlobalSave::LOAD_ON_NEW
  end
end # end of module DataManager

class Scene_Save
  alias glob_save_succ on_save_success
  def on_save_success
    LGlobalSave.save if LGlobalSave::SAVE_ON_SAVE
    glob_save_succ
  end
end

class Scene_Load
  alias glob_load_succ on_load_success
  def on_load_success
    LGlobalSave.load if LGlobalSave::LOAD_ON_LOAD
    glob_load_succ
  end
end
@mayvidbowie Anytime you find a link to a dead website, it's always a good idea to put the link in the wayback machine to see if it's been archived.

Global Save Script
It's actually a script by TheLeech.
Here's the original and the modded one by Theoallen making it compatible with other scripts.
Spoiler: Original
Ruby:
#==============================================================================
# # Global Save System [v1.0]
# # By theLEECH
#==============================================================================
# # Overwrites:
# # in module DataManager:
# # # self.load_game(index)
# # # self.save_game(index)
# # # self.setup_new_game
#==============================================================================
# ---INSTRUCTIONS---
# Put the numbers of the variables to save and the switches to save in the
# VARIABLES_TO_SAVE array, and the SWITCHES_TO_SAVE array.
# If you want to automatically load/update the globally saved data, set the
# SAVE_ON_SAVE LOAD_ON_LOAD and LOAD_ON_NEW flags to true accordingly.
#------------------------------------------------------------------------------
# You can load and save global data within an event, by using the script command
# and entering: "global_save" or "global_load" (Without qoutations)
#==============================================================================
#==============================================================================
# # LGlobalSave
#==============================================================================
$imported ||= {}
$imported[:lglobal_save] = 1.0

module LGlobalSave

  #==============================================================================
  # CONFIGURATION
  #==============================================================================
  # Whether or not the variables and switches in the global file should be
  # saved when the player saves the game
  SAVE_ON_SAVE = true
  # Whether or not the variables and switches in the global file should be
  # loaded when the player loads a save file
  LOAD_ON_LOAD = true
  # Whether or not the variables and switches in the global file should be
  # loaded when the player starts a new game
  LOAD_ON_NEW = true
  # An array that contains a list of variables to save in the global save file
  # Enter a list of variables, by number, seperated by commas.
  # You can use '..' to include all variables between two numbers
  # Example: 15..42
  # Will include all variables or switches between 15 and 42 (inclusive)
  # Leave blank to save none of that type
  VARIABLES_TO_SAVE = [25..30]
  # Same as above, but for switches
  SWITCHES_TO_SAVE = [25..27, 29, 101]
  # The name of the file to save global variables and switches in
  FILE_NAME = "Global.rvdata2"
  #==============================================================================
  # END OF CONFIGURATION
  #==============================================================================

  def self.saveTheFile(f)
    File.open(FILE_NAME, "wb") do |file|
      Marshal.dump(f, file)
    end
  end

  def self.loadTheFile
    if !File.exists?(LGlobalSave::FILE_NAME)
      f = makeNewFile
      return f
    else
      f = nil
      File.open(FILE_NAME, "rb") do |file|
        f = Marshal.load(file)
      end
      return f
    end
  end

  def self.makeNewFile
    return LGlobalSaveFile.new
  end

  def self.loadVariables(f)
    for i in VARIABLES_TO_SAVE
      $game_variables[i]= f.getVar(i)
    end
  end

  def self.loadSwitches(f)
    for i in SWITCHES_TO_SAVE
      $game_switches[i]= f.getSwitch(i)
    end
  end

  def self.saveVariables(f)
    for i in VARIABLES_TO_SAVE
      f.setVar(i, $game_variables[i])
    end
  end

  def self.saveSwitches(f)
    for i in SWITCHES_TO_SAVE
      f.setSwitch(i, $game_switches[i])
    end
  end

  def self.save
    f = makeNewFile
    saveVariables(f)
    saveSwitches(f)
    saveTheFile(f)
  end

  def self.load
    f = loadTheFile
    loadVariables(f)
    loadSwitches(f)
  end

end # end of module LGlobalSave

#==============================================================================
# ** LGlobalSaveFile
#------------------------------------------------------------------------------
# An object of this class is saved in the global.sav file
# It contains all the saved variables and switches
#==============================================================================
class LGlobalSaveFile

  def initialize # Initializes the object
    @var = []
    @switch = []
  end

  # @var holds the saved variables
  # set and get methods:
  def getVar(id)
    return @var[id]
  end
 
  def setVar(id, val)
    @var[id] = val
  end

  # @switch holds the saved switches
  # set and get methods:
  def getSwitch(id)
    return @switch[id]
  end
 
  def setSwitch(id, val)
    @switch[id] = val
  end

end # end of class LGlobalSaveFile

#==============================================================================
# These methods are for saving and loading the global save file from an event
#==============================================================================
def global_save
  LGlobalSave.save
end
def global_load
  LGlobalSave.load
end
#==============================================================================
# ** DataManager
#==============================================================================
module DataManager

  #--------------------------------------------------------------------------
  # overwrite method: self.setup_new_game
  #--------------------------------------------------------------------------
  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
    LGlobalSave.load if LGlobalSave::LOAD_ON_NEW
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.save_game(index)
  #--------------------------------------------------------------------------
  def self.save_game(index)
    begin
      save_game_without_rescue(index)
    rescue
      delete_save_file(index)
      false
    end
    LGlobalSave.save if LGlobalSave::SAVE_ON_SAVE
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.load_game(index)
  #--------------------------------------------------------------------------
  def self.load_game(index)
    load_game_without_rescue(index) rescue false
    LGlobalSave.load if LGlobalSave::LOAD_ON_LOAD
  end
end # end of module DataManager
Spoiler: Improved
Ruby:
#==============================================================================
# # Global Save System [v1.0b]
# # By theLEECH
# # Fixed by TheoAllen
#==============================================================================
# ---INSTRUCTIONS---
# Put the numbers of the variables to save and the switches to save in the
# VARIABLES_TO_SAVE array, and the SWITCHES_TO_SAVE array.
# If you want to automatically load/update the globally saved data, set the
# SAVE_ON_SAVE LOAD_ON_LOAD and LOAD_ON_NEW flags to true accordingly.
#------------------------------------------------------------------------------
# You can load and save global data within an event, by using the script command
# and entering: "global_save" or "global_load" (Without qoutations)
#==============================================================================
#==============================================================================
# # LGlobalSave
#==============================================================================
module LGlobalSave

#==============================================================================
# CONFIGURATION
#==============================================================================
# Whether or not the variables and switches in the global file should be
# saved when the player saves the game
  SAVE_ON_SAVE = false
# Whether or not the variables and switches in the global file should be
# loaded when the player loads a save file
  LOAD_ON_LOAD = false
# Whether or not the variables and switches in the global file should be
# loaded when the player starts a new game
  LOAD_ON_NEW = true
# An array that contains a list of variables to save in the global save file
# Enter a list of variables, by number, seperated by commas.
# You can use '..' to include all variables between two numbers
# Example: 15..42
# Will include all variables or switches between 15 and 42 (inclusive)
# Leave blank to save none of that type
  VARIABLES_TO_SAVE = [1]
# Same as above, but for switches
  SWITCHES_TO_SAVE = [1,13]
# The name of the file to save global variables and switches in
  FILE_NAME = "Global.rvdata2"
#==============================================================================
# END OF CONFIGURATION
#==============================================================================

  def self.saveTheFile(f)
    File.open(FILE_NAME, "wb") do |file|
      Marshal.dump(f, file)
    end
  end

  def self.loadTheFile
    if !File.exists?(LGlobalSave::FILE_NAME)
      f = makeNewFile
      return f
    else
      f = nil
      File.open(FILE_NAME, "rb") do |file|
        f = Marshal.load(file)
      end
      return f
    end
  end

  def self.makeNewFile
    return LGlobalSaveFile.new
  end

  def self.loadVariables(f)
    for i in VARIABLES_TO_SAVE
      $game_variables[i]= f.getVar(i)
    end
  end

  def self.loadSwitches(f)
    for i in SWITCHES_TO_SAVE
      $game_switches[i]= f.getSwitch(i)
    end
  end

  def self.saveVariables(f)
    for i in VARIABLES_TO_SAVE
      f.setVar(i, $game_variables[i])
    end
  end

  def self.saveSwitches(f)
    for i in SWITCHES_TO_SAVE
      f.setSwitch(i, $game_switches[i])
    end
  end

  def self.save
    f = makeNewFile
    saveVariables(f)
    saveSwitches(f)
    saveTheFile(f)
  end

  def self.load
    f = loadTheFile
    loadVariables(f)
    loadSwitches(f)
  end

end # end of module LGlobalSave

#==============================================================================
# ** LGlobalSaveFile
#------------------------------------------------------------------------------
# An object of this class is saved in the global.sav file
# It contains all the saved variables and switches
#==============================================================================
class LGlobalSaveFile

  def initialize # Initializes the object
    @var = []
    @switch = [1]
  end

# @var holds the saved variables
# set and get methods:
  def getVar(id)
    return @var[id]
  end
 
  def setVar(id, val)
    @var[id] = val
  end

# @switch holds the saved switches
# set and get methods:
  def getSwitch(id)
    return @switch[id]
  end
 
  def setSwitch(id, val)
    @switch[id] = val
  end

end # end of class LGlobalSaveFile

#==============================================================================
# These methods are for saving and loading the global save file from an event
#==============================================================================
def global_save
  LGlobalSave.save
end
def global_load
  LGlobalSave.load
end
#==============================================================================
# ** DataManager
#==============================================================================
module DataManager
  class << self
    alias glob_new_game setup_new_game
  end
  def self.setup_new_game
    glob_new_game
    LGlobalSave.load if LGlobalSave::LOAD_ON_NEW
  end
end # end of module DataManager

class Scene_Save
  alias glob_save_succ on_save_success
  def on_save_success
    LGlobalSave.save if LGlobalSave::SAVE_ON_SAVE
    glob_save_succ
  end
end

class Scene_Load
  alias glob_load_succ on_load_success
  def on_load_success
    LGlobalSave.load if LGlobalSave::LOAD_ON_LOAD
    glob_load_succ
  end
end

Oh thank you so much!!! Gonna test this ASAP!

@mayvidbowie Anytime you find a link to a dead website, it's always a good idea to put the link in the wayback machine to see if it's been archived.

Global Save Script

Ooo, thank you for the advice! I'll use this info next time I come into a link a to a dead site cause I encounter it a TON with rpg maker scripts ^_^

Original thread: https://forums.rpgmakerweb.com/threads/permanent-global-switches.178076/