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

Project1

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

存档问题

 关闭 [复制链接]

Lv1.梦旅人

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

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

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

x
  这几天乱搞我的范例,不知道搞到哪了,存档的时候存档文件生成在Saves文件夹里,但是读取的时候他却在主目录下找,各位大大帮帮忙啊.谢谢~~~~~~~
工程http://www.91ccmy.cn/双戒.rar
好吧,我终于发现最近几天学习脚本之后果断能把事件复杂化成脚本了..........

Lv1.梦旅人

很傻很天真

梦石
0
星屑
55
在线时间
3 小时
注册时间
2007-3-13
帖子
3667
2
发表于 2008-7-29 06:02:07 | 只看该作者
把工程贴上来……
应该是读档路径设置错误……
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3417
在线时间
3628 小时
注册时间
2006-9-6
帖子
37402

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

3
发表于 2008-7-29 06:08:09 | 只看该作者
要把读档路径也改了啊……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
38 小时
注册时间
2007-5-6
帖子
47
4
 楼主| 发表于 2008-7-29 06:13:18 | 只看该作者
存档路径找不到啊,论坛不允许传附件,我放我服务器上了,地址顶楼有,各位大大帮忙讲解下改哪.
好吧,我终于发现最近几天学习脚本之后果断能把事件复杂化成脚本了..........
回复 支持 反对

使用道具 举报

Lv1.梦旅人

很傻很天真

梦石
0
星屑
55
在线时间
3 小时
注册时间
2007-3-13
帖子
3667
5
发表于 2008-7-29 06:28:38 | 只看该作者
  1. #==============================================================================
  2. # ■ Scene_File
  3. #------------------------------------------------------------------------------
  4. #  处理文件的类。
  5. #==============================================================================
  6. class Scene_File < Scene_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对象
  9.   #     saving     : 存档标志 (false 为载入画面)
  10.   #     from_title : 调用标题画面的 "继续" 标志
  11.   #     from_event : 事件的 "调用存档画面" 的调用标志
  12.   #--------------------------------------------------------------------------
  13.   def initialize(saving, from_title, from_event)
  14.     @saving = saving
  15.     @from_title = from_title
  16.     @from_event = from_event
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 开始处理
  20.   #--------------------------------------------------------------------------
  21.   def start
  22.     super
  23.     @help_window = Window_Help.new
  24.     unless $game_temp.sub_menu_bitmap.width == 1
  25.       @help_window.opacity = 0
  26.       create_sub_menu_background
  27.     else
  28.       create_title_graphic
  29.     end
  30.     create_command_window
  31.     if @saving
  32.       @index = $game_temp.last_file_index
  33.       @help_window.set_text(Vocab::SaveMessage)
  34.     else
  35.       @index = self.latest_file_index
  36.       @help_window.set_text(Vocab::LoadMessage)
  37.     end
  38.     @refresh_index = @command_window.index = @index
  39.     @item_max = MAX_SAVE_ID
  40.     create_savefile_window
  41.     @savefile_window.openness = 0
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● 结束处理
  45.   #--------------------------------------------------------------------------
  46.   def terminate
  47.     super
  48.     dispose_menu_background
  49.     @help_window.dispose
  50.     dispose_item_windows
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 还原至原先的画面
  54.   #--------------------------------------------------------------------------
  55.   def return_scene
  56.     if @from_title
  57.       $scene = Scene_Title.new
  58.     elsif @from_event
  59.       $scene = Scene_Map.new
  60.     else
  61.       $scene = Scene_Menu.new(4)
  62.     end
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 更新画面
  66.   #--------------------------------------------------------------------------
  67.   def update
  68.     super
  69.     update_menu_background
  70.     @help_window.update
  71.     update_savefile_windows
  72.     update_savefile_selection
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 开始后处理
  76.   #--------------------------------------------------------------------------
  77.   def post_start
  78.     super
  79.     open_savefile_window
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 结束前处理
  83.   #--------------------------------------------------------------------------
  84.   def pre_terminate
  85.     super
  86.     close_savefile_window
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 生成标题画面背景
  90.   #--------------------------------------------------------------------------
  91.   def create_title_graphic
  92.     @menuback_sprite = Sprite.new
  93.     @menuback_sprite.bitmap = Cache.system("Title")
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 生成存档文件列表窗口
  97.   #--------------------------------------------------------------------------
  98.   def create_command_window
  99.     file_names = []
  100.     for i in 0...MAX_SAVE_ID
  101.       id = sprintf("%02d", i+1)
  102.       file_names.push(Vocab::File + "Saves/Save" + id)
  103.     end
  104.     @command_window = Window_Command.new(112, file_names)
  105.     @command_window.height = 298
  106.     @command_window.x = 64
  107.     @command_window.y = 59
  108.     @command_window.openness = 0
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 生成存档文件窗口
  112.   #--------------------------------------------------------------------------
  113.   def create_savefile_window
  114.     @savefile_window = Window_SaveFile.new(@command_window.index, make_filename(@command_window.index))
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 释放存档文件
  118.   #--------------------------------------------------------------------------
  119.   def dispose_item_windows
  120.     @command_window.dispose
  121.     @savefile_window.dispose
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 打开指令窗口
  125.   #--------------------------------------------------------------------------
  126.   def open_savefile_window
  127.     @command_window.open
  128.     @savefile_window.open
  129.     begin
  130.       @command_window.update
  131.       @savefile_window.update
  132.       Graphics.update
  133.     end until @savefile_window.openness == 255
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 关闭指令窗口
  137.   #--------------------------------------------------------------------------
  138.   def close_savefile_window
  139.     @command_window.close
  140.     @savefile_window.close
  141.     begin
  142.       @command_window.update
  143.       @savefile_window.update
  144.       Graphics.update
  145.     end until @savefile_window.openness == 0
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 更新存档文件窗口
  149.   #--------------------------------------------------------------------------
  150.   def update_savefile_windows
  151.     @command_window.update
  152.     @savefile_window.update
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 更新存档文件选择
  156.   #--------------------------------------------------------------------------
  157.   def update_savefile_selection
  158.     if Input.trigger?(Input::C)
  159.       determine_savefile
  160.     end
  161.     if Input.trigger?(Input::B)
  162.       Sound.play_cancel
  163.       return_scene
  164.     end
  165.     if @refresh_index != @command_window.index
  166.       @refresh_index = @command_window.index
  167.       @savefile_window.dispose
  168.       create_savefile_window
  169.       end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 确定存档文件
  173.   #--------------------------------------------------------------------------
  174.   def determine_savefile
  175.     if @saving
  176.       Sound.play_save
  177.       do_save
  178.     else
  179.       if @savefile_window.file_exist
  180.         Sound.play_load
  181.         do_load
  182.       else
  183.         Sound.play_buzzer
  184.         return
  185.       end
  186.     end
  187.     $game_temp.last_file_index = @index
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● 生成文件名
  191.   #     file_index : 存档文件索引 (0~3)
  192.   #--------------------------------------------------------------------------
  193.   def make_filename(file_index)
  194.     return "Saves/Save#{file_index + 1}.rvdata"
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 按时间戳选择最新的文件
  198.   #--------------------------------------------------------------------------
  199.   def latest_file_index
  200.     index = 0
  201.     latest_time = Time.at(0) # 时间戳
  202.     for i in 0...MAX_SAVE_ID
  203.       file_name = make_filename(i)
  204.       if FileTest.exist?(SAVE_DIR + file_name)
  205.         file = File.open(SAVE_DIR + file_name, "r")
  206.         if file.mtime > latest_time
  207.           latest_time = file.mtime
  208.           index = i
  209.         end
  210.       end
  211.     end
  212.     return index
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 执行存档
  216.   #--------------------------------------------------------------------------
  217.   def do_save
  218.     file_name = make_filename(@command_window.index)
  219.     $game_temp.save_bitmap.make_png(file_name.split(/\./)[0], SAVE_DIR)
  220.     file = File.open(SAVE_DIR + file_name, "wb")
  221.     write_save_data(file)
  222.     file.close
  223.     return_scene
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 执行载入
  227.   #--------------------------------------------------------------------------
  228.   def do_load
  229.     file_name = make_filename(@command_window.index)
  230.     file = File.open(SAVE_DIR + file_name, "rb")
  231.     read_save_data(file)
  232.     file.close
  233.     $scene = Scene_Map.new
  234.     RPG::BGM.fade(1500)
  235.     Graphics.fadeout(60)
  236.     Graphics.wait(40)
  237.     @last_bgm.play
  238.     @last_bgs.play
  239.   end
  240. end
复制代码

替换◎ Scene_File试试……
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-8
帖子
466
6
发表于 2008-7-29 06:28:58 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
38 小时
注册时间
2007-5-6
帖子
47
7
 楼主| 发表于 2008-7-29 06:35:06 | 只看该作者
#--------------------------------------------------------------------------
  # ● 确定存档文件
  #--------------------------------------------------------------------------
  def determine_savefile
    if @saving
      Sound.play_save
      do_save
    else
      if @savefile_window.file_exist
        Sound.play_load
        do_load
      else
        Sound.play_buzzer
        return
      end
    end
    $game_temp.last_file_index = @index
  end
  #--------------------------------------------------------------------------
  # ● 生成文件名
  #     file_index : 存档文件索引 (0~3)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save#{file_index + 1}.rvdata"
  end
  #--------------------------------------------------------------------------
  # ● 按时间戳选择最新的文件
  #--------------------------------------------------------------------------
  def latest_file_index
    index = 0
    latest_time = Time.at(0) # 时间戳
    for i in 0...MAX_SAVE_ID
      file_name = make_filename(i)
      if FileTest.exist?(SAVE_DIR + file_name)
        file = File.open(SAVE_DIR + file_name, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          index = i
        end
      end
    end
    return index
  end
  #--------------------------------------------------------------------------
  # ● 执行存档
  #--------------------------------------------------------------------------
  def do_save
    file_name = make_filename(@command_window.index)
    $game_temp.save_bitmap.make_png(file_name.split(/\./)[0], SAVE_DIR)
    file = File.open(SAVE_DIR + file_name, "wb")
    write_save_data(file)
    file.close
    return_scene
  end
  #--------------------------------------------------------------------------
  # ● 执行载入
  #--------------------------------------------------------------------------
  def do_load
    file_name = make_filename(@command_window.index)
    file = File.open(SAVE_DIR + file_name, "rb")
    read_save_data(file)
    file.close
    $scene = Scene_Map.new
    RPG::BGM.fade(1500)
    Graphics.fadeout(60)
    Graphics.wait(40)
    @last_bgm.play
    @last_bgs.play
  end
end
我的Scene_File是这样的.用了精灵的那个脚本之后存档直接出问题.大家帮忙看看.改下读档路径,改到Saves文件夹下就成.谢之~~~~~
好吧,我终于发现最近几天学习脚本之后果断能把事件复杂化成脚本了..........
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-8
帖子
466
8
发表于 2008-7-29 06:47:17 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
38 小时
注册时间
2007-5-6
帖子
47
9
 楼主| 发表于 2008-7-29 06:50:03 | 只看该作者
确定,因为我把存档文件复制到主目录下就一切正常.
好吧,我终于发现最近几天学习脚本之后果断能把事件复杂化成脚本了..........
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-8
帖子
466
10
发表于 2008-7-29 06:52:30 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-20 21:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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