Guest User

Untitled

a guest
Apr 22nd, 2011
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.06 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - Single Save
  4. # Last Date Updated: 2010.05.17
  5. # Level: Easy
  6. #
  7. # Some games benefit more by having one save instead of multiple. This script
  8. # makes it so that saving will save to only one slot and loading will only
  9. # load from one slot.
  10. #===============================================================================
  11. # Instructions
  12. # -----------------------------------------------------------------------------
  13. # To install this script, open up your script editor and copy/paste this script
  14. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  15. #
  16. # Note: Using the call save menu event from the event editor will automatically
  17. # save, and not bring up the save menu.
  18. #===============================================================================
  19.  
  20. $imported = {} if $imported == nil
  21. $imported["SingleSave"] = true
  22.  
  23. #==============================================================================
  24. # ** Scene_File
  25. #==============================================================================
  26.  
  27. class Scene_File < Scene_Base
  28.   #--------------------------------------------------------------------------
  29.   # * Start processing
  30.   #--------------------------------------------------------------------------
  31.   def start
  32.     super
  33.     if @saving
  34.       do_save
  35.     else
  36.       do_load
  37.     end
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # * Execute Transition
  41.   #--------------------------------------------------------------------------
  42.   def perform_transition
  43.     unless @saving
  44.       Graphics.transition(10)
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # * Termination Processing
  49.   #--------------------------------------------------------------------------
  50.   def terminate
  51.     super
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # * Frame Update
  55.   #--------------------------------------------------------------------------
  56.   def update
  57.     super
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # * Execute Save
  61.   #--------------------------------------------------------------------------
  62.   def do_save
  63.     file = File.open(make_filename(0), "wb")
  64.     write_save_data(file)
  65.     file.close
  66.     return_scene
  67.     Sound.play_save
  68.    
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # * Execute Load
  72.   #--------------------------------------------------------------------------
  73.   def do_load
  74.     file = File.open(make_filename(0), "rb")
  75.     read_save_data(file)
  76.     file.close
  77.     $scene = Scene_Map.new
  78.     RPG::BGM.fade(1500)
  79.     Graphics.fadeout(20)
  80.     Graphics.wait(20)
  81.     @last_bgm.play
  82.     @last_bgs.play
  83.   end
  84. end
  85.  
  86. #===============================================================================
  87. #
  88. # END OF FILE
  89. #
  90. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment