Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
violentpurge09

save system

Recommended Posts

I need the save sctipt changed so it autosaves to the first slot when called and the number of slots reduced to 1.

and the save option removed from the menu. (I can post the needed custom scripts im using on Warlock: Lorekeeper.)

Share this post


Link to post
Share on other sites

Try this

 

#-------------------------
# ** Auto Save Module
#-------------------------
# written by kellessdee
#-------------------------
=begin
 A simple auto-save script.
 To call just use call script and type in
 Autosave.trigger
=end
module Autosave
 #-----------------------
 # * Trigger Auto Save
 #-----------------------
 def self.trigger
   # Open File
   file = File.open('Save.rvdata', 'wb')
   # Write to file
   characters = []
   $game_party.members.each {|actor| 
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
   # Close File
   file.close
 end
end
#-------------------
# ** Modified Menu
#-------------------
class Scene_Menu < Scene_Base
 #-------------------------
 # * Create Command Window
 #-------------------------
 def create_command_window
   commands = [Vocab::item,
               Vocab::skill,
               Vocab::equip,
               Vocab::status,
               Vocab::game_end]
   @command_window = Window_Command.new(160, commands)
   @command_window.index = @menu_index
 end
 #--------------------------------------------------------------------------
 # * Update Command Selection
 #--------------------------------------------------------------------------
 def update_command_selection
   if Input.trigger?(Input::B)
     Sound.play_cancel
     $scene = Scene_Map.new
   elsif Input.trigger?(Input::C)
     if $game_party.members.size == 0 && @command_window.index < 4
       Sound.play_buzzer
       return
     end
     Sound.play_decision
     case @command_window.index
     when 0      # Item
       $scene = Scene_Item.new
     when 1,2,3  # Skill, equipment, status
       start_actor_selection
     when 4      # End Game
       $scene = Scene_End.new
     end
   end
 end
end
#------------------
# ** Modified File
#------------------
class Scene_File < Scene_Base
 #--------------------------------------------------------------------------
 # * Start processing
 #--------------------------------------------------------------------------
 def start
   super
   create_menu_background
   @help_window = Window_Help.new
   # Create 1 save file
   @savefile_windows = Window_SaveFile.new(0, 'Save.rvdata')
   @item_max = 1
   @savefile_windows.selected = true
 end
 #--------------------------------------------------------------------------
 # * Termination Processing
 #--------------------------------------------------------------------------
 def terminate
   super
   dispose_menu_background
   @help_window.dispose
   dispose_item_windows
 end
 #--------------------------------------------------------------------------
 # * Return to Original Screen
 #--------------------------------------------------------------------------
 def return_scene
   if @from_title
     $scene = Scene_Title.new
   else
     $scene = Scene_Map.new
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   update_menu_background
   @help_window.update
   @savefile_windows.update
   update_savefile_selection
 end
 #--------------------------------------------------------------------------
 # * Update Save File Selection
 #--------------------------------------------------------------------------
 def update_savefile_selection
   if Input.trigger?(Input::C)
     determine_savefile
   elsif Input.trigger?(Input::B)
     Sound.play_cancel
     return_scene
   end
 end
 #--------------------------------------------------------------------------
 # * Confirm Save File
 #--------------------------------------------------------------------------
 def determine_savefile
   if @saving
     Sound.play_save
     do_save
   else
     if @savefile_windows.file_exist
       Sound.play_load
       do_load
     else
       Sound.play_buzzer
       return
     end
   end
   $game_temp.last_file_index = @index
 end
 #--------------------------------------------------------------------------
 # * Execute Save
 #--------------------------------------------------------------------------
 def do_save
   file = File.open(@savefile_windows[@index].filename, "wb")
   write_save_data(file)
   file.close
   return_scene
 end
 #--------------------------------------------------------------------------
 # * Execute Load
 #--------------------------------------------------------------------------
 def do_load
   file = File.open(@savefile_windows[@index].filename, "rb")
   read_save_data(file)
   file.close
   $scene = Scene_Map.new
   RPG::BGM.fade(1500)
   Graphics.fadeout(60)
   Graphics.wait(40)
   @last_bgm.play
   @last_bgs.play
 end
 #--------------------------------------------------------------------------
 # * Write Save Data
 #     file : write file object (opened)
 #--------------------------------------------------------------------------
 def write_save_data(file)
   characters = []
   $game_party.members.each {|actor|
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
 end
 #--------------------------------------------------------------------------
 # * Read Save Data
 #     file : file object for reading (opened)
 #--------------------------------------------------------------------------
 def read_save_data(file)
   characters           = Marshal.load(file)
   Graphics.frame_count = Marshal.load(file)
   @last_bgm            = Marshal.load(file)
   @last_bgs            = Marshal.load(file)
   $game_system         = Marshal.load(file)
   $game_message        = Marshal.load(file)
   $game_switches       = Marshal.load(file)
   $game_variables      = Marshal.load(file)
   $game_self_switches  = Marshal.load(file)
   $game_actors         = Marshal.load(file)
   $game_party          = Marshal.load(file)
   $game_troop          = Marshal.load(file)
   $game_map            = Marshal.load(file)
   $game_player         = Marshal.load(file)
   if $game_system.version_id != $data_system.version_id
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
 end
end

 

 

To use just call

Autosave.trigger

 

I also modified the menu system to not display the save option and loading will only draw one window.

If you are using a custom menu system this probably will not work (the menu part). If you need me to make it save at specific times or want me to make the load screen fill the screen & display more info, let me know.

 

Also let me know if it doesn't work

Edited by kellessdee

Share this post


Link to post
Share on other sites

Try this

 

#-------------------------
# ** Auto Save Module
#-------------------------
# written by kellessdee
#-------------------------
=begin
 A simple auto-save script.
 To call just use call script and type in
 Autosave.trigger
=end
module Autosave
 #-----------------------
 # * Trigger Auto Save
 #-----------------------
 def self.trigger
   # Open File
   file = File.open('Save.rvdata', 'wb')
   # Write to file
   characters = []
   $game_party.members.each {|actor| 
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
   # Close File
   file.close
 end
end
#-------------------
# ** Modified Menu
#-------------------
class Scene_Menu < Scene_Base
 #-------------------------
 # * Create Command Window
 #-------------------------
 def create_command_window
   commands = [Vocab::item,
               Vocab::skill,
               Vocab::equip,
               Vocab::status,
               Vocab::game_end]
   @command_window = Window_Command.new(160, commands)
   @command_window.index = @menu_index
 end
 #--------------------------------------------------------------------------
 # * Update Command Selection
 #--------------------------------------------------------------------------
 def update_command_selection
   if Input.trigger?(Input::B)
     Sound.play_cancel
     $scene = Scene_Map.new
   elsif Input.trigger?(Input::C)
     if $game_party.members.size == 0 && @command_window.index < 4
       Sound.play_buzzer
       return
     end
     Sound.play_decision
     case @command_window.index
     when 0      # Item
       $scene = Scene_Item.new
     when 1,2,3  # Skill, equipment, status
       start_actor_selection
     when 4      # End Game
       $scene = Scene_End.new
     end
   end
 end
end
#------------------
# ** Modified File
#------------------
class Scene_File < Scene_Base
 #--------------------------------------------------------------------------
 # * Start processing
 #--------------------------------------------------------------------------
 def start
   super
   create_menu_background
   @help_window = Window_Help.new
   # Create 1 save file
   @savefile_windows = Window_SaveFile.new(0, 'Save.rvdata')
   @item_max = 1
   @savefile_windows.selected = true
 end
 #--------------------------------------------------------------------------
 # * Termination Processing
 #--------------------------------------------------------------------------
 def terminate
   super
   dispose_menu_background
   @help_window.dispose
   dispose_item_windows
 end
 #--------------------------------------------------------------------------
 # * Return to Original Screen
 #--------------------------------------------------------------------------
 def return_scene
   if @from_title
     $scene = Scene_Title.new
   else
     $scene = Scene_Map.new
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   update_menu_background
   @help_window.update
   @savefile_windows.update
   update_savefile_selection
 end
 #--------------------------------------------------------------------------
 # * Update Save File Selection
 #--------------------------------------------------------------------------
 def update_savefile_selection
   if Input.trigger?(Input::C)
     determine_savefile
   elsif Input.trigger?(Input::B)
     Sound.play_cancel
     return_scene
   end
 end
 #--------------------------------------------------------------------------
 # * Confirm Save File
 #--------------------------------------------------------------------------
 def determine_savefile
   if @saving
     Sound.play_save
     do_save
   else
     if @savefile_windows.file_exist
       Sound.play_load
       do_load
     else
       Sound.play_buzzer
       return
     end
   end
   $game_temp.last_file_index = @index
 end
 #--------------------------------------------------------------------------
 # * Execute Save
 #--------------------------------------------------------------------------
 def do_save
   file = File.open(@savefile_windows[@index].filename, "wb")
   write_save_data(file)
   file.close
   return_scene
 end
 #--------------------------------------------------------------------------
 # * Execute Load
 #--------------------------------------------------------------------------
 def do_load
   file = File.open(@savefile_windows[@index].filename, "rb")
   read_save_data(file)
   file.close
   $scene = Scene_Map.new
   RPG::BGM.fade(1500)
   Graphics.fadeout(60)
   Graphics.wait(40)
   @last_bgm.play
   @last_bgs.play
 end
 #--------------------------------------------------------------------------
 # * Write Save Data
 #     file : write file object (opened)
 #--------------------------------------------------------------------------
 def write_save_data(file)
   characters = []
   $game_party.members.each {|actor|
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
 end
 #--------------------------------------------------------------------------
 # * Read Save Data
 #     file : file object for reading (opened)
 #--------------------------------------------------------------------------
 def read_save_data(file)
   characters           = Marshal.load(file)
   Graphics.frame_count = Marshal.load(file)
   @last_bgm            = Marshal.load(file)
   @last_bgs            = Marshal.load(file)
   $game_system         = Marshal.load(file)
   $game_message        = Marshal.load(file)
   $game_switches       = Marshal.load(file)
   $game_variables      = Marshal.load(file)
   $game_self_switches  = Marshal.load(file)
   $game_actors         = Marshal.load(file)
   $game_party          = Marshal.load(file)
   $game_troop          = Marshal.load(file)
   $game_map            = Marshal.load(file)
   $game_player         = Marshal.load(file)
   if $game_system.version_id != $data_system.version_id
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
 end
end

 

 

To use just call

Autosave.trigger

 

I also modified the menu system to not display the save option and loading will only draw one window.

If you are using a custom menu system this probably will not work (the menu part). If you need me to make it save at specific times or want me to make the load screen fill the screen & display more info, let me know.

 

Also let me know if it doesn't work

 

error line 172

   file = File.open(@savefile_windows[@index].filename, "rb")

Share this post


Link to post
Share on other sites

whoops missed a couple of spots XD

 

#-------------------------
# ** Auto Save Module
#-------------------------
# written by kellessdee
#-------------------------
=begin
 A simple auto-save script.
 To call just use call script and type in
 Autosave.trigger
=end
module Autosave
 #-----------------------
 # * Trigger Auto Save
 #-----------------------
 def self.trigger
   # Open File
   file = File.open('Save.rvdata', 'wb')
   # Write to file
   characters = []
   $game_party.members.each {|actor| 
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
   # Close File
   file.close
 end
end
#-------------------
# ** Modified Menu
#-------------------
class Scene_Menu < Scene_Base
 #-------------------------
 # * Create Command Window
 #-------------------------
 def create_command_window
   commands = [Vocab::item,
               Vocab::skill,
               Vocab::equip,
               Vocab::status,
               Vocab::game_end]
   @command_window = Window_Command.new(160, commands)
   @command_window.index = @menu_index
 end
 #--------------------------------------------------------------------------
 # * Update Command Selection
 #--------------------------------------------------------------------------
 def update_command_selection
   if Input.trigger?(Input::B)
     Sound.play_cancel
     $scene = Scene_Map.new
   elsif Input.trigger?(Input::C)
     if $game_party.members.size == 0 && @command_window.index < 4
       Sound.play_buzzer
       return
     end
     Sound.play_decision
     case @command_window.index
     when 0      # Item
       $scene = Scene_Item.new
     when 1,2,3  # Skill, equipment, status
       start_actor_selection
     when 4      # End Game
       $scene = Scene_End.new
     end
   end
 end
end
#------------------
# ** Modified File
#------------------
class Scene_File < Scene_Base
 #--------------------------------------------------------------------------
 # * Start processing
 #--------------------------------------------------------------------------
 def start
   super
   create_menu_background
   @help_window = Window_Help.new
   # Create 1 save file
   @savefile_windows = Window_SaveFile.new(0, 'Save.rvdata')
   @item_max = 1
   @savefile_windows.selected = true
 end
 #--------------------------------------------------------------------------
 # * Termination Processing
 #--------------------------------------------------------------------------
 def terminate
   super
   dispose_menu_background
   @help_window.dispose
   dispose_item_windows
 end
 #--------------------------------------------------------------------------
 # * Return to Original Screen
 #--------------------------------------------------------------------------
 def return_scene
   if @from_title
     $scene = Scene_Title.new
   else
     $scene = Scene_Map.new
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   update_menu_background
   @help_window.update
   @savefile_windows.update
   update_savefile_selection
 end
 #--------------------------------------------------------------------------
 # * Update Save File Selection
 #--------------------------------------------------------------------------
 def update_savefile_selection
   if Input.trigger?(Input::C)
     determine_savefile
   elsif Input.trigger?(Input::B)
     Sound.play_cancel
     return_scene
   end
 end
 #--------------------------------------------------------------------------
 # * Confirm Save File
 #--------------------------------------------------------------------------
 def determine_savefile
   if @saving
     Sound.play_save
     do_save
   else
     if @savefile_windows.file_exist
       Sound.play_load
       do_load
     else
       Sound.play_buzzer
       return
     end
   end
   $game_temp.last_file_index = @index
 end
 #--------------------------------------------------------------------------
 # * Execute Save
 #--------------------------------------------------------------------------
 def do_save
   file = File.open('Save.rvdata', 'wb')
   write_save_data(file)
   file.close
   return_scene
 end
 #--------------------------------------------------------------------------
 # * Execute Load
 #--------------------------------------------------------------------------
 def do_load
   file = File.open('Save.rvdata', 'rb')
   read_save_data(file)
   file.close
   $scene = Scene_Map.new
   RPG::BGM.fade(1500)
   Graphics.fadeout(60)
   Graphics.wait(40)
   @last_bgm.play
   @last_bgs.play
 end
 #--------------------------------------------------------------------------
 # * Write Save Data
 #     file : write file object (opened)
 #--------------------------------------------------------------------------
 def write_save_data(file)
   characters = []
   $game_party.members.each {|actor|
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
 end
 #--------------------------------------------------------------------------
 # * Read Save Data
 #     file : file object for reading (opened)
 #--------------------------------------------------------------------------
 def read_save_data(file)
   characters           = Marshal.load(file)
   Graphics.frame_count = Marshal.load(file)
   @last_bgm            = Marshal.load(file)
   @last_bgs            = Marshal.load(file)
   $game_system         = Marshal.load(file)
   $game_message        = Marshal.load(file)
   $game_switches       = Marshal.load(file)
   $game_variables      = Marshal.load(file)
   $game_self_switches  = Marshal.load(file)
   $game_actors         = Marshal.load(file)
   $game_party          = Marshal.load(file)
   $game_troop          = Marshal.load(file)
   $game_map            = Marshal.load(file)
   $game_player         = Marshal.load(file)
   if $game_system.version_id != $data_system.version_id
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
 end
end

 

Share this post


Link to post
Share on other sites

whoops missed a couple of spots XD

 

#-------------------------
# ** Auto Save Module
#-------------------------
# written by kellessdee
#-------------------------
=begin
 A simple auto-save script.
 To call just use call script and type in
 Autosave.trigger
=end
module Autosave
 #-----------------------
 # * Trigger Auto Save
 #-----------------------
 def self.trigger
   # Open File
   file = File.open('Save.rvdata', 'wb')
   # Write to file
   characters = []
   $game_party.members.each {|actor| 
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
   # Close File
   file.close
 end
end
#-------------------
# ** Modified Menu
#-------------------
class Scene_Menu < Scene_Base
 #-------------------------
 # * Create Command Window
 #-------------------------
 def create_command_window
   commands = [Vocab::item,
               Vocab::skill,
               Vocab::equip,
               Vocab::status,
               Vocab::game_end]
   @command_window = Window_Command.new(160, commands)
   @command_window.index = @menu_index
 end
 #--------------------------------------------------------------------------
 # * Update Command Selection
 #--------------------------------------------------------------------------
 def update_command_selection
   if Input.trigger?(Input::B)
     Sound.play_cancel
     $scene = Scene_Map.new
   elsif Input.trigger?(Input::C)
     if $game_party.members.size == 0 && @command_window.index < 4
       Sound.play_buzzer
       return
     end
     Sound.play_decision
     case @command_window.index
     when 0      # Item
       $scene = Scene_Item.new
     when 1,2,3  # Skill, equipment, status
       start_actor_selection
     when 4      # End Game
       $scene = Scene_End.new
     end
   end
 end
end
#------------------
# ** Modified File
#------------------
class Scene_File < Scene_Base
 #--------------------------------------------------------------------------
 # * Start processing
 #--------------------------------------------------------------------------
 def start
   super
   create_menu_background
   @help_window = Window_Help.new
   # Create 1 save file
   @savefile_windows = Window_SaveFile.new(0, 'Save.rvdata')
   @item_max = 1
   @savefile_windows.selected = true
 end
 #--------------------------------------------------------------------------
 # * Termination Processing
 #--------------------------------------------------------------------------
 def terminate
   super
   dispose_menu_background
   @help_window.dispose
   dispose_item_windows
 end
 #--------------------------------------------------------------------------
 # * Return to Original Screen
 #--------------------------------------------------------------------------
 def return_scene
   if @from_title
     $scene = Scene_Title.new
   else
     $scene = Scene_Map.new
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   update_menu_background
   @help_window.update
   @savefile_windows.update
   update_savefile_selection
 end
 #--------------------------------------------------------------------------
 # * Update Save File Selection
 #--------------------------------------------------------------------------
 def update_savefile_selection
   if Input.trigger?(Input::C)
     determine_savefile
   elsif Input.trigger?(Input::B)
     Sound.play_cancel
     return_scene
   end
 end
 #--------------------------------------------------------------------------
 # * Confirm Save File
 #--------------------------------------------------------------------------
 def determine_savefile
   if @saving
     Sound.play_save
     do_save
   else
     if @savefile_windows.file_exist
       Sound.play_load
       do_load
     else
       Sound.play_buzzer
       return
     end
   end
   $game_temp.last_file_index = @index
 end
 #--------------------------------------------------------------------------
 # * Execute Save
 #--------------------------------------------------------------------------
 def do_save
   file = File.open('Save.rvdata', 'wb')
   write_save_data(file)
   file.close
   return_scene
 end
 #--------------------------------------------------------------------------
 # * Execute Load
 #--------------------------------------------------------------------------
 def do_load
   file = File.open('Save.rvdata', 'rb')
   read_save_data(file)
   file.close
   $scene = Scene_Map.new
   RPG::BGM.fade(1500)
   Graphics.fadeout(60)
   Graphics.wait(40)
   @last_bgm.play
   @last_bgs.play
 end
 #--------------------------------------------------------------------------
 # * Write Save Data
 #     file : write file object (opened)
 #--------------------------------------------------------------------------
 def write_save_data(file)
   characters = []
   $game_party.members.each {|actor|
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
 end
 #--------------------------------------------------------------------------
 # * Read Save Data
 #     file : file object for reading (opened)
 #--------------------------------------------------------------------------
 def read_save_data(file)
   characters           = Marshal.load(file)
   Graphics.frame_count = Marshal.load(file)
   @last_bgm            = Marshal.load(file)
   @last_bgs            = Marshal.load(file)
   $game_system         = Marshal.load(file)
   $game_message        = Marshal.load(file)
   $game_switches       = Marshal.load(file)
   $game_variables      = Marshal.load(file)
   $game_self_switches  = Marshal.load(file)
   $game_actors         = Marshal.load(file)
   $game_party          = Marshal.load(file)
   $game_troop          = Marshal.load(file)
   $game_map            = Marshal.load(file)
   $game_player         = Marshal.load(file)
   if $game_system.version_id != $data_system.version_id
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
 end
end

 

 

Line 81 error

Share this post


Link to post
Share on other sites

What error does it give you? Because there shouldn't be an error at line 81 in my script...or is it in another script that you get that error?

Share this post


Link to post
Share on other sites

What error does it give you? Because there shouldn't be an error at line 81 in my script...or is it in another script that you get that error?

 

Scene_File 81

Undefined method 'each' <windows_savefile>

 

 

 

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This class performs the save and load screen processing.
#==============================================================================

class Scene_File < Scene_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     saving     : save flag (if false, load screen)
 #     from_title : flag: it was called from "Continue" on the title screen
 #     from_event : flag: it was called from the "Call Save Screen" event
 #--------------------------------------------------------------------------
 def initialize(saving, from_title, from_event)
   @saving = saving
   @from_title = from_title
   @from_event = from_event
 end
 #--------------------------------------------------------------------------
 # * Start processing
 #--------------------------------------------------------------------------
 def start
   super
   create_menu_background
   @help_window = Window_Help.new
   create_savefile_windows
   if @saving
     @index = $game_temp.last_file_index
     @help_window.set_text(Vocab::SaveMessage)
   else
     @index = self.latest_file_index
     @help_window.set_text(Vocab::LoadMessage)
   end
   @savefile_windows[@index].selected = true
 end
 #--------------------------------------------------------------------------
 # * Termination Processing
 #--------------------------------------------------------------------------
 def terminate
   super
   dispose_menu_background
   @help_window.dispose
   dispose_item_windows
 end
 #--------------------------------------------------------------------------
 # * Return to Original Screen
 #--------------------------------------------------------------------------
 def return_scene
   if @from_title
     $scene = Scene_Title.new
   elsif @from_event
     $scene = Scene_Map.new
   else
     $scene = Scene_Menu.new(4)
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   update_menu_background
   @help_window.update
   update_savefile_windows
   update_savefile_selection
 end
 #--------------------------------------------------------------------------
 # * Create Save File Window
 #--------------------------------------------------------------------------
 def create_savefile_windows
   @savefile_windows = []
   for i in 0..3
     @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
   end
   @item_max = 4
 end
 #--------------------------------------------------------------------------
 # * Dispose of Save File Window
 #--------------------------------------------------------------------------
 def dispose_item_windows
   for window in @savefile_windows
     window.dispose
   end
 end
 #--------------------------------------------------------------------------
 # * Update Save File Window
 #--------------------------------------------------------------------------
 def update_savefile_windows
   for window in @savefile_windows
     window.update
   end
 end
 #--------------------------------------------------------------------------
 # * Update Save File Selection
 #--------------------------------------------------------------------------
 def update_savefile_selection
   if Input.trigger?(Input::C)
     determine_savefile
   elsif Input.trigger?(Input::B)
     Sound.play_cancel
     return_scene
   else
     last_index = @index
     if Input.repeat?(Input::DOWN)
       cursor_down(Input.trigger?(Input::DOWN))
     end
     if Input.repeat?(Input::UP)
       cursor_up(Input.trigger?(Input::UP))
     end
     if @index != last_index
       Sound.play_cursor
       @savefile_windows[last_index].selected = false
       @savefile_windows[@index].selected = true
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Confirm Save File
 #--------------------------------------------------------------------------
 def determine_savefile
   if @saving
     Sound.play_save
     do_save
   else
     if @savefile_windows[@index].file_exist
       Sound.play_load
       do_load
     else
       Sound.play_buzzer
       return
     end
   end
   $game_temp.last_file_index = @index
 end
 #--------------------------------------------------------------------------
 # * Move cursor down
 #     wrap : Wraparound allowed
 #--------------------------------------------------------------------------
 def cursor_down(wrap)
   if @index < @item_max - 1 or wrap
     @index = (@index + 1) % @item_max
   end
 end
 #--------------------------------------------------------------------------
 # * Move cursor up
 #     wrap : Wraparound allowed
 #--------------------------------------------------------------------------
 def cursor_up(wrap)
   if @index > 0 or wrap
     @index = (@index - 1 + @item_max) % @item_max
   end
 end
 #--------------------------------------------------------------------------
 # * Create Filename
 #     file_index : save file index (0-3)
 #--------------------------------------------------------------------------
 def make_filename(file_index)
   return "Save#{file_index + 1}.rvdata"
 end
 #--------------------------------------------------------------------------
 # * Select File With Newest Timestamp
 #--------------------------------------------------------------------------
 def latest_file_index
   index = 0
   latest_time = Time.at(0)
   for i in 0...@savefile_windows.size
     if @savefile_windows[i].time_stamp > latest_time
       latest_time = @savefile_windows[i].time_stamp
       index = i
     end
   end
   return index
 end
 #--------------------------------------------------------------------------
 # * Execute Save
 #--------------------------------------------------------------------------
 def do_save
   file = File.open(@savefile_windows[@index].filename, "wb")
   write_save_data(file)
   file.close
   return_scene
 end
 #--------------------------------------------------------------------------
 # * Execute Load
 #--------------------------------------------------------------------------
 def do_load
   file = File.open(@savefile_windows[@index].filename, "rb")
   read_save_data(file)
   file.close
   $scene = Scene_Map.new
   RPG::BGM.fade(1500)
   Graphics.fadeout(60)
   Graphics.wait(40)
   @last_bgm.play
   @last_bgs.play
 end
 #--------------------------------------------------------------------------
 # * Write Save Data
 #     file : write file object (opened)
 #--------------------------------------------------------------------------
 def write_save_data(file)
   characters = []
   for actor in $game_party.members
     characters.push([actor.character_name, actor.character_index])
   end
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
 end
 #--------------------------------------------------------------------------
 # * Read Save Data
 #     file : file object for reading (opened)
 #--------------------------------------------------------------------------
 def read_save_data(file)
   characters           = Marshal.load(file)
   Graphics.frame_count = Marshal.load(file)
   @last_bgm            = Marshal.load(file)
   @last_bgs            = Marshal.load(file)
   $game_system         = Marshal.load(file)
   $game_message        = Marshal.load(file)
   $game_switches       = Marshal.load(file)
   $game_variables      = Marshal.load(file)
   $game_self_switches  = Marshal.load(file)
   $game_actors         = Marshal.load(file)
   $game_party          = Marshal.load(file)
   $game_troop          = Marshal.load(file)
   $game_map            = Marshal.load(file)
   $game_player         = Marshal.load(file)
   if $game_system.version_id != $data_system.version_id
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
 end
end

 

 

Edited by violentpurge09

Share this post


Link to post
Share on other sites

Oohhh my bad XD

 

change line 108 (in my autosave script)

dispose_item_windows

to

@windows_savefile.dispose

 

I forgot to change that

Share this post


Link to post
Share on other sites

Oohhh my bad XD

 

change line 108 (in my autosave script)

dispose_item_windows

to

@windows_savefile.dispose

 

I forgot to change that

 

Script 'kellessdee - Auto save module' line 108: NoMethodError occured
undifined method 'dispose' for nil:NilClass

Share this post


Link to post
Share on other sites

ugh my bad i got that backwards

should be:

@savefile_windows.dispose

 

It works thank you.

 

Im going to be updating the script section of my main game post

soon to include Scripts for all the custom scripts.

and your name will be appearing in the credits :)

Share this post


Link to post
Share on other sites

Cool no problem! I'm glad I didn't make any more mistakes this time :sweatdrop:

it could probably be prettier (by making the load file screen larger with more info)

 

if you have any more issues or need me to change something let me know

Share this post


Link to post
Share on other sites

Cool no problem! I'm glad I didn't make any more mistakes this time :sweatdrop:

it could probably be prettier (by making the load file screen larger with more info)

 

if you have any more issues or need me to change something let me know

 

Or could we just make it so continue from the title screen loads the save file?

Share this post


Link to post
Share on other sites

*facepalms*

 

that makes so much sense

 

replace the entire script with this one.

lemme know if you get any errors

 

#-------------------------
# ** Auto Save Module
#-------------------------
# written by kellessdee
#-------------------------
=begin
 A simple auto-save script.
 To call just use call script and type in
 Autosave.trigger
=end
module Autosave
 #-----------------------
 # * Trigger Auto Save
 #-----------------------
 def self.trigger
   # Open File
   file = File.open('Save.rvdata', 'wb')
   # Write to file
   characters = []
   $game_party.members.each {|actor| 
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
   # Close File
   file.close
 end
end
#-------------------
# ** Modified Menu
#-------------------
class Scene_Menu < Scene_Base
 #-------------------------
 # * Create Command Window
 #-------------------------
 def create_command_window
   commands = [Vocab::item,
               Vocab::skill,
               Vocab::equip,
               Vocab::status,
               Vocab::game_end]
   @command_window = Window_Command.new(160, commands)
   @command_window.index = @menu_index
 end
 #--------------------------------------------------------------------------
 # * Update Command Selection
 #--------------------------------------------------------------------------
 def update_command_selection
   if Input.trigger?(Input::B)
     Sound.play_cancel
     $scene = Scene_Map.new
   elsif Input.trigger?(Input::C)
     if $game_party.members.size == 0 && @command_window.index < 4
       Sound.play_buzzer
       return
     end
     Sound.play_decision
     case @command_window.index
     when 0      # Item
       $scene = Scene_Item.new
     when 1,2,3  # Skill, equipment, status
       start_actor_selection
     when 4      # End Game
       $scene = Scene_End.new
     end
   end
 end
end
#-------------------
# ** Modified Title
#-------------------
class Scene_Title < Scene_Base
 #--------------------------------------------------------------------------
 # * Determine if Continue is Enabled
 #--------------------------------------------------------------------------
 def check_continue
   @continue_enabled = File.exist?('Save.rvdata')
 end
 #--------------------------------------------------------------------------
 # * Command: Continue
 #--------------------------------------------------------------------------
 def command_continue
   if @continue_enabled
     Sound.play_decision
     do_load
   else
     Sound.play_buzzer
   end
 end
 #--------------------------------------------------------------------------
 # * Execute Load
 #--------------------------------------------------------------------------
 def do_load
   file = File.open('Save.rvdata', 'rb')
   read_save_data(file)
   file.close
   $scene = Scene_Map.new
   RPG::BGM.fade(1500)
   Graphics.fadeout(60)
   Graphics.wait(40)
   @last_bgm.play
   @last_bgs.play
 end
 #--------------------------------------------------------------------------
 # * Read Save Data
 #     file : file object for reading (opened)
 #--------------------------------------------------------------------------
 def read_save_data(file)
   characters           = Marshal.load(file)
   Graphics.frame_count = Marshal.load(file)
   @last_bgm            = Marshal.load(file)
   @last_bgs            = Marshal.load(file)
   $game_system         = Marshal.load(file)
   $game_message        = Marshal.load(file)
   $game_switches       = Marshal.load(file)
   $game_variables      = Marshal.load(file)
   $game_self_switches  = Marshal.load(file)
   $game_actors         = Marshal.load(file)
   $game_party          = Marshal.load(file)
   $game_troop          = Marshal.load(file)
   $game_map            = Marshal.load(file)
   $game_player         = Marshal.load(file)
   if $game_system.version_id != $data_system.version_id
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
 end
end

 

Share this post


Link to post
Share on other sites

*facepalms*

 

that makes so much sense

 

replace the entire script with this one.

lemme know if you get any errors

 

#-------------------------
# ** Auto Save Module
#-------------------------
# written by kellessdee
#-------------------------
=begin
 A simple auto-save script.
 To call just use call script and type in
 Autosave.trigger
=end
module Autosave
 #-----------------------
 # * Trigger Auto Save
 #-----------------------
 def self.trigger
   # Open File
   file = File.open('Save.rvdata', 'wb')
   # Write to file
   characters = []
   $game_party.members.each {|actor| 
     characters.push([actor.character_name, actor.character_index])
   }
   $game_system.save_count += 1
   $game_system.version_id = $data_system.version_id
   @last_bgm = RPG::BGM::last
   @last_bgs = RPG::BGS::last
   Marshal.dump(characters,           file)
   Marshal.dump(Graphics.frame_count, file)
   Marshal.dump(@last_bgm,            file)
   Marshal.dump(@last_bgs,            file)
   Marshal.dump($game_system,         file)
   Marshal.dump($game_message,        file)
   Marshal.dump($game_switches,       file)
   Marshal.dump($game_variables,      file)
   Marshal.dump($game_self_switches,  file)
   Marshal.dump($game_actors,         file)
   Marshal.dump($game_party,          file)
   Marshal.dump($game_troop,          file)
   Marshal.dump($game_map,            file)
   Marshal.dump($game_player,         file)
   # Close File
   file.close
 end
end
#-------------------
# ** Modified Menu
#-------------------
class Scene_Menu < Scene_Base
 #-------------------------
 # * Create Command Window
 #-------------------------
 def create_command_window
   commands = [Vocab::item,
               Vocab::skill,
               Vocab::equip,
               Vocab::status,
               Vocab::game_end]
   @command_window = Window_Command.new(160, commands)
   @command_window.index = @menu_index
 end
 #--------------------------------------------------------------------------
 # * Update Command Selection
 #--------------------------------------------------------------------------
 def update_command_selection
   if Input.trigger?(Input::B)
     Sound.play_cancel
     $scene = Scene_Map.new
   elsif Input.trigger?(Input::C)
     if $game_party.members.size == 0 && @command_window.index < 4
       Sound.play_buzzer
       return
     end
     Sound.play_decision
     case @command_window.index
     when 0      # Item
       $scene = Scene_Item.new
     when 1,2,3  # Skill, equipment, status
       start_actor_selection
     when 4      # End Game
       $scene = Scene_End.new
     end
   end
 end
end
#-------------------
# ** Modified Title
#-------------------
class Scene_Title < Scene_Base
 #--------------------------------------------------------------------------
 # * Determine if Continue is Enabled
 #--------------------------------------------------------------------------
 def check_continue
   @continue_enabled = File.exist?('Save.rvdata')
 end
 #--------------------------------------------------------------------------
 # * Command: Continue
 #--------------------------------------------------------------------------
 def command_continue
   if @continue_enabled
     Sound.play_decision
     do_load
   else
     Sound.play_buzzer
   end
 end
 #--------------------------------------------------------------------------
 # * Execute Load
 #--------------------------------------------------------------------------
 def do_load
   file = File.open('Save.rvdata', 'rb')
   read_save_data(file)
   file.close
   $scene = Scene_Map.new
   RPG::BGM.fade(1500)
   Graphics.fadeout(60)
   Graphics.wait(40)
   @last_bgm.play
   @last_bgs.play
 end
 #--------------------------------------------------------------------------
 # * Read Save Data
 #     file : file object for reading (opened)
 #--------------------------------------------------------------------------
 def read_save_data(file)
   characters           = Marshal.load(file)
   Graphics.frame_count = Marshal.load(file)
   @last_bgm            = Marshal.load(file)
   @last_bgs            = Marshal.load(file)
   $game_system         = Marshal.load(file)
   $game_message        = Marshal.load(file)
   $game_switches       = Marshal.load(file)
   $game_variables      = Marshal.load(file)
   $game_self_switches  = Marshal.load(file)
   $game_actors         = Marshal.load(file)
   $game_party          = Marshal.load(file)
   $game_troop          = Marshal.load(file)
   $game_map            = Marshal.load(file)
   $game_player         = Marshal.load(file)
   if $game_system.version_id != $data_system.version_id
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
 end
end

 

 

Perfect Many thanks

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...