Advertisement
diamondandplatinum3

Save / Load Option ~ RGSS2

Jul 22nd, 2012
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.02 KB | None | 0 0
  1. #-----=====-----=====-----=====-----=====-----=====-----=====-----=====-----====
  2. #           Save or Load?
  3. #           Author: DP3
  4. #           Update: HungrySnake
  5. #-----=====-----=====-----=====-----=====-----=====-----=====-----=====-----====
  6. #   Description:
  7. #      
  8. #       This script will allow you to both save and load in-game.
  9. #       No longer will you have to return to the title screen to
  10. #       load up another save file.
  11. #
  12. #       Update: Made compatible with most of the other saving systems
  13. #-----=====-----=====-----=====-----=====-----=====-----=====-----=====-----====
  14. #   Instructions:
  15. #
  16. #     - This script is plug and play, all you have to do is go into
  17. #       your database and change the vocab for save to something like
  18. #       "Save/Load"
  19. #
  20. #
  21. #     - Paste this script BELOW any other script which modifies the save system
  22. #         (ie. Neo Save System or anything else)
  23. #
  24. #
  25. #     - The script will give a command prompt when the save/load option
  26. #       on the menu is selected.
  27. #
  28. #-----=====-----=====-----=====-----=====-----=====-----=====-----=====-----====
  29.  
  30. #==============================================================================
  31. # ** Scene_File
  32. #------------------------------------------------------------------------------
  33. #  This class performs the save and load screen processing.
  34. #==============================================================================
  35.  
  36. class Scene_SaveLoad < Scene_Base
  37.   def start
  38.     super
  39.     create_menu_background
  40.     create_command_window
  41.   end
  42.  
  43.   def update
  44.     super
  45.     update_menu_background
  46.     update_command_window
  47.   end
  48.  
  49.   def terminate
  50.     super
  51.     dispose_menu_background
  52.     dispose_command_window
  53.   end
  54.  
  55.   def create_command_window
  56.     s1 = "Save"
  57.     s2 = "Load"
  58.     @command_window           = Window_Command.new(142, [s1, s2])
  59.     @command_window.x         = (544 - @command_window.width) * 0.5
  60.     @command_window.y         = (414 - @command_window.height) * 0.5
  61.   end
  62.  
  63.   def update_command_window
  64.   @command_window.update
  65.   if Input.trigger?(Input::B)
  66.     Sound.play_cancel
  67.     $scene = Scene_Menu.new(4)
  68.   elsif Input.trigger?(Input::C)
  69.     case @command_window.index
  70.       when 0
  71.         Sound.play_decision
  72.         $scene = Scene_File.new(true,false,false,false)
  73.       when 1
  74.         Sound.play_decision
  75.         $scene = Scene_File.new(false,false,false,false)
  76.       end
  77.     end
  78.   end
  79.  
  80.   def dispose_command_window
  81.     @command_window.dispose
  82.   end
  83. end
  84.    
  85. class Scene_File < Scene_Base
  86.   #--------------------------------------------------------------------------
  87.   # * Object Initialization
  88.   #     saving     : save flag (if false, load screen)
  89.   #     from_title : flag: it was called from "Continue" on the title screen
  90.   #     from_event : flag: it was called from the "Call Save Screen" event
  91.   #--------------------------------------------------------------------------
  92.   alias dp3_saveload_initialize initialize
  93.   def initialize(saving, from_title, from_event,pre_saveload=true)
  94.     @pre_saveload = pre_saveload
  95.     dp3_saveload_initialize(saving, from_title, from_event)
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # * Start processing
  99.   #--------------------------------------------------------------------------
  100.   alias dp3_saveload_start start
  101.   def start
  102.     if !@pre_saveload
  103.       dp3_saveload_start
  104.     else
  105.       $scene = Scene_SaveLoad.new
  106.     end
  107.   end
  108.  
  109.   #--------------------------------------------------------------------------
  110.   # * Termination Processing
  111.   #--------------------------------------------------------------------------
  112.   alias dp3_saveload_terminate terminate
  113.   def terminate
  114.     dp3_saveload_terminate if !@pre_saveload
  115.   end
  116.  
  117.   #--------------------------------------------------------------------------
  118.   # * Frame Update
  119.   #--------------------------------------------------------------------------
  120.   alias dp3_saveload_update update
  121.   def update    
  122.     dp3_saveload_update if !@pre_saveload
  123.   end
  124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement