查看: 1223|回复: 4

自动存档问题,在新建存档位存档?

  [复制链接]
梦石
0
星屑
60
在线时间
1 小时
注册时间
2008-6-28
回帖
43
发表于 2008-7-15 17:46:48 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
我使用自动存档脚本,自动存档覆盖当前使用的存档。怎样才能像黑暗圣剑传说那样,有一个自动存档档位,不覆盖任何存档呢?


这是我的自动存档脚本
  1. module Kernel

  2. alias origin_exit exit unless method_defined? :exit

  3. def exit(*args)
  4.    case $scene
  5.    when Scene_Map
  6.      AutoSave.common_save unless $game_system.map_interpreter.running?
  7.    when Scene_Battle
  8.      AutoSave.common_save unless $game_system.battle_interpreter.running?
  9.    else
  10.      if $scene.type != NilClass and $scene.type != Scene_Title
  11.        AutoSave.common_save
  12.      end
  13.    end
  14.    origin_exit(*args)
  15. end

  16. end


  17. module AutoSave

  18. if @scene_proc.nil?
  19.    @last_scene = nil.class
  20.    @scene_proc = proc do |value|
  21.      if value.nil? or value.is_a?(Scene_Title)
  22.        if @last_scene != NilClass and @last_scene != Scene_Title
  23.          AutoSave.common_save
  24.        end
  25.      end
  26.      @last_scene = value.type
  27.    end
  28.    trace_var(:$scene,@scene_proc)
  29. end

  30. module_function

  31. def common_save
  32.    filename = "Save#{$game_temp.last_file_index + 1}.rxdata"
  33.    file = File.open(filename, "wb")
  34.    write_save_data(file)
  35.    file.close
  36. end

  37. def write_save_data(file)
  38.    characters = []
  39.    for i in 0...$game_party.actors.size
  40.      actor = $game_party.actors[i]
  41.      characters.push([actor.character_name, actor.character_hue])
  42.    end
  43.    Marshal.dump(characters, file)
  44.    Marshal.dump(Graphics.frame_count, file)
  45.    $game_system.save_count += 1
  46.    $game_system.magic_number = $data_system.magic_number
  47.    Marshal.dump($game_system, file)
  48.    Marshal.dump($game_switches, file)
  49.    Marshal.dump($game_variables, file)
  50.    Marshal.dump($game_self_switches, file)
  51.    Marshal.dump($game_screen, file)
  52.    Marshal.dump($game_actors, file)
  53.    Marshal.dump($game_party, file)
  54.    Marshal.dump($game_troop, file)
  55.    Marshal.dump($game_map, file)
  56.    Marshal.dump($game_player, file)
  57. end

  58. end
复制代码

版务信息:本贴由楼主自主结贴~

冰

梦石
0
星屑
142
在线时间
264 小时
注册时间
2006-11-22
回帖
1010
发表于 2008-7-15 19:27:19 | 显示全部楼层
def common_save
  filename = "AutoSave.rxdata"
  file = File.open(filename, "wb")
  write_save_data(file)
  file.close
end

系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
版主对此帖的认可:『完全部份认可』,积分『+250』。
回复

使用道具 举报

梦石
0
星屑
60
在线时间
1 小时
注册时间
2008-6-28
回帖
43
 楼主| 发表于 2008-7-16 00:31:01 | 显示全部楼层
这几行加到哪里啊?
回复

使用道具 举报

头像被屏蔽

冰

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-3-29
回帖
794
发表于 2008-7-16 00:32:24 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

梦石
0
星屑
112
在线时间
74 小时
注册时间
2008-7-5
回帖
438
发表于 2008-7-16 01:47:59 | 显示全部楼层
是仙剑奇侠传二的例子吗,我很想知道哈{/qiang}{/qiang}{/qiang}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部