设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1054|回复: 4
打印 上一主题 下一主题

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

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
1 小时
注册时间
2008-6-28
帖子
86
跳转到指定楼层
1
发表于 2008-7-15 17:46:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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


这是我的自动存档脚本
  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
复制代码

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

Lv1.梦旅人

梦石
0
星屑
142
在线时间
264 小时
注册时间
2006-11-22
帖子
1057
2
发表于 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』。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
1 小时
注册时间
2008-6-28
帖子
86
3
 楼主| 发表于 2008-7-16 00:31:01 | 只看该作者
这几行加到哪里啊?
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-3-29
帖子
826
4
发表于 2008-7-16 00:32:24 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
107
在线时间
73 小时
注册时间
2008-7-5
帖子
509
5
发表于 2008-7-16 01:47:59 | 只看该作者
是仙剑奇侠传二的例子吗,我很想知道哈{/qiang}{/qiang}{/qiang}
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-8-8 22:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表