khanhdu

DT's Autosave

Jul 29th, 2017
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.24 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # DT's Autosave
  4. # Author: DoctorTodd
  5. # Date (06/22/2012)
  6. # Version: (1.0.0) (VXA)
  7. # Level: (Simple)
  8. #
  9. #===============================================================================
  10. #
  11. # NOTES: 1)This script will only work with ace.
  12. #
  13. #===============================================================================
  14. #
  15. # Description: Saves the game when transferring the map, before battle,
  16. # and opening the menu (all optional).
  17. #
  18. # Credits: Me (DoctorTodd)
  19. #
  20. #===============================================================================
  21. #
  22. # Instructions
  23. # Paste above main.
  24. # Call using Autosave.call
  25. #
  26. #===============================================================================
  27. #
  28. # Free for any use as long as I'm credited.
  29. #
  30. #===============================================================================
  31. #
  32. # Editing begins 37 and ends on 50.
  33. #
  34. #===============================================================================
  35. module ToddAutoSaveAce
  36.  
  37.       #Max files (without autosave).
  38.       MAXFILES = 16
  39.  
  40.       #Autosave file name.
  41.       AUTOSAVEFILENAME = "Autosave"
  42.  
  43.       #Autosave before battle?
  44.       AUTOSAVEBB =  true
  45.  
  46.       #Autosave when menu opened?
  47.       AUTOSAVEM =  true
  48.  
  49.       #Autosave when changing map?
  50.       AUTOSAVETM =  true
  51.     end
  52. #==============================================================================
  53. # ** Autosave
  54. #------------------------------------------------------------------------------
  55. # This module contains the autosave method. This is allows you to use the
  56. # "Autosave.call" command.
  57. #==============================================================================
  58.  
  59. module Autosave
  60.   #--------------------------------------------------------------------------
  61.   # * Call method
  62.   #--------------------------------------------------------------------------
  63.   def self.call
  64.   DataManager.save_game_without_rescue(0)
  65. end
  66. end
  67. #==============================================================================
  68. # ** DataManager
  69. #------------------------------------------------------------------------------
  70. #  This module manages the database and game objects. Almost all of the
  71. # global variables used by the game are initialized by this module.
  72. #==============================================================================
  73.  
  74. module DataManager
  75.   #--------------------------------------------------------------------------
  76.   # * Maximum Number of Save Files
  77.   #--------------------------------------------------------------------------
  78.   def self.savefile_max
  79.     return ToddAutoSaveAce::MAXFILES + 1
  80.   end  
  81. end
  82. #==============================================================================
  83. # ** Scene_Map
  84. #------------------------------------------------------------------------------
  85. #  This class performs the map screen processing.
  86. #==============================================================================
  87.  
  88. class Scene_Map < Scene_Base
  89.   #--------------------------------------------------------------------------
  90.   # * Preprocessing for Battle Screen Transition
  91.   #--------------------------------------------------------------------------
  92.   def pre_battle_scene
  93.     Graphics.update
  94.     Graphics.freeze
  95.     @spriteset.dispose_characters
  96.     BattleManager.save_bgm_and_bgs
  97.     BattleManager.play_battle_bgm
  98.     Sound.play_battle_start
  99.   Autosave.call if ToddAutoSaveAce::AUTOSAVEBB
  100. end
  101.   #--------------------------------------------------------------------------
  102.   # * Call Menu Screen
  103.   #--------------------------------------------------------------------------
  104.   def call_menu
  105.     Sound.play_ok
  106.     SceneManager.call(Scene_Menu)
  107.     Window_MenuCommand::init_command_position
  108.   Autosave.call if ToddAutoSaveAce::AUTOSAVEM
  109. end
  110.   #--------------------------------------------------------------------------
  111.   # * Post Processing for Transferring Player
  112.   #--------------------------------------------------------------------------
  113.   def post_transfer
  114.     case $game_temp.fade_type
  115.     when 0
  116.       Graphics.wait(fadein_speed / 2)
  117.       fadein(fadein_speed)
  118.     when 1
  119.       Graphics.wait(fadein_speed / 2)
  120.       white_fadein(fadein_speed)
  121.     end
  122.     @map_name_window.open
  123.   Autosave.call if ToddAutoSaveAce::AUTOSAVETM
  124. end
  125. end
Advertisement
Add Comment
Please, Sign In to add comment