赞 | 1 |
VIP | 74 |
好人卡 | 1 |
积分 | 561 |
经验 | 25708 |
最后登录 | 2017-11-24 |
在线时间 | 269 小时 |
Lv6.析梦学徒
- 梦石
- 0
- 星屑
- 56096
- 在线时间
- 269 小时
- 注册时间
- 2010-6-16
- 帖子
- 982
|
我修改了Gameover,让游戏结束时可以继续存档-2继续游戏,
#--------------------------------------------------------------------------
# ● 选择命令 [继续] 时的处理
#--------------------------------------------------------------------------
def command_to_again
# 演奏确定 SE
if FileTest.exist?("Save/Mysave_2.rxdata")
$Save_id = 1
$game_switches[24] = true
#$game_map.update
$scene = Scene_Map.new
$game_map.refresh
return
else
$game_system.se_play($data_system.buzzer_se)
end
end
也就是选择继续时开启24号开关,然后返回地图。
在公共事件中设定,如果24号开关开启时,并行处理此公共事件。
公共事件中调用了read_save_data。也就是下面的脚本。
#==============================================================================
# ■ Interpreter (分割定义 7)
#------------------------------------------------------------------------------
# 执行事件命令的解释器。本类在 Game_System 类
# 和 Game_Event 类的内部使用。
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# ● 写入存档数据
# file : 写入用文件对像 (已经打开)
#--------------------------------------------------------------------------
def write_save_data#(i=1)
if $Save_id ==0
file = File.open("Save/Mysave.rxdata", "wb")
end
if $Save_id ==1
file = File.open("Save/Mysave_2.rxdata", "wb")
end
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, 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)
file.close
end
#--------------------------------------------------------------------------
# ● 读取存档数据
# file : 读取用文件对像 (已经打开)
#--------------------------------------------------------------------------
def read_save_data#(i=1)
$game_temp = Game_Temp.new
if $Save_id ==0
file = File.open("Save/Mysave.rxdata", "rb")
end
if $Save_id ==1
file = File.open("Save/Mysave_2.rxdata", "rb")
end
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = 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.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
file.close
# 还原 BGM、BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# 刷新地图 (执行并行事件)
$game_map.update
# 切换到地图画面
$scene = Scene_Map.new
#$game_map.refresh
end
end
但是游戏中,游戏结束时,选择继续后会返回地图然后马上又回到游戏结束时的选项。
并不会读取存档-2.为什么呢 |
|