赞 | 1 |
VIP | 255 |
好人卡 | 52 |
积分 | 1 |
经验 | 77416 |
最后登录 | 2016-1-18 |
在线时间 | 1269 小时 |
Lv1.梦旅人 薄凉看客
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 1269 小时
- 注册时间
- 2010-6-20
- 帖子
- 1316
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- =begin
- by 薄凉看客
- Save模块
- 模块方法
- Save.save(index) 保存进度,index文档编号,默认为最后一次存档编号,
- 也可用此方法手动保存进度
- Save.wait 两次存档间隔帧(自动存档)
- Save.save_v(filename, variable_name) 保存变量值自动补后缀名,
- 如需改路径xxx/即可,用 load_data("路径+文件名") 读取值
- =end
- module Save
- def self.save(index = nil)
- if $game_temp.last_file_index != 0
- @filename = "Save/Save#{$game_temp.last_file_index}.rxdata"
- end
- @filename = "Save/Save#{index}.rxdata" unless index.nil?
- @filename = "Save/Save1.rxdata" if @filename.nil?
- file = File.open(@filename, "wb")
- 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
- def self.wait
- return 50
- end
- def self.save_v(*arg)
- filename = arg[0] << ".rxdata"
- file = File.open(filename, "wb")
- Marshal.dump(arg[1], file)
- file.close
- end
- end
- class Scene_Map
- alias update_save update
- def update
- @save_wait = 0 if @save_wait == nil
- @save_wait += 1
- Save.save if @save_wait % Save.wait == 0
- update_save
- end
- end
复制代码 |
评分
-
查看全部评分
|