Advertisement
Vlue

Basic Autosave

Sep 26th, 2013
5,342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.09 KB | None | 0 0
  1. #Basic Autosave v1.1
  2. #----------#
  3. #Features: Autosaves to the first slot every time the map changes. Can't
  4. #           get any simpler then that!
  5. #          Comes with option to rename first slot to whatever you want.
  6. #
  7. #Usage:    Plug and play.
  8. #
  9. #----------#
  10. #-- Script by: V.M of D.T
  11. #
  12. #- Questions or comments can be:
  13. #    given by email: sumptuaryspade@live.ca
  14. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  15. #   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
  16. #
  17. #- Free to use in any project with credit given, donations always welcome!
  18.  
  19. #Sets whether to rename first file to denote Autosaveness and what to name it
  20. NAME_AUTOSAVE_FILE = true
  21. AUTOSAVE_FILE_NAME = "Autosave"
  22. AUTOSAVE_ON_MAP = true
  23. AUTOSAVE_AFTER_BATTLE = false
  24.  
  25. $auto_save = true
  26.  
  27. class Scene_Map
  28.   alias auto_post_transfer post_transfer
  29.   def post_transfer
  30.     auto_post_transfer
  31.     return unless AUTOSAVE_ON_MAP
  32.     if Module.const_defined?(:Game_Options)
  33.       DataManager.save_game(0) if $game_options.auto_save
  34.     else
  35.       DataManager.save_game(0) if $auto_save
  36.     end
  37.   end
  38. end
  39.  
  40. module BattleManager
  41.   def self.battle_end(result)
  42.     @phase = nil
  43.     @event_proc.call(result) if @event_proc
  44.     $game_party.on_battle_end
  45.     $game_troop.on_battle_end
  46.     SceneManager.exit if $BTEST
  47.     return unless AUTOSAVE_AFTER_BATTLE
  48.     if Module.const_defined?(:Game_Options)
  49.       DataManager.save_game(0) if $game_options.auto_save
  50.     else
  51.       DataManager.save_game(0) if $auto_save
  52.     end
  53.   end
  54. end
  55.  
  56. class Window_SaveFile
  57.   alias auto_refresh refresh
  58.   def refresh
  59.     if NAME_AUTOSAVE_FILE
  60.       contents.clear
  61.       change_color(normal_color)
  62.       if @file_index == 0
  63.         name = AUTOSAVE_FILE_NAME
  64.       else
  65.         name = Vocab::File + " #{@file_index}"
  66.       end
  67.       draw_text(4, 0, 200, line_height, name)
  68.       @name_width = text_size(name).width
  69.       draw_party_characters(152, 58)
  70.       draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
  71.     else
  72.       auto_refresh
  73.     end
  74.   end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement