赞 | 40 |
VIP | 559 |
好人卡 | 234 |
积分 | 47 |
经验 | 251834 |
最后登录 | 2025-1-5 |
在线时间 | 5242 小时 |
Lv3.寻梦者 (版主) 八宝粥的基叔
- 梦石
- 0
- 星屑
- 4719
- 在线时间
- 5242 小时
- 注册时间
- 2009-4-29
- 帖子
- 14318
|
本帖最后由 protosssonny 于 2011-9-20 18:44 编辑
进入游戏之后,只要和敌人打几仗,再保存进度就会弹出这样的错误提示:
游戏用了很多其他非默认脚本,我又修改了不少脚本,所以难以找到错误的根源。为了消除这个错误,我想到消除错误提示的这两行:
# Marshal.dump($game_troop, file) #=>这行就是1398行
# $game_troop = Marshal.load(file)
就不 知道这样会不会对游戏造成严重影响。按照我的分析,$game_troop类的数据一般都是敌人的数据,而每次打仗,敌人都是不同的,数据也应该相应地重新读取,应该不会造成什么严重的影响。不知道我这样分析对不对,请大家来评价一下。
删除两行之后的脚本贴一下,我的储存进度定义在“随机属性”类里面。- #==============================================================================
- # ■ Scene_File
- #==============================================================================
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------
- # ● 写入存档数据
- # 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)
- Marshal.dump($data_weapons, file)
- Marshal.dump($data_armors, 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)
- $data_weapons = Marshal.load(file)
- $data_armors = 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
复制代码 请大家说说自己的看法吧,删除这两行会不会对游戏造成严重影响? |
|