este script guarda todos los avanzes automaticamentem, solo crea una nueva clase encima de main y pega todo esto
#============================================================================== # autosave script 1.6 #-----------------------------------------------------------------------------# authors darklord, blue elf and me� # version 1.8 #-----------------------------------------------------------------------------# this script aliases(a)/rewrites(r) in the folowwing classes and methods: # # game_party -> gain_gold (a) , gain_item (a), gain_armor (a), gain_weapon (a) # game_system -> initialize (a) # scene_save -> initialize (r) , on_decision (r), on_cancel (r) # scene_cm -> main (a) # scene_load -> on_decision(a) #============================================================================== #============================================================================== # *** autosave #-----------------------------------------------------------------------------# this module handles the autosaving #============================================================================== module autosave #-------------------------------------------------------------------------# * saves file #-------------------------------------------------------------------------def self.save begin #saves the file to whatever $game_system.filename is file = file.open($game_system.filename, "wb") a = scene_save.new a.write_save_data(file) ensure file.close end end #-------------------------------------------------------------------------# * deletes file #-------------------------------------------------------------------------def self.deletesave begin if filetest.exits?($game_system.filename) file.delete($game_system.filename) end end end end #============================================================================== #============================================================================== # ** scene_save #-----------------------------------------------------------------------------# this class performs save screen processing. # note that scene_save no longer saves the game, it changes the autosave file
#============================================================================== class scene_save < scene_file #-------------------------------------------------------------------------# * object initialization #-------------------------------------------------------------------------def initialize super("which file would you like to autosave to?") end #-------------------------------------------------------------------------# * decision processing #-------------------------------------------------------------------------def on_decision(filename) # play save se $game_system.se_play($data_system.save_se) $game_system.filename_c(filename) $scene = scene_menu.new end end #============================================================================== # ** scene_load #-----------------------------------------------------------------------------# this class performs load screen processing. #============================================================================== class scene_load < scene_file alias old_doloadthingie on_decision #-------------------------------------------------------------------------# * decision processing #-------------------------------------------------------------------------def on_decision(filename) $game_system.filename_c(filename) old_doloadthingie(filename) end end #============================================================================== # ** game_system #-----------------------------------------------------------------------------# this class handles data surrounding the system. backround music, etc. # is managed here as well. refer to "$game_system" for the instance of # this class. #============================================================================== class game_system #-------------------------------------------------------------------------# * aliasing objects #-------------------------------------------------------------------------alias autosaveinit initialize #-------------------------------------------------------------------------# * initialize #-------------------------------------------------------------------------def initialize autosaveinit @filename = "save1.rxdata" end #-------------------------------------------------------------------------# * filename -> returns autosave filename
#-------------------------------------------------------------------------def filename if @filename != nil return @filename else return "save1.rxdata" end end #-------------------------------------------------------------------------# * filename_change -> sets new autosave filename #-------------------------------------------------------------------------def filename_c(newname) return if newname == "" or newname == nil @filename = newname end end #============================================================================== # ** game_party #-----------------------------------------------------------------------------# this class handles the party. it includes information on amount of gold # and items. refer to "$game_party" for the instance of this class. #============================================================================== class game_party alias gainglod_autosave gain_gold alias gainitem_autosave gain_item alias gainweap_autosave gain_weapon alias gainarmor_autosave gain_armor #-------------------------------------------------------------------------# * gain gold (or lose) # n : amount of gold #-------------------------------------------------------------------------def gain_gold(n) gainglod_autosave(n) autosave.save end #-------------------------------------------------------------------------# * gain items (or lose) # item_id : item id # n : quantity #-------------------------------------------------------------------------def gain_item(item_id, n) gainitem_autosave(item_id, n) autosave.save end #-------------------------------------------------------------------------# * gain weapons (or lose) # weapon_id : weapon id # n : quantity #-------------------------------------------------------------------------def gain_weapon(weapon_id, n) gainweap_autosave(weapon_id, n) autosave.save end #-------------------------------------------------------------------------# * gain armor (or lose) # armor_id : armor id
# n : quantity #-------------------------------------------------------------------------def gain_armor(armor_id, n) gainarmor_autosave(armor_id, n) autosave.save end end #============================================================================== # ** scene change map #-----------------------------------------------------------------------------# this scene pop-ups when teleporting. #============================================================================== class scene_cm alias autosavescript_changemap_main main #-------------------------------------------------------------------------# * main #-------------------------------------------------------------------------def main autosavescript_changemap_main autosave.save end end #==============================================================================