| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 5 |  
| 经验 | 1190 |  
| 最后登录 | 2013-8-3 |  
| 在线时间 | 68 小时 |  
 Lv2.观梦者 
	梦石0 星屑464 在线时间68 小时注册时间2011-8-31帖子43 | 
| 脚本◎Scene_File的第336行发生TypeError. no marshal_dump is defined for class Sprite
 
 在这里附上脚本:
 
 #==============================================================================
 # ■ Scene_File
 #==============================================================================
 class Scene_File < Scene_Menu_Base
 #--------------------------------------------------------------------------
 # ◎ 初始化对象
 #     saving     : 存档标志 (false 为载入画面)
 #     from_title : 调用标题画面的 "继续" 标志
 #     from_event : 事件的 "调用存档画面" 的调用标志
 #--------------------------------------------------------------------------
 def initialize(saving, from_title, from_event)
 @saving = saving
 @from_title = from_title
 @from_event = from_event
 end
 #--------------------------------------------------------------------------
 # ◎ 开始处理
 #--------------------------------------------------------------------------
 def start
 super
 @help_window = Window_Help.new
 if $game_temp.menu_bitmap.width == 1
 @menu_command_window = Window_Base.new(0,360,544,56)
 create_title_graphic
 end
 create_choice_window
 create_file_command_window
 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
 @refresh_index = @file_command_window.index = @index
 @item_max = MAX_SAVE_ID
 create_savefile_window
 @savefile_window.openness = 0
 end
 #--------------------------------------------------------------------------
 # ◎ 结束处理
 #--------------------------------------------------------------------------
 def terminate
 @@menu_index = @menu_command_window.index unless @from_title
 @menu_command_window.dispose
 @help_window.dispose
 dispose_item_windows
 dispose_menu_background
 end
 #--------------------------------------------------------------------------
 # ◎ 还原至原先的画面
 #--------------------------------------------------------------------------
 def return_scene
 if @from_title
 $scene = Scene_Title.new
 elsif @from_event
 $scene = Scene_Map.new
 else
 $scene = Scene_Menu.new(@@menu_index)
 end
 end
 #--------------------------------------------------------------------------
 # ◎ 更新画面
 #--------------------------------------------------------------------------
 def update
 super
 @help_window.update
 if @choice_window.visible
 update_choice_window
 else
 update_savefile_windows
 update_savefile_selection
 end
 end
 #--------------------------------------------------------------------------
 # ◎ 开始后处理
 #--------------------------------------------------------------------------
 def post_start
 super
 open_savefile_window
 end
 #--------------------------------------------------------------------------
 # ◎ 结束前处理
 #--------------------------------------------------------------------------
 def pre_terminate
 super
 close_savefile_window
 end
 #--------------------------------------------------------------------------
 # ◎ 生成标题画面背景
 #--------------------------------------------------------------------------
 def create_title_graphic
 @menuback_sprite = Sprite.new
 @menuback_sprite.bitmap = Cache.system("Title")
 end
 #--------------------------------------------------------------------------
 # ○ 生成指令窗口
 #     index : 默认项目编号
 #--------------------------------------------------------------------------
 def create_menu_command_window(index = 0)
 s1 = Vocab::item
 s2 = Vocab::skill
 s3 = Vocab::equip
 s4 = Vocab::status
 s5 = Vocab::save
 s6 = Vocab::game_end
 @menu_command_window = Window_Menu_Command.new(544, [s1, s2, s3, s4, s5, s6])
 @menu_command_window.y = @show ? 416 : 360
 @menu_command_window.index = index
 @menu_command_window.refresh
 if $game_party.members.size == 0          # 同伴人数为 0 的情况下
 @menu_command_window.draw_item(0, false)     # 物品无效化
 @menu_command_window.draw_item(1, false)     # 特技无效化
 @menu_command_window.draw_item(2, false)     # 装备无效化
 @menu_command_window.draw_item(3, false)     # 状态无效化
 end
 if $game_system.save_disabled             # 禁止存档的情况下
 @menu_command_window.draw_item(4, false)     # 存档无效化
 end
 end
 #--------------------------------------------------------------------------
 # ◎ 生成存档文件列表窗口
 #--------------------------------------------------------------------------
 def create_file_command_window
 file_names = []
 digit = MAX_SAVE_ID.to_s.size
 str_f = ""
 digit.times{|n| str_f += "0"}
 str_f[str_f.size-1, 1] = digit.to_s
 for i in 0...MAX_SAVE_ID
 id = sprintf("%#{str_f}d", i+1)
 file_names.push(Vocab::File + "\s" + id)
 end
 @file_command_window = Window_Command.new(112, file_names)
 @file_command_window.height = 298
 @file_command_window.x = 64
 @file_command_window.y = 59
 @file_command_window.openness = 0
 end
 #--------------------------------------------------------------------------
 # ◎ 生成覆盖提示窗体
 #--------------------------------------------------------------------------
 def create_choice_window
 @choice_window = Window_Choice.new
 @choice_window.visible = false
 @choice_window.z = 999
 end
 #--------------------------------------------------------------------------
 # ◎ 生成文件名
 #     file_index : 存档文件索引
 #--------------------------------------------------------------------------
 def make_filename(file_index)
 return "Save#{file_index + 1}.rvdata"
 end
 #--------------------------------------------------------------------------
 # ◎ 生成存档文件窗口
 #--------------------------------------------------------------------------
 def create_savefile_window
 @savefile_window = Window_SaveFile.new(@file_command_window.index, make_filename(@file_command_window.index))
 end
 #--------------------------------------------------------------------------
 # ◎ 释放存档文件
 #--------------------------------------------------------------------------
 def dispose_item_windows
 @file_command_window.dispose
 @savefile_window.dispose
 end
 #--------------------------------------------------------------------------
 # ◎ 打开指令窗口
 #--------------------------------------------------------------------------
 def open_savefile_window
 @file_command_window.open
 @savefile_window.open
 begin
 @file_command_window.update
 @savefile_window.update
 Graphics.update
 end until @savefile_window.openness == 255
 end
 #--------------------------------------------------------------------------
 # ◎ 关闭指令窗口
 #--------------------------------------------------------------------------
 def close_savefile_window
 @file_command_window.close
 @savefile_window.close
 begin
 @file_command_window.update
 @savefile_window.update
 Graphics.update
 end until @savefile_window.openness == 0
 end
 #--------------------------------------------------------------------------
 # ◎ 更新存档文件窗口
 #--------------------------------------------------------------------------
 def update_savefile_windows
 @file_command_window.update
 @savefile_window.update
 end
 #--------------------------------------------------------------------------
 # ◎ 更新存档文件选择
 #--------------------------------------------------------------------------
 def update_savefile_selection
 if Input.trigger?(Input::C)
 determine_savefile
 end
 if Input.trigger?(Input::B)
 Sound.play_cancel
 return_scene
 end
 if @refresh_index != @file_command_window.index
 @refresh_index = @file_command_window.index
 @savefile_window.dispose
 create_savefile_window
 end
 end
 #--------------------------------------------------------------------------
 # ◎ 更新覆盖提示窗体
 #--------------------------------------------------------------------------
 def update_choice_window
 @choice_window.update
 if Input.trigger?(Input::C)
 if @choice_window.value
 Sound.play_save
 do_save
 else
 Sound.play_cancel
 end
 @choice_window.visible = false
 elsif Input.trigger?(Input::B)
 Sound.play_cancel
 @choice_window.visible = false
 end
 end
 #--------------------------------------------------------------------------
 # ◎ 确定存档文件
 #--------------------------------------------------------------------------
 def determine_savefile
 if @saving
 if @savefile_window.file_exist
 @choice_window.visible = true
 else
 Sound.play_save
 do_save
 end
 else
 if @savefile_window.file_exist
 Sound.play_load
 do_load
 else
 Sound.play_buzzer
 return
 end
 end
 $game_temp.last_file_index = @index
 end
 #--------------------------------------------------------------------------
 # ◎ 生成文件名
 #     file_index : 存档文件索引 (0~3)
 #--------------------------------------------------------------------------
 def make_filename(file_index)
 return "Save#{file_index + 1}.rvdata"
 end
 #--------------------------------------------------------------------------
 # ◎ 按时间戳选择最新的文件
 #--------------------------------------------------------------------------
 def latest_file_index
 index = 0
 latest_time = Time.at(0) # 时间戳
 for i in 0...MAX_SAVE_ID
 file_name = make_filename(i)
 if FileTest.exist?(SAVE_DIR + file_name)
 file = File.open(SAVE_DIR + file_name, "r")
 if file.mtime > latest_time
 latest_time = file.mtime
 index = i
 end
 end
 end
 return index
 end
 #--------------------------------------------------------------------------
 # ◎ 执行存档
 #--------------------------------------------------------------------------
 def do_save
 file_name = make_filename(@file_command_window.index)
 file = File.open(SAVE_DIR + file_name, "wb")
 write_save_data(file)
 # 保存位图
 file_bitmap = $game_temp.save_bitmap.clone
 Marshal.dump(file_bitmap, file)
 file.close
 file_bitmap.dispose
 return_scene
 end
 #--------------------------------------------------------------------------
 # ◎ 执行载入
 #--------------------------------------------------------------------------
 def do_load
 file_name = make_filename(@file_command_window.index)
 file = File.open(SAVE_DIR + file_name, "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
 #--------------------------------------------------------------------------
 # ● 写入存档数据
 #     file : 写入文件用对象 (已经打开)
 #--------------------------------------------------------------------------
 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
 #--------------------------------------------------------------------------
 # ● 读取存档数据
 #     file : 读取文件用对象 (已经打开)
 #--------------------------------------------------------------------------
 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
 
 | 
 |