adiktuzmiko

Quick Save/Load System 1.01

May 27th, 2016
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.71 KB | None | 0 0
  1. =begin
  2. ====================================================================
  3.   GENERAL INFORMATION
  4. --------------------------------------------------------------------
  5.   Title: Quick Save/Load System
  6.   Author: Adiktuzmiko
  7.   Version: 1.01
  8.   Requirements: None
  9.  
  10.   This script allows you to set a button in the game for quick save and load.
  11.   If you press the quicksave button, the game will automatically save
  12.   your progress in the designated slot without going thru the save screen.
  13.   The same goes for quickload.
  14.  
  15. ====================================================================
  16.  
  17. ====================================================================
  18.   FEATURES
  19. --------------------------------------------------------------------
  20.  
  21.   Quick Save/Load Anytime
  22.   - Save/Load your progress with the press of a button
  23.  
  24.   Customizable
  25.   - Modify which file index is used as the quick slot
  26.   - Modify which buttons
  27.   - Determine if quick system is usable in battle and during show text
  28.     event commands
  29.  
  30. ====================================================================
  31.  
  32. ====================================================================
  33.   INSTRUCTIONS
  34. --------------------------------------------------------------------
  35.  
  36.   After importing this script to your project, go to the config part
  37.   below (after TERMS AND CONDITIONS) and edit to suit your needs.
  38.  
  39. ====================================================================
  40.  
  41. ====================================================================
  42.   TERMS AND CONDITIONS
  43. --------------------------------------------------------------------
  44.  
  45.   View it here: http://lescripts.wordpress.com/terms-and-conditions/
  46.  
  47. ====================================================================
  48.  
  49. =end
  50.  
  51. module ADIK
  52.   module QUICK
  53.    
  54.     #Is the system enabled?
  55.     ENABLED = true
  56.    
  57.     #Save file index to be used by Quick save/load
  58.     #Note that by default the first file is index 0
  59.     INDEX = 2
  60.    
  61.     #SaveLoad Keybindings
  62.     #Default are L and R keys (Q/W at the keyboard by default)
  63.     SAVE_KEY = :L
  64.     LOAD_KEY = :L
  65.    
  66.     #Set these if you want to use a button "combo" to activate the system
  67.     #Example if SAVE_KEY is set as :L and SAVE_KEY_2 is set as :A
  68.     #then you need to press both to activate the quick save
  69.     SAVE_KEY_2 = nil
  70.     LOAD_KEY_2 = :A
  71.    
  72.     #Is the system allowed in battle scene?
  73.     #I suggest keeping this as false
  74.     ALLOW_AT_BATTLE = false
  75.    
  76.     #Is the system allowed during the Show Text event command?
  77.     ALLOW_AT_TEXT = true
  78.    
  79.   end
  80. end
  81.  
  82. # DO NOT EDIT BELOW THIS LINE
  83.  
  84. if ADIK::QUICK::ENABLED
  85.  
  86.   class Scene_Base
  87.    
  88.     def quicksave
  89.       if DataManager.save_game(ADIK::QUICK::INDEX)
  90.         Sound.play_save
  91.       else
  92.         Sound.play_buzzer
  93.       end
  94.     end
  95.    
  96.     def quickload
  97.       if DataManager.load_game(ADIK::QUICK::INDEX)
  98.         Sound.play_load
  99.         fadeout_all
  100.         $game_system.on_after_load
  101.         SceneManager.goto(Scene_Map)
  102.       else
  103.         Sound.play_buzzer
  104.       end
  105.     end
  106.    
  107.     def is_quicksave
  108.       if ADIK::QUICK::SAVE_KEY_2 != nil
  109.         return (Input.trigger?(ADIK::QUICK::SAVE_KEY) and Input.press?(ADIK::QUICK::SAVE_KEY_2))
  110.       else
  111.         if ADIK::QUICK::LOAD_KEY_2 != nil
  112.           return false if Input.press?(ADIK::QUICK::LOAD_KEY_2)
  113.         end
  114.         return Input.trigger?(ADIK::QUICK::SAVE_KEY)
  115.       end
  116.     end
  117.    
  118.     def is_quickload
  119.       if ADIK::QUICK::LOAD_KEY_2 != nil
  120.         return (Input.trigger?(ADIK::QUICK::LOAD_KEY) and Input.press?(ADIK::QUICK::LOAD_KEY_2))
  121.       else
  122.         if ADIK::QUICK::SAVE_KEY_2 != nil
  123.           return false if Input.press?(ADIK::QUICK::SAVE_KEY_2)
  124.         end
  125.         return Input.trigger?(ADIK::QUICK::LOAD_KEY)
  126.       end
  127.     end
  128.  
  129.    
  130.     def quicksystem
  131.       if is_quicksave and not SceneManager.scene_is?(Scene_Save)
  132.         if SceneManager.scene_is?(Scene_Battle) then
  133.           if ADIK::QUICK::ALLOW_AT_BATTLE
  134.             quicksave
  135.           end
  136.         else
  137.           quicksave
  138.         end
  139.         return
  140.       end
  141.       if is_quickload and not SceneManager.scene_is?(Scene_Load)
  142.         if SceneManager.scene_is?(Scene_Battle) then
  143.           if ADIK::QUICK::ALLOW_AT_BATTLE
  144.             quickload
  145.           end
  146.         else
  147.           quickload
  148.         end
  149.         return
  150.       end
  151.     end
  152.    
  153.     alias update_quicksystem update
  154.     def update
  155.       update_quicksystem
  156.       quicksystem
  157.     end
  158.    
  159.   end
  160.  
  161.   class Game_Interpreter
  162.  
  163.     def wait_for_message
  164.       while $game_message.busy?
  165.         SceneManager.scene.quicksystem if ADIK::QUICK::ALLOW_AT_TEXT
  166.         Fiber.yield  
  167.       end
  168.     end
  169.      
  170.   end
  171.  
  172. end
Advertisement
Add Comment
Please, Sign In to add comment