Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- - Quick Save/Load Feature v1.0
- - Made by: Sixth
- - Description:
- Just a basic quick save/load function for your game.
- Can enable/disable this feature during the game with a switch.
- Can setup the keys used for quick save/load.
- - Script calls:
- To manually save/load the game with the new methods, use these script calls:
- DataManager.quick_save
- DataManager.quick_load
- - Installation:
- Place it between Materials and Main!
- - Terms of use:
- Credit me (Sixth) in your game, pretty please! :P
- =end
- module QSaveLoad
- # Settings:
- Data = {
- :index => 0, # File index for quick save (0 = 1st slot, 1 = 2nd, etc)
- :disable => 0, # Disable switch ID (0 = always enabled)
- :save => :F7, # Key for quick save (nil = disabled)
- :load => :F8, # Key for quick load (nil = disabled)
- }
- end
- # No setting here anymore, touchy-touchy disabled! o.o
- module DataManager
- def self.quick_save
- begin
- quick_save_game_without_rescue
- rescue
- File.delete(make_filename(QSaveLoad::Data[:index])) rescue nil
- false
- end
- end
- def self.quick_load(reload_map = true)
- v = quick_load_game_without_rescue rescue false
- if v == true && reload_map
- SceneManager.scene.fadeout_all
- $game_system.on_after_load
- SceneManager.goto(Scene_Map)
- end
- return v
- end
- def self.quick_save_game_without_rescue
- File.open(make_filename(QSaveLoad::Data[:index]), "wb") do |file|
- $game_system.on_before_save
- Marshal.dump(make_save_header, file)
- Marshal.dump(make_save_contents, file)
- @last_savefile_index = 0
- end
- return true
- end
- def self.quick_load_game_without_rescue
- File.open(make_filename(QSaveLoad::Data[:index]), "rb") do |file|
- Marshal.load(file)
- extract_save_contents(Marshal.load(file))
- reload_map_if_updated
- @last_savefile_index = 0
- end
- return true
- end
- end
- class Scene_Map < Scene_Base
- alias add_q_saveload8826 update
- def update
- add_q_saveload8826
- upd_qsaveload unless $game_switches[QSaveLoad::Data[:disable]]
- end
- def upd_qsaveload
- if Input.trigger?(QSaveLoad::Data[:save])
- DataManager.quick_save
- elsif Input.trigger?(QSaveLoad::Data[:load])
- DataManager.quick_load
- end
- end
- end
- # End of script.
Add Comment
Please, Sign In to add comment