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

Project1

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

[已经解决] 如何做到一鍵存档与载入?

[复制链接]

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
631
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

1
发表于 2010-10-1 08:11:14 | 显示全部楼层
  1. #事件中使用脚本
  2. #save(编号)
  3. #load(编号)
  4. #就可以存读进度了。
  5. class Scene_File
  6.   #--------------------------------------------------------------------------
  7.   # ● 执行保存
  8.   #--------------------------------------------------------------------------
  9.   def do_save(id = @index, from_interpreter = false)
  10.     if from_interpreter
  11.       file = File.open(make_filename(id), "wb")
  12.     else
  13.       file = File.open(@savefile_windows[id].filename, "wb")
  14.     end
  15.     write_save_data(file)
  16.     file.close
  17.     return_scene
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 执行读取
  21.   #--------------------------------------------------------------------------
  22.   def do_load(id = @index, from_interpreter = false)
  23.     if from_interpreter
  24.       file = File.open(make_filename(id), "rb")
  25.     else
  26.       file = File.open(@savefile_windows[id].filename, "rb")
  27.     end
  28.     read_save_data(file)
  29.     file.close
  30.     $scene = Scene_Map.new
  31.     RPG::BGM.fade(1500)
  32.     Graphics.fadeout(60)
  33.     Graphics.wait(40)
  34.     @last_bgm.play
  35.     @last_bgs.play
  36.   end
  37. end


  38. class Game_Interpreter
  39.   #------------------------------------------------------------------
  40.   # ● 用事件脚本储存进度。方法:save(编号)
  41.   #------------------------------------------------------------------
  42.   def save(index = 0)
  43.     ts = Scene_File.new(true,false,true).do_save(index, true)
  44.   end
  45.   
  46.   #------------------------------------------------------------------
  47.   # ● 用事件脚本读取进度。方法:load(编号)
  48.   #------------------------------------------------------------------
  49.   def load(index = 0)
  50.     ts = Scene_File.new(false,false,true).do_load(index, true)
  51.   end  
  52. end
复制代码
这个么?编号0=1号档,1=2号……以此类推。

评分

参与人数 1星屑 +400 收起 理由
沉影不器 + 400 您的解答已经正确了...

查看全部评分

大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

129993099
永恒の梦制作组QQ群
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-12 14:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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