Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.1
- ★ Awesome Autosave™ ★
- ================================================================================
- Script Information:
- ====================
- This script simply enables an autosave feature.
- Various options for when it saves. Also allows for more than 16 save files.
- If a new game is created it will automatically save into a new file.
- If you load a game it will save in the position of the file you loaded.
- If you save over a file at any time, the game will automatically save
- into that save file slot.
- NOTE: I HIGHLY Reccommend you to disable all other methods of saving possible.
- This *WILL* prevent the potential overwrite of valuable data .
- But you dont have to..
- ================================================================================
- ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- ================================================================================
- 1. You must give credit to "Dekita"
- 2. You are NOT allowed to repost this script.(or modified versions)
- 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
- 4. You are NOT allowed to use this script for Commercial games.
- 5. ENJOY!
- "FINE PRINT"
- By using this script you hereby agree to the above terms and conditions,
- if any violation of the above terms occurs "legal action" may be taken.
- Not understanding the above terms and conditions does NOT mean that
- they do not apply to you.
- If you wish to discuss the terms and conditions in further detail you can
- contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
- ================================================================================
- History:
- =========
- D /M /Y
- o8/o2/2o13 - update to save after X steps,
- 23/o1/2o13 - started && finished,
- ================================================================================
- Credit and Thanks to :
- =======================
- ================================================================================
- Known Bugs:
- ============
- N/A
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- If a new bug is found please contact me at
- http://dekitarpg.wordpress.com/
- ================================================================================
- INSTRUCTIONS:
- ==============
- Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
- ================================================================================
- Script Calls :
- ===============
- $game_system.save_after_transfer = bool
- $game_system.save_after_battle = bool
- $game_system.save_after_menu = bool
- $game_system.save_file_index = save file index
- replace bool with true / false
- only use the last script call if you REALLY need to change the save file index.
- =end #=========================================================================#
- module Awesome_Autosave
- Save_After_Transfer = true
- Save_After_Battle = false#true
- Save_After_Menu = false#true
- Save_After_Steps = [false, 50] # use ? steps before save
- Save_File_Limit = 50 # Default = 16
- end #####################
- # CUSTOMISATION END #
- #################################################################################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #################################################################################
- $imported = {} if $imported.nil?
- $imported[:Dekita_Autosave] = true
- #===============================================================================#
- module DataManager
- #===============================================================================#
- class << self
- alias :sng_as_DM :setup_new_game
- alias :lg_as_DM :load_game
- alias :sg_as_DM :save_game
- end
- def self.save_game(index)
- $game_system.save_file_index = index
- sg_as_DM(index)
- end
- def self.load_game(index)
- $game_system.save_file_index = index
- lg_as_DM(index)
- end
- def self.save_file_count
- cont = Dir.glob('Save*.rvdata2').size
- cont
- end
- def self.savefile_max
- Awesome_Autosave::Save_File_Limit
- end
- end
- #==============================================================================
- class Game_System
- #==============================================================================
- include Awesome_Autosave
- attr_accessor :save_file_index
- attr_accessor :save_after_transfer
- attr_accessor :save_after_battle
- attr_accessor :save_after_menu
- attr_reader :just_battled_flag
- alias :_GS_init_Autosave :initialize
- def initialize
- _GS_init_Autosave
- @save_file_index = 0
- @save_after_transfer = Save_After_Transfer
- @save_after_battle = Save_After_Battle
- @save_after_menu = Save_After_Menu
- @just_battled_flag = false
- end
- def just_battled
- @just_battled_flag = true
- end
- def saved_after_battle_AS
- @just_battled_flag = false
- end
- end
- #==============================================================================
- class Game_Party < Game_Unit
- #==============================================================================
- def on_battle_end
- $game_system.just_battled
- super
- end
- end
- #==============================================================================
- class Game_Player < Game_Character
- #==============================================================================
- alias :inc_step_n_init :initialize
- alias :inc_step_n_save :increase_steps
- attr_accessor :old_step_count
- attr_reader :steps_counter
- def initialize
- inc_step_n_init
- @steps_counter = 0
- @old_step_count = 0
- end
- def increase_steps
- inc_step_n_save
- @steps_counter += 1
- end
- def reset_steps_counter
- @steps_counter = 0
- end
- end
- #==============================================================================
- class Scene_Base
- #==============================================================================
- def auto_save
- index = $game_system.save_file_index
- DataManager.save_game(index)
- p "Saving on file " + index.to_s
- end
- end
- #==============================================================================
- class Scene_Map < Scene_Base
- #==============================================================================
- alias :def_start_AS_GM :start
- alias :pt_as_dekita :post_transfer
- def start
- def_start_AS_GM
- start_autosave
- end
- def perform_transition
- if Graphics.brightness == 0
- Graphics.transition(0)
- fadein(fadein_speed)
- else
- super
- end
- end
- def post_transfer
- pt_as_dekita
- auto_save if $game_system.save_after_transfer
- end
- def start_autosave
- return unless $game_system.save_after_battle
- return unless $game_system.just_battled_flag
- $game_system.saved_after_battle_AS
- auto_save
- end
- alias :updt_steps_save :update
- def update
- updt_steps_save
- if Awesome_Autosave::Save_After_Steps[0]
- if $game_player.steps_counter >= Awesome_Autosave::Save_After_Steps[1]
- $game_player.reset_steps_counter
- auto_save
- end
- end
- end
- end
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #==============================================================================
- def return_scene
- auto_save if $game_system.save_after_menu
- super
- end
- end
- #==============================================================================
- class Scene_Title < Scene_Base
- #==============================================================================
- alias :cng_AS_ST :command_new_game
- def command_new_game
- cng_AS_ST
- $game_system.save_file_index = DataManager.save_file_count
- end
- end
- #===============================================================================#
- # - SCRIPT END - #
- #===============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement