SHARE
TWEET

EST - DATA OBJECT SAVE

estriole Jan 7th, 2013 1,325 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =begin
  2. EST - DATA OBJECT SAVE
  3. v 1.0
  4.  
  5. Author : Estriole
  6. also credits : Tsukihime since i learn this custom database from his script
  7.  
  8. Version History
  9. v. 1.0 - 2013-01-07 - finish the script
  10.  
  11. Introduction
  12. if you have script that modify the $data object such as $data_actors,
  13. $data_weapons, etc (usually capture system, individual item script, etc)
  14.  
  15. you would like to save the changes you made in game (in case you have
  16. dynamic system)
  17.  
  18. this script save all the $data objects in save file. then load it when
  19. loading the data. so we can keep our changes.
  20.  
  21. =end
  22.  
  23. #module data manager to save all the changes to $data object
  24. #but be careful when changing thing directly to $data object
  25. module DataManager
  26.  
  27.   class << self
  28.     alias est_objects_save_make_save_contents make_save_contents
  29.     alias est_objects_save_extract_save_contents extract_save_contents
  30.   end
  31.    
  32.   def self.make_save_contents
  33.     contents = est_objects_save_make_save_contents
  34.     contents = contents.merge(make_object_save_contents)
  35.     contents
  36.   end
  37.  
  38.   def self.make_object_save_contents
  39.     contents = {}
  40.     contents[:data_actors]             =        $data_actors
  41.     contents[:data_classes]            =        $data_classes    
  42.     contents[:data_skills]             =        $data_skills
  43.     contents[:data_items]                =      $data_items
  44.     contents[:data_weapons]            =        $data_weapons
  45.     contents[:data_armors]             =        $data_armors
  46.     contents[:data_enemies]            =        $data_enemies    
  47.     contents[:data_troops]             =        $data_troops    
  48.     contents[:data_states]             =        $data_states
  49.     contents[:data_tilesets]         =  $data_tilesets
  50.     contents[:data_common_events]        =      $data_common_events
  51.     contents[:data_system]             =        $data_system
  52.     contents[:data_mapinfos]         =  $data_mapinfos
  53.     contents
  54.   end
  55.  
  56.   def self.extract_save_contents(contents)
  57.     est_objects_save_extract_save_contents (contents)
  58.     extract_objects_save_contents(contents)
  59.   end
  60.  
  61.   def self.extract_objects_save_contents(contents)
  62.     $data_actors             =    contents[:data_actors]             
  63.     $data_classes            =    contents[:data_classes]            
  64.     $data_skills             =    contents[:data_skills]             
  65.     $data_items              =    contents[:data_items]        
  66.     $data_weapons            =    contents[:data_weapons]            
  67.     $data_armors             =    contents[:data_armors]             
  68.     $data_enemies            =    contents[:data_enemies]            
  69.     $data_troops             =    contents[:data_troops]             
  70.     $data_states             =    contents[:data_states]             
  71.     $data_tilesets           =    contents[:data_tilesets]         
  72.     $data_common_events      =    contents[:data_common_events]
  73.     $data_system             =    contents[:data_system]             
  74.     $data_mapinfos           =    contents[:data_mapinfos]         
  75.   end
  76.  
  77. end
RAW Paste Data
Top