Project1

标题: 脚本BUG高手看下 [打印本页]

作者: cZooCz    时间: 2008-1-11 02:33
标题: 脚本BUG高手看下
  1. ###使用说明
  2. #使用前请复制sceneshot.dll到游戏文件下,并新建文件夹Save
  3. #将此文本插入main前面
  4. #游戏前显示头像的文件名为:人物角色名_f,请自行建立几张做测试,不然找不到图片会报错
  5. #自动存档按钮F5 存入档位0(也就是自动存档那栏)
  6. #使用前,请在菜单脚本:scene_menu里面,
  7. #     when 4 # 存档
  8. #     # 禁止存档的情况下
  9. #     if $game_system.save_disabled
  10. #       # 演奏冻结 SE
  11. #       $game_system.se_play($data_system.buzzer_se)
  12. #       return
  13. #     end
  14. #     # 演奏确定 SE
  15. #     $game_system.se_play($data_system.decision_se)
  16. #     # 切换到存档画面
  17. #     $scene = Scene_Save.new <--这行
  18. #替换为:   $scene = Scene_Loadsave.new
  19. #另,在原scene_title里,48行左右
  20. #    for i in 0..3
  21. #          for i in 0..3
  22. #     if FileTest.exist?("Save#{i+1}.rxdata")
  23. ###################改成if FileTest.exist?("Save/Save#{i+1}.rxdata")
  24. #        @continue_enabled = true
  25. #      end
  26. #    end
  27. #否则继续游戏时会检测不到存档

  28. class Window_File < Window_Base
  29. attr_accessor :index
  30. def initialize(index = 0)
  31.    @backsp = Sprite.new
  32.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  33.    @backsp.z = 100
  34.    super(160,64,480,416)
  35.    #这行可以不用
  36.    self.contents = Bitmap.new(width - 32, height - 32)
  37.    @index = index
  38.    #这里我要说明一句,之所以用sprite是为了放缩图片
  39.    @sprite = Sprite.new
  40.    @sprite.visible = false
  41.    @sprite.z = 100
  42.    @sp_ch = []
  43.    @sp_ch[0] = Sprite.new
  44.    refresh
  45. end
  46. def refresh
  47.    self.contents.clear
  48.    for i in @sp_ch
  49.      i.visible = false
  50.    end
  51.    @sprite.visible = false
  52.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  53.      @sprite.visible = true
  54.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  55.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  56.      else
  57.        self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  58.      end
  59.      @sprite.x = 290
  60.      @sprite.y = 96
  61.      @sprite.z = 998
  62.      @sprite.zoom_x = 0.5
  63.      @sprite.zoom_y = 0.5
  64.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  65.      @time_stamp = file.mtime
  66.      @characters = Marshal.load(file)
  67.      @frame_count = Marshal.load(file)
  68.      @game_system = Marshal.load(file)
  69.      @game_switches = Marshal.load(file)
  70.      @game_variables = Marshal.load(file)
  71.      @total_sec = @frame_count / Graphics.frame_rate
  72.      file.close
  73.      for i in [email protected]
  74.        @sp_ch[i] = Sprite.new
  75.        @sp_ch[i].visible = true
  76.        testname = @characters[i][2].name+"_f"
  77.        @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  78.        @sp_ch[i].zoom_x = 0.8
  79.        @sp_ch[i].zoom_y = 0.8
  80.        @sp_ch[i].x = 180        
  81.        @sp_ch[i].y = 96 + i*90
  82.        @sp_ch[i].z = 101
  83.      end
  84.      # 描绘游戏时间
  85.      hour = @total_sec / 60 / 60
  86.      min = @total_sec / 60 % 60
  87.      sec = @total_sec % 60
  88.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  89.      self.contents.font.color = normal_color
  90.      self.contents.draw_text(4, 326, 420, 32, time_string, 2)
  91.      # 描绘时间标记
  92.      self.contents.font.color = normal_color
  93.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  94.      self.contents.draw_text(4, 356, 420, 32, time_string, 2)
  95.    else
  96.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  97.    end

  98. end
  99. def dispose
  100.    super
  101.    @sprite.dispose
  102.    @backsp.dispose
  103.    for i in @sp_ch
  104.      i.dispose
  105.    end
  106. end
  107. end


  108. class Window_File2 < Window_Base
  109. attr_accessor :index
  110. def initialize(index = 0)
  111.    @backsp = Sprite.new
  112.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  113.    @backsp.z = 100
  114.    super(160,0,480,480)
  115.    #这行可以不用
  116.    self.contents = Bitmap.new(width - 32, height - 32)
  117.    @index = index
  118.    #这里我要说明一句,之所以用sprite是为了放缩图片
  119.    @sprite = Sprite.new
  120.    @sprite.visible = false
  121.    @sprite.z = 100
  122.    @sp_ch = []
  123.    @sp_ch[0] = Sprite.new
  124.    refresh
  125. end
  126. def refresh
  127.    self.contents.clear
  128.    for i in @sp_ch
  129.      i.visible = false
  130.    end
  131.    @sprite.visible = false
  132.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  133.      @sprite.visible = true
  134.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  135.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  136.      else
  137.        self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  138.      end
  139.      @sprite.x = 290
  140.      @sprite.y = 32
  141.      @sprite.z = 998
  142.      @sprite.zoom_x = 0.5
  143.      @sprite.zoom_y = 0.5
  144.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  145.      @time_stamp = file.mtime
  146.      @characters = Marshal.load(file)
  147.      @frame_count = Marshal.load(file)
  148.      @game_system = Marshal.load(file)
  149.      @game_switches = Marshal.load(file)
  150.      @game_variables = Marshal.load(file)
  151.      @total_sec = @frame_count / Graphics.frame_rate
  152.      file.close
  153.      for i in [email protected]
  154.        @sp_ch[i] = Sprite.new
  155.        @sp_ch[i].visible = true
  156.        testname = @characters[i][2].name+"_f" #修改
  157.        @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  158.        @sp_ch[i].x = 180        
  159.        @sp_ch[i].y = 24 + i*110
  160.        @sp_ch[i].z = 101
  161.      end
  162.      # 描绘游戏时间
  163.      hour = @total_sec / 60 / 60
  164.      min = @total_sec / 60 % 60
  165.      sec = @total_sec % 60
  166.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  167.      self.contents.font.color = normal_color
  168.      self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  169.      # 描绘时间标记
  170.      self.contents.font.color = normal_color
  171.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  172.      self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  173.    else
  174.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  175.    end

  176. end
  177. def dispose
  178.    super
  179.    @sprite.dispose
  180.    @backsp.dispose
  181.    for i in @sp_ch
  182.      i.dispose
  183.    end
  184. end
  185. end



  186. $打开自动存档用的开关编号 = 999
  187. $自动存档位置 = 1
  188. $按下F5之后的自动存档的音效 = "Audio/SE/系统存档"
  189. $按下F5之后禁止存档时候的音效 = "Audio/Se/系统错误"
  190. DIR = "Save/"
  191. $打开自动存档开关之后调用的公共事件 = 0 #——默认未定义
  192. $按下F5之后可以存档调用的公共事件 = 0 #——默认未定义
  193. $按下F5之后禁止存档调用的公共事件 = 0 #——默认未定义
  194. class Scene_Map
  195. alias auto_update update
  196. def update
  197. auto_update
  198. #——按下F5的时候自动存档,可以修改为F5,F6,F7,F8,也可以修改成默认按键但是不推荐。
  199. #——注意在不可存档的时候是无效的
  200. if Input.trigger?(Input::F5)
  201.   unless $game_system.map_interpreter.running?
  202.   if $game_system.save_disabled
  203.     Audio.se_play($按下F5之后禁止存档时候的音效)
  204.     $game_temp.common_event_id = $按下F5之后禁止存档调用的公共事件
  205.   else
  206.     Audio.se_play($按下F5之后的自动存档的音效)
  207.     $game_temp.common_event_id = $按下F5之后可以存档调用的公共事件
  208.     auto_save
  209.   end
  210.   end
  211. end
  212. #——当BOSS战之前打开一下定义的开关,即可自动存档
  213. if $game_switches[$打开自动存档用的开关编号] == true
  214.   $game_switches[$打开自动存档用的开关编号] = false
  215.   $game_temp.common_event_id = $打开自动存档开关之后调用的公共事件
  216.   auto_save
  217. end
  218. end
  219. def auto_save
  220. #——这里定义了储存的文件,如果不希望用Save4可以自己修改编号
  221. # 写入存档数据
  222. Screen::shot
  223.     file = File.open( DIR+"Save#{$自动存档位置}.rxdata", "wb")
  224.     auto_save_data(file)
  225.     if FileTest.exist?( DIR+"shot.jpg")
  226.       File.rename( DIR+"shot.jpg", DIR+"Save#{$自动存档位置}.jpg")
  227.     end
  228.     file.close
  229. end
  230. def auto_save_data(file)
  231. #——以下定义内容和Scene_Save的write_save_data(file)完全一样
  232. #——如果你修改过该存档方法,不要忘记用你修改的覆盖这部分内容。
  233. # 生成描绘存档文件用的角色图形
  234. characters = []
  235. for i in 0...$game_party.actors.size
  236.   actor = $game_party.actors[i]
  237.   characters.push([actor.character_name, actor.character_hue, actor])
  238. end
  239. # 写入描绘存档文件用的角色数据
  240. Marshal.dump(characters, file)
  241. # 写入测量游戏时间用画面计数
  242. Marshal.dump(Graphics.frame_count, file)
  243. # 增加 1 次存档次数
  244. $game_system.save_count += 1
  245. # 保存魔法编号
  246. # (将编辑器保存的值以随机值替换)
  247. $game_system.magic_number = $data_system.magic_number
  248. # 写入各种游戏对像
  249. Marshal.dump($game_system, file)
  250. Marshal.dump($game_switches, file)
  251. Marshal.dump($game_variables, file)
  252. Marshal.dump($game_self_switches, file)
  253. Marshal.dump($game_screen, file)
  254. Marshal.dump($game_actors, file)
  255. Marshal.dump($game_party, file)
  256. Marshal.dump($game_troop, file)
  257. Marshal.dump($game_map, file)
  258. Marshal.dump($game_player, file)
  259. end
  260. end







  261. DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹


  262. module Screen  
  263. @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  264. @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l

  265. p), 'l'
  266. @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  267. module_function
  268. def shot(file = "shot", typ = 1)
  269.    # to add the right extension...
  270.    if typ == 0
  271.      typname = ".bmp"
  272.    elsif typ == 1
  273.      typname = ".jpg"
  274.    elsif typ == 2
  275.      typname = ".png"
  276.    end   
  277.    file_index = 0   
  278.    dir = "Save/"   
  279.    # make the filename....
  280.    file_name = dir + file.to_s + typname.to_s   
  281.    # make the screenshot.... Attention dont change anything from here on....
  282.    @screen.call(0,0,640,480,file_name,handel,typ)
  283. end
  284. # find the game window...
  285. def handel
  286.    game_name = "\0" * 256
  287.    @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  288.    game_name.delete!("\0")
  289.    return @findwindow.call('RGSS Player',game_name)
  290. end
  291. end


  292. class Scene_Menu
  293. alias shotsave_main main
  294. def main
  295.    if @menu_index == 0
  296.      Screen::shot
  297.    end   
  298.    shotsave_main
  299. end
  300. end

  301. class Interpreter
  302. #--------------------------------------------------------------------------
  303. # ● 调用存档画面
  304. #--------------------------------------------------------------------------
  305. def command_352
  306.    # 设置战斗中断标志
  307.    $game_temp.battle_abort = true
  308.    # 设置调用存档标志
  309.    $game_temp.save_calling = true
  310.    # 推进索引
  311.    @index += 1
  312.    # 结束
  313.    Screen::shot
  314.    return false
  315. end
  316. end

  317. #==============================================================================
  318. # ■ Scene_Load
  319. #------------------------------------------------------------------------------
  320. #  处理读档画面的类。
  321. #==============================================================================

  322. class Scene_Load
  323. #--------------------------------------------------------------------------
  324. # ● 初始化对像
  325. #--------------------------------------------------------------------------
  326. def initialize
  327.    # 再生成临时对像
  328.    $game_temp = Game_Temp.new
  329.    # 选择存档时间最新的文件
  330.    $game_temp.last_file_index = 0
  331.    latest_time = Time.at(0)
  332.    for i in 0..51
  333.      filename = DIR+"Save#{i}.rxdata"
  334.      if FileTest.exist?(filename)
  335.        file = File.open(filename, "r")
  336.        if file.mtime > latest_time
  337.          latest_time = file.mtime
  338.          $game_temp.last_file_index = i
  339.        end
  340.        file.close
  341.      end
  342.    end
  343. end  
  344. def main
  345.    @command_window = Window_Command.new(160,["自动存档","快速存档","进度二",
  346.    "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  347.    "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  348.    "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  349.    "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  350.    "进度二九","进度三十"])
  351.    @command_window.y = 0
  352.    @command_window.height = 480
  353.    @command_window.index = $game_temp.last_file_index
  354.    @content_window = Window_File2.new($game_temp.last_file_index)
  355.    # 执行过渡
  356.    Graphics.transition
  357.    # 主循环
  358.    loop do
  359.      # 刷新游戏画面
  360.      Graphics.update
  361.      # 刷新输入信息
  362.      Input.update
  363.      # 刷新画面
  364.      update
  365.      # 如果画面被切换的话就中断循环
  366.      if $scene != self
  367.        break
  368.      end
  369.    end
  370.    # 准备过渡
  371.    Graphics.freeze
  372.    @command_window.dispose
  373.    @content_window.dispose
  374. end
  375. def update
  376.    @command_window.update
  377.    if @command_window.index != @content_window.index
  378.      @content_window.index = @command_window.index
  379.      @content_window.refresh
  380.    end   
  381.    #——————下面这一部分是原装脚本——————#
  382.    if Input.trigger?(Input::B)  
  383.    # 演奏取消 SE
  384.    $game_system.se_play($data_system.cancel_se)
  385.    # 切换到标题画面
  386.    $scene = Scene_Title.new
  387.    end   
  388.    #———————————————————————#   
  389.    if Input.trigger?(Input::C)
  390.      # 文件不存在的情况下
  391.      unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  392.        # 演奏冻结 SE
  393.        $game_system.se_play($data_system.buzzer_se)
  394.        return
  395.      end
  396.      # 演奏读档 SE
  397.      $game_system.se_play($data_system.load_se)
  398.      # 写入存档数据
  399.      file = File.open(DIR+"Save#{@command_window.index}.rxdata",

  400. "rb")
  401.      read_save_data(file)
  402.      file.close
  403.      # 还原 BGM、BGS
  404.      $game_system.bgm_play($game_system.playing_bgm)
  405.      $game_system.bgs_play($game_system.playing_bgs)
  406.      # 刷新地图 (执行并行事件)
  407.      $game_map.update
  408.      # 切换到地图画面
  409.      $scene = Scene_Map.new
  410.    end
  411.    #———————————————————————#
  412. end
  413. #--------------------------------------------------------------------------
  414. # ● 写入存档数据
  415. #     file : 写入用文件对像 (已经打开)
  416. #--------------------------------------------------------------------------
  417. def read_save_data(file)
  418.    # 读取描绘存档文件用的角色数据
  419.    characters = Marshal.load(file)
  420.    # 读取测量游戏时间用画面计数
  421.    Graphics.frame_count = Marshal.load(file)
  422.    # 读取各种游戏对像
  423.    $game_system        = Marshal.load(file)
  424.    $game_switches      = Marshal.load(file)
  425.    $game_variables     = Marshal.load(file)
  426.    $game_self_switches = Marshal.load(file)
  427.    $game_screen        = Marshal.load(file)
  428.    $game_actors        = Marshal.load(file)
  429.    $game_party         = Marshal.load(file)
  430.    $game_troop         = Marshal.load(file)
  431.    $game_map           = Marshal.load(file)
  432.    $game_player        = Marshal.load(file)
  433.    # 魔法编号与保存时有差异的情况下
  434.    # (加入编辑器的编辑过的数据)
  435.    if $game_system.magic_number != $data_system.magic_number
  436.      # 重新装载地图
  437.      $game_map.setup($game_map.map_id)
  438.      $game_player.center($game_player.x, $game_player.y)
  439.    end
  440.    # 刷新同伴成员
  441.    $game_party.refresh
  442. end
  443. end

  444. #==============================================================================
  445. #  Window_LoadCommand
  446. #------------------------------------------------------------------------------
  447. #  存取档画面选择按钮窗口
  448. #==============================================================================

  449. class Window_LoadCommand < Window_Selectable
  450. #--------------------------------------------------------------------------
  451. #  初始化对象
  452. #--------------------------------------------------------------------------
  453. def initialize
  454. super(320, 0, 320, 64)
  455. self.contents = Bitmap.new(width - 32, height - 32)
  456. self.contents.font.color = normal_color
  457. @item_max = 2
  458. @column_max = 2
  459. @commands = ["读取", "存储"]
  460. refresh
  461. self.index = 0
  462. end
  463. #--------------------------------------------------------------------------
  464. #  刷新
  465. #--------------------------------------------------------------------------
  466. def refresh
  467. self.contents.clear
  468. for i in 0...@item_max
  469.    draw_item(i)
  470. end
  471. end
  472. #--------------------------------------------------------------------------
  473. #  描画按钮文字
  474. #--------------------------------------------------------------------------
  475. def draw_item(index)
  476. x = 4 + index * 160
  477. self.contents.draw_text(x, 0, 144, 32, @commands[index])
  478. end
  479. #--------------------------------------------------------------------------
  480. # ● 项目无效化
  481. #     index : 项目编号
  482. #--------------------------------------------------------------------------
  483. def disable_item(index)
  484.    draw_item(index, disabled_color)
  485. end

  486. end

  487. #==============================================================================
  488. #  Scene_Loadsave
  489. #------------------------------------------------------------------------------
  490. # 处理存取档画面的类。
  491. #==============================================================================

  492. class Scene_Loadsave
  493. #--------------------------------------------------------------------------
  494. # ● 初始化对像
  495. #     $last_savefile_index : 记录光标位置
  496. #--------------------------------------------------------------------------
  497. def initialize
  498.    $last_savefile_index = 0 if $last_savefile_index == nil
  499.    # 再生成临时对像
  500.    $game_temp = Game_Temp.new
  501.    # 选择存档时间最新的文件
  502.    $game_temp.last_file_index = 0
  503.    latest_time = Time.at(0)
  504.    for i in 0..51
  505.      filename =  DIR+"Save#{i}.rxdata"
  506.      if FileTest.exist?(filename)
  507.        file = File.open(filename, "r")
  508.        if file.mtime > latest_time
  509.          latest_time = file.mtime
  510.          $game_temp.last_file_index = i
  511.        end
  512.        file.close
  513.      end
  514.    end
  515. end
  516. #--------------------------------------------------------------------------
  517. #  主处理
  518. #--------------------------------------------------------------------------
  519. def main         

  520.    @savestate = 0
  521.    # 生成窗口
  522.    @help_window = Window_LoadHelp.new
  523.    @help_window.set_text("请选择.")
  524.    @option_window = Window_LoadCommand.new
  525.    @option_window.index = $last_savefile_index
  526.    ########################################################
  527.    @command_window = Window_Command.new(160,["自动存档","快速存档","进度二",
  528.      "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  529.      "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  530.      "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  531.      "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  532.      "进度二九","进度三十"])
  533.      @command_window.y = 64
  534.      @command_window.height = 416
  535.      @command_window.index = $game_temp.last_file_index
  536.      @content_window = Window_File.new($game_temp.last_file_index)
  537.      @command_window.active = false
  538.        ###############覆盖存档
  539.        @confirm_window = Window_Base.new(120, 188, 400, 64)
  540.        @confirm_window.contents = Bitmap.new(368, 32)

  541.        @confirm_window.contents.font.color = Color.new(255,255,255,255)

  542.        string = "确定要覆盖这个进度吗?"
  543.        @confirm_window.contents.font.name = "黑体"
  544.        @confirm_window.contents.font.size = 24
  545.        @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  546.        @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  547.        @confirm_window.z = 1500
  548.        @yes_no_window.index = 1
  549.        @yes_no_window.x = 270
  550.        @yes_no_window.y = 252
  551.        @yes_no_window.z = 1500
  552.        @confirm_window.visible = false
  553.        @yes_no_window.visible = false
  554.        @yes_no_window.active = false

  555.    # 执行过渡
  556.    Graphics.transition
  557.    # 主循环
  558.    loop do
  559.      # 刷新游戏画面
  560.      Graphics.update
  561.      # 刷新输入信息
  562.      Input.update
  563.      # 刷新画面
  564.      update
  565.      # 如果画面被切换的话就中断循环
  566.      if $scene != self
  567.        break
  568.      end
  569.    end
  570.    # 准备过渡
  571.    Graphics.freeze
  572.    # 释放窗口
  573.    @command_window.dispose
  574.    @content_window.dispose
  575.    @confirm_window.dispose
  576.    @yes_no_window.dispose
  577.    @help_window.dispose
  578.    @option_window.dispose
  579. end

  580. #--------------------------------------------------------------------------
  581. #  ● 刷新画面
  582. #--------------------------------------------------------------------------
  583. def update
  584.    # 刷新窗口
  585.    @help_window.update
  586.    @option_window.update
  587. #   @content_window.update
  588.    @command_window.update
  589.    if @yes_no_window.active
  590.        confirm_update
  591.        return
  592.    end
  593.    @content_window.index = @command_window.index
  594.    @content_window.refresh
  595.    case @savestate
  596.    when 0
  597.        if Input.trigger?(Input::B)
  598.        $game_system.se_play($data_system.cancel_se)
  599.        # 返回地图
  600.        if $menu_call == false
  601.        # 切换到地图画面
  602.        $scene = Scene_Map.new
  603.          return
  604.        end
  605.        # 切换到菜单画面
  606.        $menu_call = false
  607.        $scene = Scene_Menu.new(4)
  608.     end
  609.      if Input.trigger?(Input::C)
  610.        case @option_window.index
  611.        when 0
  612.          @command_window.active = true
  613.          @option_window.active = false
  614.          $game_system.se_play($data_system.decision_se)
  615.          @help_window.set_text("请选择一个文件进行读取.")
  616.          @savestate  = 1
  617.          return
  618.        when 1
  619.          @command_window.active = true
  620.          @option_window.active = false
  621.          $game_system.se_play($data_system.decision_se)
  622.          @help_window.set_text("请选择一个文件进行存储.")
  623.          @savestate = 2
  624.          
  625.          return
  626.        return
  627.        end
  628.      end
  629.    when 1,2
  630.      if Input.trigger?(Input::C)
  631.        if @savestate == 1
  632.          $menu_call = false
  633.          load_file
  634.          return
  635.        else
  636.          # 禁止存档的情况下
  637.          if $game_system.save_disabled
  638.            @help_window.set_text("抱歉,这里禁止存储.")
  639.            # 演奏冻结 SE
  640.            $game_system.se_play($data_system.buzzer_se)
  641.            return
  642.          end
  643.         $game_system.se_play($data_system.decision_se)
  644.         $last_savefile_index = @option_window.index

  645.         save_file
  646.          return
  647.        end
  648.      end
  649.      # 取消
  650.      if Input.trigger?(Input::B)
  651.        $game_system.se_play($data_system.cancel_se)
  652.        @command_window.active = false
  653.        @help_window.set_text("请选择.")
  654.        @savestate = 0
  655.        @option_window.active = true
  656.        return
  657.      end
  658.      
  659.      if Input.trigger?(Input::B)
  660.        $game_system.se_play($data_system.cancel_se)
  661.        @savestate = 2
  662.        @command_window.active = true

  663.        return
  664.      end
  665.    end
  666. end
  667. #--------------------------------------------------------------------------
  668. # 建立记录文件索引
  669. #--------------------------------------------------------------------------

  670. #--------------------------------------------------------------------------
  671. #  读取记录文件
  672. #     filename  : 被读取文件
  673. #--------------------------------------------------------------------------
  674. def load_file
  675.      # 文件不存在的情况下
  676.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  677.        # 演奏冻结 SE
  678.        $game_system.se_play($data_system.buzzer_se)
  679.        return
  680.      end
  681.      # 演奏读档 SE
  682.      $game_system.se_play($data_system.load_se)
  683.      # 写入存档数据
  684.      file = File.open( DIR+"Save#{@command_window.index}.rxdata", "rb")
  685.      read_save_data(file)
  686.      file.close
  687.      # 还原 BGM、BGS
  688.      $game_system.bgm_play($game_system.playing_bgm)
  689.      $game_system.bgs_play($game_system.playing_bgs)
  690.      # 刷新地图 (执行并行事件)
  691.      $game_map.update
  692.      # 切换到地图画面
  693.      $scene = Scene_Map.new
  694. end
  695. #--------------------------------------------------------------------------
  696. # ● 读取存档数据
  697. #     file : 读取用文件对像 (已经打开)
  698. #--------------------------------------------------------------------------
  699. def read_save_data(file)
  700.    # 读取描绘存档文件用的角色数据
  701.    characters = Marshal.load(file)
  702.    # 读取测量游戏时间用画面计数
  703.    Graphics.frame_count = Marshal.load(file)
  704.    # 读取各种游戏对像
  705.    $game_system        = Marshal.load(file)
  706.    $game_switches      = Marshal.load(file)
  707.    $game_variables     = Marshal.load(file)
  708.    $game_self_switches = Marshal.load(file)
  709.    $game_screen        = Marshal.load(file)
  710.    $game_actors        = Marshal.load(file)
  711.    $game_party         = Marshal.load(file)
  712.    $game_troop         = Marshal.load(file)
  713.    $game_map           = Marshal.load(file)
  714.    $game_player        = Marshal.load(file)
  715.    # 魔法编号与保存时有差异的情况下
  716.    # (加入编辑器的编辑过的数据)
  717.    if $game_system.magic_number != $data_system.magic_number
  718.      # 重新装载地图
  719.      $game_map.setup($game_map.map_id)
  720.      $game_player.center($game_player.x, $game_player.y)
  721.    end
  722.    # 刷新同伴成员
  723.    $game_party.refresh
  724. end
  725. #--------------------------------------------------------------------------
  726. # ● 写入存档文件
  727. #--------------------------------------------------------------------------
  728. def save_file
  729.    if Input.trigger?(Input::C)
  730.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  731.        # 演奏冻结 SE
  732.        # 演奏存档 SE
  733.          $game_system.se_play($data_system.save_se)
  734.          # 写入存档数据
  735.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  736.          write_save_data(file)
  737.          if FileTest.exist?( DIR+"shot.jpg")
  738.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  739.          end
  740.          file.close
  741.          $game_temp.last_file_index = @command_window.index
  742.          # 如果被事件调用
  743.          if $game_temp.save_calling
  744.            # 清除存档调用标志
  745.            $game_temp.save_calling = false
  746.            @confirm_window.dispose
  747.            # 切换到地图画面
  748.            $scene = Scene_Map.new   
  749.            return
  750.          end
  751.        # 切换到菜单画面
  752.          $scene = Scene_Map.new  
  753.      end
  754.      @yes_no_window.active = true
  755.      @command_window.active = false            
  756.    end
  757.    #———————————————————————#     
  758. end
  759. #-------------------------------------------------------------------
  760. def confirm_update
  761.    @command_index = @command_window.index
  762.    @confirm_window.visible = true
  763.    @confirm_window.z = 1500
  764.    @yes_no_window.visible = true
  765.    @yes_no_window.active = true
  766.    @yes_no_window.z = 1500
  767.    @yes_no_window.update
  768.    if Input.trigger?(Input::C)
  769.      if @yes_no_window.index == 0
  770.          #######################################################
  771.          # 演奏存档 SE
  772.          $game_system.se_play($data_system.save_se)
  773.          # 写入存档数据
  774.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  775.          write_save_data(file)
  776.          if FileTest.exist?( DIR+"shot.jpg")
  777.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  778.          end
  779.          file.close
  780.          $game_temp.last_file_index = @command_window.index
  781.          # 如果被事件调用
  782.          if $game_temp.save_calling
  783.            # 清除存档调用标志
  784.            $game_temp.save_calling = false
  785.            @confirm_window.dispose
  786.            @content_window.dispose
  787.            # 切换到地图画面
  788.            $scene = Scene_Map.new
  789.    
  790.            return
  791.          end
  792.        # 切换到菜单画面
  793.          $scene = Scene_Map.new        
  794.        else
  795.        @yes_no_window.visible = false
  796.        @confirm_window.visible = false
  797.        $game_system.se_play($data_system.cancel_se)
  798.        @yes_no_window.active = false
  799.        @command_window.active = true
  800.        end
  801.    end
  802.    if Input.trigger?(Input::B)
  803.      @yes_no_window.visible = false
  804.      @confirm_window.visible = false
  805.      $game_system.se_play($data_system.cancel_se)
  806.      @yes_no_window.active = false
  807.      @command_window.active = true
  808.    end
  809. end
  810. #--------------------------------------------------------------------------
  811. # ● 写入存档数据
  812. #     file : 写入用文件对像 (已经打开)
  813. #--------------------------------------------------------------------------
  814. def write_save_data(file)
  815.    # 生成描绘存档文件用的角色图形
  816.    characters = []
  817.    for i in 0...$game_party.actors.size
  818.      actor = $game_party.actors[i]
  819.      characters.push([actor.character_name, actor.character_hue, actor])
  820.    end
  821.    # 写入描绘存档文件用的角色数据
  822.    Marshal.dump(characters, file)
  823.    # 写入测量游戏时间用画面计数
  824.    Marshal.dump(Graphics.frame_count, file)
  825.    # 增加 1 次存档次数
  826.    $game_system.save_count += 1
  827.    # 保存魔法编号
  828.    # (将编辑器保存的值以随机值替换)
  829.    $game_system.magic_number = $data_system.magic_number
  830.    # 写入各种游戏对像
  831.    Marshal.dump($game_system, file)
  832.    Marshal.dump($game_switches, file)
  833.    Marshal.dump($game_variables, file)
  834.    Marshal.dump($game_self_switches, file)
  835.    Marshal.dump($game_screen, file)
  836.    Marshal.dump($game_actors, file)
  837.    Marshal.dump($game_party, file)
  838.    Marshal.dump($game_troop, file)
  839.    Marshal.dump($game_map, file)
  840.    Marshal.dump($game_player, file)
  841. end
  842. end

  843. #==============================================================================
  844. # ■ Window_LoadHelp
  845. #------------------------------------------------------------------------------
  846. #  存取档画面帮助信息的显示窗口。
  847. #==============================================================================

  848. class Window_LoadHelp < Window_Base
  849. #--------------------------------------------------------------------------
  850. #  初始化对象
  851. #--------------------------------------------------------------------------
  852. def initialize
  853. super(0, 0, 320, 64)
  854. self.contents = Bitmap.new(width - 32, height - 32)
  855. end
  856. #--------------------------------------------------------------------------
  857. #  刷新文本
  858. #--------------------------------------------------------------------------
  859. def set_text(text, align = 1)
  860. if text != @text or align != @align
  861.    self.contents.clear
  862.    self.contents.font.color = normal_color
  863.    self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  864.    @text = text
  865.    @align = align
  866.    @actor = nil
  867. end
  868. self.visible = true
  869. end
  870. end
复制代码
截图存取档脚本和以下脚本错误

作者: cZooCz    时间: 2008-1-11 02:33
标题: 脚本BUG高手看下
  1. ###使用说明
  2. #使用前请复制sceneshot.dll到游戏文件下,并新建文件夹Save
  3. #将此文本插入main前面
  4. #游戏前显示头像的文件名为:人物角色名_f,请自行建立几张做测试,不然找不到图片会报错
  5. #自动存档按钮F5 存入档位0(也就是自动存档那栏)
  6. #使用前,请在菜单脚本:scene_menu里面,
  7. #     when 4 # 存档
  8. #     # 禁止存档的情况下
  9. #     if $game_system.save_disabled
  10. #       # 演奏冻结 SE
  11. #       $game_system.se_play($data_system.buzzer_se)
  12. #       return
  13. #     end
  14. #     # 演奏确定 SE
  15. #     $game_system.se_play($data_system.decision_se)
  16. #     # 切换到存档画面
  17. #     $scene = Scene_Save.new <--这行
  18. #替换为:   $scene = Scene_Loadsave.new
  19. #另,在原scene_title里,48行左右
  20. #    for i in 0..3
  21. #          for i in 0..3
  22. #     if FileTest.exist?("Save#{i+1}.rxdata")
  23. ###################改成if FileTest.exist?("Save/Save#{i+1}.rxdata")
  24. #        @continue_enabled = true
  25. #      end
  26. #    end
  27. #否则继续游戏时会检测不到存档

  28. class Window_File < Window_Base
  29. attr_accessor :index
  30. def initialize(index = 0)
  31.    @backsp = Sprite.new
  32.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  33.    @backsp.z = 100
  34.    super(160,64,480,416)
  35.    #这行可以不用
  36.    self.contents = Bitmap.new(width - 32, height - 32)
  37.    @index = index
  38.    #这里我要说明一句,之所以用sprite是为了放缩图片
  39.    @sprite = Sprite.new
  40.    @sprite.visible = false
  41.    @sprite.z = 100
  42.    @sp_ch = []
  43.    @sp_ch[0] = Sprite.new
  44.    refresh
  45. end
  46. def refresh
  47.    self.contents.clear
  48.    for i in @sp_ch
  49.      i.visible = false
  50.    end
  51.    @sprite.visible = false
  52.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  53.      @sprite.visible = true
  54.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  55.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  56.      else
  57.        self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  58.      end
  59.      @sprite.x = 290
  60.      @sprite.y = 96
  61.      @sprite.z = 998
  62.      @sprite.zoom_x = 0.5
  63.      @sprite.zoom_y = 0.5
  64.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  65.      @time_stamp = file.mtime
  66.      @characters = Marshal.load(file)
  67.      @frame_count = Marshal.load(file)
  68.      @game_system = Marshal.load(file)
  69.      @game_switches = Marshal.load(file)
  70.      @game_variables = Marshal.load(file)
  71.      @total_sec = @frame_count / Graphics.frame_rate
  72.      file.close
  73.      for i in [email protected]
  74.        @sp_ch[i] = Sprite.new
  75.        @sp_ch[i].visible = true
  76.        testname = @characters[i][2].name+"_f"
  77.        @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  78.        @sp_ch[i].zoom_x = 0.8
  79.        @sp_ch[i].zoom_y = 0.8
  80.        @sp_ch[i].x = 180        
  81.        @sp_ch[i].y = 96 + i*90
  82.        @sp_ch[i].z = 101
  83.      end
  84.      # 描绘游戏时间
  85.      hour = @total_sec / 60 / 60
  86.      min = @total_sec / 60 % 60
  87.      sec = @total_sec % 60
  88.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  89.      self.contents.font.color = normal_color
  90.      self.contents.draw_text(4, 326, 420, 32, time_string, 2)
  91.      # 描绘时间标记
  92.      self.contents.font.color = normal_color
  93.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  94.      self.contents.draw_text(4, 356, 420, 32, time_string, 2)
  95.    else
  96.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  97.    end

  98. end
  99. def dispose
  100.    super
  101.    @sprite.dispose
  102.    @backsp.dispose
  103.    for i in @sp_ch
  104.      i.dispose
  105.    end
  106. end
  107. end


  108. class Window_File2 < Window_Base
  109. attr_accessor :index
  110. def initialize(index = 0)
  111.    @backsp = Sprite.new
  112.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  113.    @backsp.z = 100
  114.    super(160,0,480,480)
  115.    #这行可以不用
  116.    self.contents = Bitmap.new(width - 32, height - 32)
  117.    @index = index
  118.    #这里我要说明一句,之所以用sprite是为了放缩图片
  119.    @sprite = Sprite.new
  120.    @sprite.visible = false
  121.    @sprite.z = 100
  122.    @sp_ch = []
  123.    @sp_ch[0] = Sprite.new
  124.    refresh
  125. end
  126. def refresh
  127.    self.contents.clear
  128.    for i in @sp_ch
  129.      i.visible = false
  130.    end
  131.    @sprite.visible = false
  132.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  133.      @sprite.visible = true
  134.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  135.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  136.      else
  137.        self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  138.      end
  139.      @sprite.x = 290
  140.      @sprite.y = 32
  141.      @sprite.z = 998
  142.      @sprite.zoom_x = 0.5
  143.      @sprite.zoom_y = 0.5
  144.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  145.      @time_stamp = file.mtime
  146.      @characters = Marshal.load(file)
  147.      @frame_count = Marshal.load(file)
  148.      @game_system = Marshal.load(file)
  149.      @game_switches = Marshal.load(file)
  150.      @game_variables = Marshal.load(file)
  151.      @total_sec = @frame_count / Graphics.frame_rate
  152.      file.close
  153.      for i in [email protected]
  154.        @sp_ch[i] = Sprite.new
  155.        @sp_ch[i].visible = true
  156.        testname = @characters[i][2].name+"_f" #修改
  157.        @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  158.        @sp_ch[i].x = 180        
  159.        @sp_ch[i].y = 24 + i*110
  160.        @sp_ch[i].z = 101
  161.      end
  162.      # 描绘游戏时间
  163.      hour = @total_sec / 60 / 60
  164.      min = @total_sec / 60 % 60
  165.      sec = @total_sec % 60
  166.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  167.      self.contents.font.color = normal_color
  168.      self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  169.      # 描绘时间标记
  170.      self.contents.font.color = normal_color
  171.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  172.      self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  173.    else
  174.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  175.    end

  176. end
  177. def dispose
  178.    super
  179.    @sprite.dispose
  180.    @backsp.dispose
  181.    for i in @sp_ch
  182.      i.dispose
  183.    end
  184. end
  185. end



  186. $打开自动存档用的开关编号 = 999
  187. $自动存档位置 = 1
  188. $按下F5之后的自动存档的音效 = "Audio/SE/系统存档"
  189. $按下F5之后禁止存档时候的音效 = "Audio/Se/系统错误"
  190. DIR = "Save/"
  191. $打开自动存档开关之后调用的公共事件 = 0 #——默认未定义
  192. $按下F5之后可以存档调用的公共事件 = 0 #——默认未定义
  193. $按下F5之后禁止存档调用的公共事件 = 0 #——默认未定义
  194. class Scene_Map
  195. alias auto_update update
  196. def update
  197. auto_update
  198. #——按下F5的时候自动存档,可以修改为F5,F6,F7,F8,也可以修改成默认按键但是不推荐。
  199. #——注意在不可存档的时候是无效的
  200. if Input.trigger?(Input::F5)
  201.   unless $game_system.map_interpreter.running?
  202.   if $game_system.save_disabled
  203.     Audio.se_play($按下F5之后禁止存档时候的音效)
  204.     $game_temp.common_event_id = $按下F5之后禁止存档调用的公共事件
  205.   else
  206.     Audio.se_play($按下F5之后的自动存档的音效)
  207.     $game_temp.common_event_id = $按下F5之后可以存档调用的公共事件
  208.     auto_save
  209.   end
  210.   end
  211. end
  212. #——当BOSS战之前打开一下定义的开关,即可自动存档
  213. if $game_switches[$打开自动存档用的开关编号] == true
  214.   $game_switches[$打开自动存档用的开关编号] = false
  215.   $game_temp.common_event_id = $打开自动存档开关之后调用的公共事件
  216.   auto_save
  217. end
  218. end
  219. def auto_save
  220. #——这里定义了储存的文件,如果不希望用Save4可以自己修改编号
  221. # 写入存档数据
  222. Screen::shot
  223.     file = File.open( DIR+"Save#{$自动存档位置}.rxdata", "wb")
  224.     auto_save_data(file)
  225.     if FileTest.exist?( DIR+"shot.jpg")
  226.       File.rename( DIR+"shot.jpg", DIR+"Save#{$自动存档位置}.jpg")
  227.     end
  228.     file.close
  229. end
  230. def auto_save_data(file)
  231. #——以下定义内容和Scene_Save的write_save_data(file)完全一样
  232. #——如果你修改过该存档方法,不要忘记用你修改的覆盖这部分内容。
  233. # 生成描绘存档文件用的角色图形
  234. characters = []
  235. for i in 0...$game_party.actors.size
  236.   actor = $game_party.actors[i]
  237.   characters.push([actor.character_name, actor.character_hue, actor])
  238. end
  239. # 写入描绘存档文件用的角色数据
  240. Marshal.dump(characters, file)
  241. # 写入测量游戏时间用画面计数
  242. Marshal.dump(Graphics.frame_count, file)
  243. # 增加 1 次存档次数
  244. $game_system.save_count += 1
  245. # 保存魔法编号
  246. # (将编辑器保存的值以随机值替换)
  247. $game_system.magic_number = $data_system.magic_number
  248. # 写入各种游戏对像
  249. Marshal.dump($game_system, file)
  250. Marshal.dump($game_switches, file)
  251. Marshal.dump($game_variables, file)
  252. Marshal.dump($game_self_switches, file)
  253. Marshal.dump($game_screen, file)
  254. Marshal.dump($game_actors, file)
  255. Marshal.dump($game_party, file)
  256. Marshal.dump($game_troop, file)
  257. Marshal.dump($game_map, file)
  258. Marshal.dump($game_player, file)
  259. end
  260. end







  261. DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹


  262. module Screen  
  263. @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  264. @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l

  265. p), 'l'
  266. @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  267. module_function
  268. def shot(file = "shot", typ = 1)
  269.    # to add the right extension...
  270.    if typ == 0
  271.      typname = ".bmp"
  272.    elsif typ == 1
  273.      typname = ".jpg"
  274.    elsif typ == 2
  275.      typname = ".png"
  276.    end   
  277.    file_index = 0   
  278.    dir = "Save/"   
  279.    # make the filename....
  280.    file_name = dir + file.to_s + typname.to_s   
  281.    # make the screenshot.... Attention dont change anything from here on....
  282.    @screen.call(0,0,640,480,file_name,handel,typ)
  283. end
  284. # find the game window...
  285. def handel
  286.    game_name = "\0" * 256
  287.    @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  288.    game_name.delete!("\0")
  289.    return @findwindow.call('RGSS Player',game_name)
  290. end
  291. end


  292. class Scene_Menu
  293. alias shotsave_main main
  294. def main
  295.    if @menu_index == 0
  296.      Screen::shot
  297.    end   
  298.    shotsave_main
  299. end
  300. end

  301. class Interpreter
  302. #--------------------------------------------------------------------------
  303. # ● 调用存档画面
  304. #--------------------------------------------------------------------------
  305. def command_352
  306.    # 设置战斗中断标志
  307.    $game_temp.battle_abort = true
  308.    # 设置调用存档标志
  309.    $game_temp.save_calling = true
  310.    # 推进索引
  311.    @index += 1
  312.    # 结束
  313.    Screen::shot
  314.    return false
  315. end
  316. end

  317. #==============================================================================
  318. # ■ Scene_Load
  319. #------------------------------------------------------------------------------
  320. #  处理读档画面的类。
  321. #==============================================================================

  322. class Scene_Load
  323. #--------------------------------------------------------------------------
  324. # ● 初始化对像
  325. #--------------------------------------------------------------------------
  326. def initialize
  327.    # 再生成临时对像
  328.    $game_temp = Game_Temp.new
  329.    # 选择存档时间最新的文件
  330.    $game_temp.last_file_index = 0
  331.    latest_time = Time.at(0)
  332.    for i in 0..51
  333.      filename = DIR+"Save#{i}.rxdata"
  334.      if FileTest.exist?(filename)
  335.        file = File.open(filename, "r")
  336.        if file.mtime > latest_time
  337.          latest_time = file.mtime
  338.          $game_temp.last_file_index = i
  339.        end
  340.        file.close
  341.      end
  342.    end
  343. end  
  344. def main
  345.    @command_window = Window_Command.new(160,["自动存档","快速存档","进度二",
  346.    "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  347.    "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  348.    "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  349.    "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  350.    "进度二九","进度三十"])
  351.    @command_window.y = 0
  352.    @command_window.height = 480
  353.    @command_window.index = $game_temp.last_file_index
  354.    @content_window = Window_File2.new($game_temp.last_file_index)
  355.    # 执行过渡
  356.    Graphics.transition
  357.    # 主循环
  358.    loop do
  359.      # 刷新游戏画面
  360.      Graphics.update
  361.      # 刷新输入信息
  362.      Input.update
  363.      # 刷新画面
  364.      update
  365.      # 如果画面被切换的话就中断循环
  366.      if $scene != self
  367.        break
  368.      end
  369.    end
  370.    # 准备过渡
  371.    Graphics.freeze
  372.    @command_window.dispose
  373.    @content_window.dispose
  374. end
  375. def update
  376.    @command_window.update
  377.    if @command_window.index != @content_window.index
  378.      @content_window.index = @command_window.index
  379.      @content_window.refresh
  380.    end   
  381.    #——————下面这一部分是原装脚本——————#
  382.    if Input.trigger?(Input::B)  
  383.    # 演奏取消 SE
  384.    $game_system.se_play($data_system.cancel_se)
  385.    # 切换到标题画面
  386.    $scene = Scene_Title.new
  387.    end   
  388.    #———————————————————————#   
  389.    if Input.trigger?(Input::C)
  390.      # 文件不存在的情况下
  391.      unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  392.        # 演奏冻结 SE
  393.        $game_system.se_play($data_system.buzzer_se)
  394.        return
  395.      end
  396.      # 演奏读档 SE
  397.      $game_system.se_play($data_system.load_se)
  398.      # 写入存档数据
  399.      file = File.open(DIR+"Save#{@command_window.index}.rxdata",

  400. "rb")
  401.      read_save_data(file)
  402.      file.close
  403.      # 还原 BGM、BGS
  404.      $game_system.bgm_play($game_system.playing_bgm)
  405.      $game_system.bgs_play($game_system.playing_bgs)
  406.      # 刷新地图 (执行并行事件)
  407.      $game_map.update
  408.      # 切换到地图画面
  409.      $scene = Scene_Map.new
  410.    end
  411.    #———————————————————————#
  412. end
  413. #--------------------------------------------------------------------------
  414. # ● 写入存档数据
  415. #     file : 写入用文件对像 (已经打开)
  416. #--------------------------------------------------------------------------
  417. def read_save_data(file)
  418.    # 读取描绘存档文件用的角色数据
  419.    characters = Marshal.load(file)
  420.    # 读取测量游戏时间用画面计数
  421.    Graphics.frame_count = Marshal.load(file)
  422.    # 读取各种游戏对像
  423.    $game_system        = Marshal.load(file)
  424.    $game_switches      = Marshal.load(file)
  425.    $game_variables     = Marshal.load(file)
  426.    $game_self_switches = Marshal.load(file)
  427.    $game_screen        = Marshal.load(file)
  428.    $game_actors        = Marshal.load(file)
  429.    $game_party         = Marshal.load(file)
  430.    $game_troop         = Marshal.load(file)
  431.    $game_map           = Marshal.load(file)
  432.    $game_player        = Marshal.load(file)
  433.    # 魔法编号与保存时有差异的情况下
  434.    # (加入编辑器的编辑过的数据)
  435.    if $game_system.magic_number != $data_system.magic_number
  436.      # 重新装载地图
  437.      $game_map.setup($game_map.map_id)
  438.      $game_player.center($game_player.x, $game_player.y)
  439.    end
  440.    # 刷新同伴成员
  441.    $game_party.refresh
  442. end
  443. end

  444. #==============================================================================
  445. #  Window_LoadCommand
  446. #------------------------------------------------------------------------------
  447. #  存取档画面选择按钮窗口
  448. #==============================================================================

  449. class Window_LoadCommand < Window_Selectable
  450. #--------------------------------------------------------------------------
  451. #  初始化对象
  452. #--------------------------------------------------------------------------
  453. def initialize
  454. super(320, 0, 320, 64)
  455. self.contents = Bitmap.new(width - 32, height - 32)
  456. self.contents.font.color = normal_color
  457. @item_max = 2
  458. @column_max = 2
  459. @commands = ["读取", "存储"]
  460. refresh
  461. self.index = 0
  462. end
  463. #--------------------------------------------------------------------------
  464. #  刷新
  465. #--------------------------------------------------------------------------
  466. def refresh
  467. self.contents.clear
  468. for i in 0...@item_max
  469.    draw_item(i)
  470. end
  471. end
  472. #--------------------------------------------------------------------------
  473. #  描画按钮文字
  474. #--------------------------------------------------------------------------
  475. def draw_item(index)
  476. x = 4 + index * 160
  477. self.contents.draw_text(x, 0, 144, 32, @commands[index])
  478. end
  479. #--------------------------------------------------------------------------
  480. # ● 项目无效化
  481. #     index : 项目编号
  482. #--------------------------------------------------------------------------
  483. def disable_item(index)
  484.    draw_item(index, disabled_color)
  485. end

  486. end

  487. #==============================================================================
  488. #  Scene_Loadsave
  489. #------------------------------------------------------------------------------
  490. # 处理存取档画面的类。
  491. #==============================================================================

  492. class Scene_Loadsave
  493. #--------------------------------------------------------------------------
  494. # ● 初始化对像
  495. #     $last_savefile_index : 记录光标位置
  496. #--------------------------------------------------------------------------
  497. def initialize
  498.    $last_savefile_index = 0 if $last_savefile_index == nil
  499.    # 再生成临时对像
  500.    $game_temp = Game_Temp.new
  501.    # 选择存档时间最新的文件
  502.    $game_temp.last_file_index = 0
  503.    latest_time = Time.at(0)
  504.    for i in 0..51
  505.      filename =  DIR+"Save#{i}.rxdata"
  506.      if FileTest.exist?(filename)
  507.        file = File.open(filename, "r")
  508.        if file.mtime > latest_time
  509.          latest_time = file.mtime
  510.          $game_temp.last_file_index = i
  511.        end
  512.        file.close
  513.      end
  514.    end
  515. end
  516. #--------------------------------------------------------------------------
  517. #  主处理
  518. #--------------------------------------------------------------------------
  519. def main         

  520.    @savestate = 0
  521.    # 生成窗口
  522.    @help_window = Window_LoadHelp.new
  523.    @help_window.set_text("请选择.")
  524.    @option_window = Window_LoadCommand.new
  525.    @option_window.index = $last_savefile_index
  526.    ########################################################
  527.    @command_window = Window_Command.new(160,["自动存档","快速存档","进度二",
  528.      "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  529.      "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  530.      "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  531.      "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  532.      "进度二九","进度三十"])
  533.      @command_window.y = 64
  534.      @command_window.height = 416
  535.      @command_window.index = $game_temp.last_file_index
  536.      @content_window = Window_File.new($game_temp.last_file_index)
  537.      @command_window.active = false
  538.        ###############覆盖存档
  539.        @confirm_window = Window_Base.new(120, 188, 400, 64)
  540.        @confirm_window.contents = Bitmap.new(368, 32)

  541.        @confirm_window.contents.font.color = Color.new(255,255,255,255)

  542.        string = "确定要覆盖这个进度吗?"
  543.        @confirm_window.contents.font.name = "黑体"
  544.        @confirm_window.contents.font.size = 24
  545.        @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  546.        @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  547.        @confirm_window.z = 1500
  548.        @yes_no_window.index = 1
  549.        @yes_no_window.x = 270
  550.        @yes_no_window.y = 252
  551.        @yes_no_window.z = 1500
  552.        @confirm_window.visible = false
  553.        @yes_no_window.visible = false
  554.        @yes_no_window.active = false

  555.    # 执行过渡
  556.    Graphics.transition
  557.    # 主循环
  558.    loop do
  559.      # 刷新游戏画面
  560.      Graphics.update
  561.      # 刷新输入信息
  562.      Input.update
  563.      # 刷新画面
  564.      update
  565.      # 如果画面被切换的话就中断循环
  566.      if $scene != self
  567.        break
  568.      end
  569.    end
  570.    # 准备过渡
  571.    Graphics.freeze
  572.    # 释放窗口
  573.    @command_window.dispose
  574.    @content_window.dispose
  575.    @confirm_window.dispose
  576.    @yes_no_window.dispose
  577.    @help_window.dispose
  578.    @option_window.dispose
  579. end

  580. #--------------------------------------------------------------------------
  581. #  ● 刷新画面
  582. #--------------------------------------------------------------------------
  583. def update
  584.    # 刷新窗口
  585.    @help_window.update
  586.    @option_window.update
  587. #   @content_window.update
  588.    @command_window.update
  589.    if @yes_no_window.active
  590.        confirm_update
  591.        return
  592.    end
  593.    @content_window.index = @command_window.index
  594.    @content_window.refresh
  595.    case @savestate
  596.    when 0
  597.        if Input.trigger?(Input::B)
  598.        $game_system.se_play($data_system.cancel_se)
  599.        # 返回地图
  600.        if $menu_call == false
  601.        # 切换到地图画面
  602.        $scene = Scene_Map.new
  603.          return
  604.        end
  605.        # 切换到菜单画面
  606.        $menu_call = false
  607.        $scene = Scene_Menu.new(4)
  608.     end
  609.      if Input.trigger?(Input::C)
  610.        case @option_window.index
  611.        when 0
  612.          @command_window.active = true
  613.          @option_window.active = false
  614.          $game_system.se_play($data_system.decision_se)
  615.          @help_window.set_text("请选择一个文件进行读取.")
  616.          @savestate  = 1
  617.          return
  618.        when 1
  619.          @command_window.active = true
  620.          @option_window.active = false
  621.          $game_system.se_play($data_system.decision_se)
  622.          @help_window.set_text("请选择一个文件进行存储.")
  623.          @savestate = 2
  624.          
  625.          return
  626.        return
  627.        end
  628.      end
  629.    when 1,2
  630.      if Input.trigger?(Input::C)
  631.        if @savestate == 1
  632.          $menu_call = false
  633.          load_file
  634.          return
  635.        else
  636.          # 禁止存档的情况下
  637.          if $game_system.save_disabled
  638.            @help_window.set_text("抱歉,这里禁止存储.")
  639.            # 演奏冻结 SE
  640.            $game_system.se_play($data_system.buzzer_se)
  641.            return
  642.          end
  643.         $game_system.se_play($data_system.decision_se)
  644.         $last_savefile_index = @option_window.index

  645.         save_file
  646.          return
  647.        end
  648.      end
  649.      # 取消
  650.      if Input.trigger?(Input::B)
  651.        $game_system.se_play($data_system.cancel_se)
  652.        @command_window.active = false
  653.        @help_window.set_text("请选择.")
  654.        @savestate = 0
  655.        @option_window.active = true
  656.        return
  657.      end
  658.      
  659.      if Input.trigger?(Input::B)
  660.        $game_system.se_play($data_system.cancel_se)
  661.        @savestate = 2
  662.        @command_window.active = true

  663.        return
  664.      end
  665.    end
  666. end
  667. #--------------------------------------------------------------------------
  668. # 建立记录文件索引
  669. #--------------------------------------------------------------------------

  670. #--------------------------------------------------------------------------
  671. #  读取记录文件
  672. #     filename  : 被读取文件
  673. #--------------------------------------------------------------------------
  674. def load_file
  675.      # 文件不存在的情况下
  676.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  677.        # 演奏冻结 SE
  678.        $game_system.se_play($data_system.buzzer_se)
  679.        return
  680.      end
  681.      # 演奏读档 SE
  682.      $game_system.se_play($data_system.load_se)
  683.      # 写入存档数据
  684.      file = File.open( DIR+"Save#{@command_window.index}.rxdata", "rb")
  685.      read_save_data(file)
  686.      file.close
  687.      # 还原 BGM、BGS
  688.      $game_system.bgm_play($game_system.playing_bgm)
  689.      $game_system.bgs_play($game_system.playing_bgs)
  690.      # 刷新地图 (执行并行事件)
  691.      $game_map.update
  692.      # 切换到地图画面
  693.      $scene = Scene_Map.new
  694. end
  695. #--------------------------------------------------------------------------
  696. # ● 读取存档数据
  697. #     file : 读取用文件对像 (已经打开)
  698. #--------------------------------------------------------------------------
  699. def read_save_data(file)
  700.    # 读取描绘存档文件用的角色数据
  701.    characters = Marshal.load(file)
  702.    # 读取测量游戏时间用画面计数
  703.    Graphics.frame_count = Marshal.load(file)
  704.    # 读取各种游戏对像
  705.    $game_system        = Marshal.load(file)
  706.    $game_switches      = Marshal.load(file)
  707.    $game_variables     = Marshal.load(file)
  708.    $game_self_switches = Marshal.load(file)
  709.    $game_screen        = Marshal.load(file)
  710.    $game_actors        = Marshal.load(file)
  711.    $game_party         = Marshal.load(file)
  712.    $game_troop         = Marshal.load(file)
  713.    $game_map           = Marshal.load(file)
  714.    $game_player        = Marshal.load(file)
  715.    # 魔法编号与保存时有差异的情况下
  716.    # (加入编辑器的编辑过的数据)
  717.    if $game_system.magic_number != $data_system.magic_number
  718.      # 重新装载地图
  719.      $game_map.setup($game_map.map_id)
  720.      $game_player.center($game_player.x, $game_player.y)
  721.    end
  722.    # 刷新同伴成员
  723.    $game_party.refresh
  724. end
  725. #--------------------------------------------------------------------------
  726. # ● 写入存档文件
  727. #--------------------------------------------------------------------------
  728. def save_file
  729.    if Input.trigger?(Input::C)
  730.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  731.        # 演奏冻结 SE
  732.        # 演奏存档 SE
  733.          $game_system.se_play($data_system.save_se)
  734.          # 写入存档数据
  735.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  736.          write_save_data(file)
  737.          if FileTest.exist?( DIR+"shot.jpg")
  738.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  739.          end
  740.          file.close
  741.          $game_temp.last_file_index = @command_window.index
  742.          # 如果被事件调用
  743.          if $game_temp.save_calling
  744.            # 清除存档调用标志
  745.            $game_temp.save_calling = false
  746.            @confirm_window.dispose
  747.            # 切换到地图画面
  748.            $scene = Scene_Map.new   
  749.            return
  750.          end
  751.        # 切换到菜单画面
  752.          $scene = Scene_Map.new  
  753.      end
  754.      @yes_no_window.active = true
  755.      @command_window.active = false            
  756.    end
  757.    #———————————————————————#     
  758. end
  759. #-------------------------------------------------------------------
  760. def confirm_update
  761.    @command_index = @command_window.index
  762.    @confirm_window.visible = true
  763.    @confirm_window.z = 1500
  764.    @yes_no_window.visible = true
  765.    @yes_no_window.active = true
  766.    @yes_no_window.z = 1500
  767.    @yes_no_window.update
  768.    if Input.trigger?(Input::C)
  769.      if @yes_no_window.index == 0
  770.          #######################################################
  771.          # 演奏存档 SE
  772.          $game_system.se_play($data_system.save_se)
  773.          # 写入存档数据
  774.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  775.          write_save_data(file)
  776.          if FileTest.exist?( DIR+"shot.jpg")
  777.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  778.          end
  779.          file.close
  780.          $game_temp.last_file_index = @command_window.index
  781.          # 如果被事件调用
  782.          if $game_temp.save_calling
  783.            # 清除存档调用标志
  784.            $game_temp.save_calling = false
  785.            @confirm_window.dispose
  786.            @content_window.dispose
  787.            # 切换到地图画面
  788.            $scene = Scene_Map.new
  789.    
  790.            return
  791.          end
  792.        # 切换到菜单画面
  793.          $scene = Scene_Map.new        
  794.        else
  795.        @yes_no_window.visible = false
  796.        @confirm_window.visible = false
  797.        $game_system.se_play($data_system.cancel_se)
  798.        @yes_no_window.active = false
  799.        @command_window.active = true
  800.        end
  801.    end
  802.    if Input.trigger?(Input::B)
  803.      @yes_no_window.visible = false
  804.      @confirm_window.visible = false
  805.      $game_system.se_play($data_system.cancel_se)
  806.      @yes_no_window.active = false
  807.      @command_window.active = true
  808.    end
  809. end
  810. #--------------------------------------------------------------------------
  811. # ● 写入存档数据
  812. #     file : 写入用文件对像 (已经打开)
  813. #--------------------------------------------------------------------------
  814. def write_save_data(file)
  815.    # 生成描绘存档文件用的角色图形
  816.    characters = []
  817.    for i in 0...$game_party.actors.size
  818.      actor = $game_party.actors[i]
  819.      characters.push([actor.character_name, actor.character_hue, actor])
  820.    end
  821.    # 写入描绘存档文件用的角色数据
  822.    Marshal.dump(characters, file)
  823.    # 写入测量游戏时间用画面计数
  824.    Marshal.dump(Graphics.frame_count, file)
  825.    # 增加 1 次存档次数
  826.    $game_system.save_count += 1
  827.    # 保存魔法编号
  828.    # (将编辑器保存的值以随机值替换)
  829.    $game_system.magic_number = $data_system.magic_number
  830.    # 写入各种游戏对像
  831.    Marshal.dump($game_system, file)
  832.    Marshal.dump($game_switches, file)
  833.    Marshal.dump($game_variables, file)
  834.    Marshal.dump($game_self_switches, file)
  835.    Marshal.dump($game_screen, file)
  836.    Marshal.dump($game_actors, file)
  837.    Marshal.dump($game_party, file)
  838.    Marshal.dump($game_troop, file)
  839.    Marshal.dump($game_map, file)
  840.    Marshal.dump($game_player, file)
  841. end
  842. end

  843. #==============================================================================
  844. # ■ Window_LoadHelp
  845. #------------------------------------------------------------------------------
  846. #  存取档画面帮助信息的显示窗口。
  847. #==============================================================================

  848. class Window_LoadHelp < Window_Base
  849. #--------------------------------------------------------------------------
  850. #  初始化对象
  851. #--------------------------------------------------------------------------
  852. def initialize
  853. super(0, 0, 320, 64)
  854. self.contents = Bitmap.new(width - 32, height - 32)
  855. end
  856. #--------------------------------------------------------------------------
  857. #  刷新文本
  858. #--------------------------------------------------------------------------
  859. def set_text(text, align = 1)
  860. if text != @text or align != @align
  861.    self.contents.clear
  862.    self.contents.font.color = normal_color
  863.    self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  864.    @text = text
  865.    @align = align
  866.    @actor = nil
  867. end
  868. self.visible = true
  869. end
  870. end
复制代码
截图存取档脚本和以下脚本错误

作者: cZooCz    时间: 2008-1-11 02:33
  1. #==============================================================================
  2. # ■ chaochao的人物仓库ver1.02正式版
  3. # 修改了Game_Party
  4. # 功能:
  5. # 用来存放角色的仓库……
  6. # 召唤画面用$scene = Chaochao_Scene_Party.new
  7. # 其它使用说明在代码里已经备注。
  8. #------------------------------------------------------------------------------
  9. # 作者:chaochao
  10. # http://zhuchao.go1.icpcn.com
  11. #==============================================================================
  12. class Chaochao_Window_PartyLeft < Window_Selectable
  13.   def initialize
  14.     super(0, 0, 320, 224)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.index = 0
  17.     refresh
  18.   end
  19.   def actor
  20.     return @actors[self.index]
  21.   end
  22.   def refresh
  23.     if self.contents != nil
  24.       self.contents.dispose
  25.       self.contents = nil
  26.     end
  27.     @actors = []
  28.     for i in 0...$game_party.actors.size
  29.       @actors.push($game_party.actors[i])
  30.     end
  31.    
  32.     @item_max = 4
  33.     if @item_max > 0
  34.       self.contents = Bitmap.new(width - 32, (row_max+1) * 32)
  35.       for i in 0...@item_max
  36.         draw_item(i)
  37.       end
  38.     end
  39.   end
  40.   def draw_item(index)
  41.     if @actors[index] != nil
  42.       actor = @actors[index]
  43.       text = @actors[index].name
  44.       lv = @actors[index].level.to_s + " "
  45.       if $game_party.chaochao.include?(actor.id) or $game_party.actors.size <= 1
  46.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  47.       else
  48.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  49.       end
  50.       self.contents.draw_text(4, index * 32 + 32, 288, 32, text)
  51.       self.contents.font.color = normal_color
  52.       self.contents.font.size = 16
  53.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  "Level:   ", 2)
  54.       colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  55.       colory = [255.0000 / 60 * @actors[index].level,255].min
  56.       self.contents.font.color = Color.new(colorx, colory, 0)
  57.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  lv, 2)
  58.       self.contents.font.color = normal_color
  59.       self.contents.font.size = 22
  60.     else
  61.       self.contents.draw_text(4, index * 32 + 32, 288, 32,  "米有人物!")
  62.     end
  63.   end
  64.   def update_cursor_rect
  65.     if @index < 0
  66.       self.cursor_rect.empty
  67.       return
  68.     end
  69.     row = @index / @column_max
  70.     if row < self.top_row
  71.       self.top_row = row
  72.     end
  73.     if row > self.top_row + (self.page_row_max - 1)
  74.       self.top_row = row - (self.page_row_max - 1)
  75.     end
  76.     cursor_width = self.width / @column_max - 32
  77.     x = @index % @column_max * (cursor_width + 32)
  78.     y = @index / @column_max * 32 - self.oy + 32
  79.     self.cursor_rect.set(x, y, cursor_width, 32)
  80.   end
  81.   def item_max
  82.     return @item_max
  83.   end
  84.   def actor?(index)
  85.     return @actors[index] == nil ? false : true
  86.   end
  87.   def set_index(x)
  88.     @index = x
  89.   end
  90. end

  91. #------------------------------------------------------------------------------

  92. class Chaochao_Window_PartyRight < Window_Selectable
  93.   def initialize
  94.     super(320, 0, 320, 224)
  95.     self.contents = Bitmap.new(width - 32, height - 32)
  96.     self.index = -1
  97.     refresh
  98.   end
  99.   def actor
  100.     return @actors[self.index]
  101.   end
  102.   def refresh
  103.     if self.contents != nil
  104.       self.contents.dispose
  105.       self.contents = nil
  106.     end
  107.     @actors = []
  108.     for i in 0...$game_party.actors2.size
  109.       @actors.push($game_party.actors2[i])
  110.     end
  111.    
  112.     @item_max = $game_party.actors2.size
  113.     if @item_max > 0
  114.       self.contents = Bitmap.new(width - 32, row_max * 32)
  115.       for i in 0...@item_max
  116.         draw_item(i)
  117.       end
  118.     elsif @item_max == 0
  119.       
  120.     end
  121.   end
  122.   def draw_item(index)
  123.     actor = @actors[index]
  124.     text = @actors[index].name
  125.     lv = @actors[index].level.to_s + " "
  126.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  127.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  128.       else
  129.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  130.       end
  131.     self.contents.draw_text(4, index * 32, 288, 32, text)
  132.     self.contents.font.color = normal_color
  133.     self.contents.font.size = 16
  134.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  "Level:   ", 2)
  135.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  136.     colory = [255.0000 / 60 * @actors[index].level,255].min
  137.     self.contents.font.color = Color.new(colorx, colory, 0)
  138.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  lv, 2)
  139.     self.contents.font.color = normal_color
  140.     self.contents.font.size = 22
  141.   end
  142.   def update_cursor_rect
  143.     if @index < 0
  144.       self.cursor_rect.empty
  145.       return
  146.     end
  147.     row = @index / @column_max
  148.     if row < self.top_row
  149.       self.top_row = row
  150.     end
  151.     if row > self.top_row + (self.page_row_max - 1)
  152.       self.top_row = row - (self.page_row_max - 1)
  153.     end
  154.     cursor_width = self.width / @column_max - 32
  155.     x = @index % @column_max * (cursor_width + 32)
  156.     y = @index / @column_max * 32 - self.oy
  157.     self.cursor_rect.set(x, y, cursor_width, 32)
  158.   end
  159.   def item_max
  160.     return @item_max
  161.   end
  162.   def actor?(index)
  163.     return @actors[index] == nil ? false : true
  164.   end
  165.   def set_index(x)
  166.     @index = x
  167.   end
  168. end

  169. #------------------------------------------------------------------------------

  170. class Chaochao_Window_PartyData < Window_Base
  171.   
  172.   def initialize
  173.     super(0, 224, 640, 256)
  174.     self.contents = Bitmap.new(width - 32, height - 32)
  175.     @actor = nil
  176.   end
  177.   
  178.   def set_actor(actor)
  179.     self.contents.clear
  180.     draw_actor_name(actor, 4, 0)
  181.     draw_actor_state(actor, 140, 0)
  182.     draw_actor_hp(actor, 284, 0)
  183.     draw_actor_sp(actor, 460, 0)
  184.     @actor = actor
  185.     self.visible = true
  186.   end
  187.   def clear
  188.     self.contents.clear
  189.   end
  190. end

  191. #------------------------------------------------------------------------------

  192. class Game_Party
  193.   attr_reader   :actors2
  194.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  195.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  196.   def initialize
  197.     @actors = []
  198.     @gold = 0
  199.     @steps = 0
  200.     @items = {}
  201.     @weapons = {}
  202.     @armors = {}
  203.     @actors2 = []
  204.     @chaochao = []
  205.     @chaochao2 = []
  206.   end
  207.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  208.     case type
  209.     when 1
  210.       if $game_actors[actor_id] != nil
  211.         actor = $game_actors[actor_id]
  212.         #如果队伍没有满和队伍中没有此角色
  213.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  214.           @actors.push(actor)
  215.           $game_player.refresh
  216.         end
  217.       end
  218.     when 2
  219.       if $game_actors[actor_id] != nil
  220.         actor = $game_actors[actor_id]
  221.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  222.         #向备用角色中添加角色
  223.         if not @actors.include?(actor) and not @actors2.include?(actor)
  224.           @actors2.push(actor)
  225.           $game_player.refresh
  226.         end
  227.       end
  228.     end
  229.   end
  230.   
  231.   def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
  232.     actor = $game_actors[index]
  233.     case type
  234.     when 1
  235.       if @actors.size < 4 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
  236.         @actors.push(actor)
  237.         @actors2.delete(actor)
  238.         $game_system.se_play($data_system.decision_se)
  239.         $game_player.refresh
  240.       end
  241.     when 2
  242.       if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
  243.         @actors2.push(actor)
  244.         @actors.delete(actor)
  245.         $game_system.se_play($data_system.decision_se)
  246.         $game_player.refresh
  247.       end
  248.     end
  249.   end
  250.   
  251.   #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  252.   #type2,1是添加不能移动的,2是删除不能移动的。
  253.   def yidong(actor_id,type1,type2=1)
  254.     case type2
  255.     when 1
  256.       case type1
  257.       when 1
  258.         @chaochao.push(actor_id)
  259.       when 2
  260.         @chaochao2.push(actor_id)
  261.       end
  262.     when 2
  263.       case type1
  264.       when 1
  265.         @chaochao.delete(actor_id)
  266.       when 2
  267.         @chaochao2.delete(actor_id)
  268.       end
  269.     end
  270.   end
  271.   
  272.   #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
  273.   def remove_actor(actor_id,type=1)
  274.     actor = $game_actors[actor_id]
  275.     case type
  276.     when 1
  277.       @actors.delete(actor)
  278.       $game_player.refresh
  279.     when 2
  280.       @actors2.delete(actor)
  281.       $game_player.refresh
  282.     when 3
  283.       @actors.delete(actor)
  284.       @actors2.delete(actor)
  285.       $game_player.refresh
  286.     end
  287.   end
  288.   
  289.   def refresh
  290.     new_actors = []
  291.     new_actors2 = []
  292.     for i in [email protected]
  293.       if $data_actors[@actors[i].id] != nil
  294.         new_actors.push($game_actors[@actors[i].id])
  295.       end
  296.     end
  297.     @actors = new_actors
  298.     for i in [email protected]#      if $data_actors[@actors2[i].id] != nil
  299.         new_actors2.push($game_actors[@actors2[i].id])
  300.       end
  301.     end
  302.     @actors2 = new_actors2
  303.   end
  304. end

  305. #------------------------------------------------------------------------------

  306. class Chaochao_Scene_Party
  307.   def main
  308.     @left_temp_command = 0
  309.     @right_temp_command = 0
  310.     @temp = 0
  311.     @left_window = Chaochao_Window_PartyLeft.new
  312.     @left_window.active = true
  313.     @right_window = Chaochao_Window_PartyRight.new
  314.     @right_window.active = false
  315.     @data_window = Chaochao_Window_PartyData.new
  316.     update_data
  317.     Graphics.transition
  318.     loop do
  319.       Graphics.update
  320.       Input.update
  321.       update
  322.       if $scene != self
  323.         break
  324.       end
  325.     end
  326.     Graphics.freeze
  327.     @left_window.dispose
  328.     @right_window.dispose
  329.     @data_window.dispose
  330.   end
  331.   
  332.   def update
  333.     @left_window.update
  334.     @right_window.update
  335.     @data_window.update
  336.     update_command
  337.     update_data
  338.   end
  339.   
  340.   def update_command
  341.     if Input.trigger?(Input::B)
  342.       $game_system.se_play($data_system.cancel_se)
  343.       #画面切换
  344.       $scene = Scene_Map.new
  345.       return
  346.     end
  347.     if @left_window.active
  348.       update_left
  349.       return
  350.     end
  351.     if @right_window.active
  352.       update_right
  353.       return
  354.     end
  355.   end
  356.   
  357.   def update_left
  358.     if Input.trigger?(Input::RIGHT)
  359.       if @right_window.item_max > 0
  360.         @left_temp_command = @left_window.index
  361.         @left_window.set_index(-1)
  362.         $game_system.se_play($data_system.cursor_se)
  363.         @left_window.active = false
  364.         @right_window.active = true
  365.         @left_window.refresh
  366.         @right_window.refresh
  367.         @right_window.set_index(@right_temp_command)
  368.         return
  369.       else
  370.         $game_system.se_play($data_system.buzzer_se)
  371.         return
  372.       end
  373.     end
  374.     if Input.trigger?(Input::C)
  375.       if @left_window.active and @left_window.actor?(@left_window.index) and $game_party.actors.size > 1 and not $game_party.chaochao.include?($game_party.actors[@left_window.index].id)
  376.         $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
  377.         @left_window.refresh
  378.         @right_window.refresh
  379.       else
  380.         $game_system.se_play($data_system.buzzer_se)
  381.       end
  382.     end
  383.     return
  384.   end
  385.   
  386.   def update_right
  387.     if Input.trigger?(Input::LEFT)
  388.       if @left_window.item_max > 0
  389.         @right_temp_command = @right_window.index
  390.         @right_window.set_index(-1)
  391.         $game_system.se_play($data_system.cursor_se)
  392.         @left_window.active = true
  393.         @right_window.active = false
  394.         @left_window.refresh
  395.         @right_window.refresh
  396.         @left_window.set_index(@left_temp_command)
  397.         return
  398.       else
  399.         $game_system.se_play($data_system.buzzer_se)
  400.         return
  401.       end
  402.     end
  403.     if Input.trigger?(Input::C)
  404.       if $game_party.actors.size >= 4
  405.         $game_system.se_play($data_system.buzzer_se)
  406.         return
  407.       end
  408.       if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
  409.         $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
  410.         if $game_party.actors2.size == 0
  411.           @right_temp_command = @right_window.index
  412.           @right_window.set_index(-1)
  413.           $game_system.se_play($data_system.cursor_se)
  414.           @left_window.active = true
  415.           @right_window.active = false
  416.           @left_window.refresh
  417.           @right_window.refresh
  418.           @left_window.set_index(@left_temp_command)
  419.         end
  420.         if @right_window.index > 0
  421.           @right_window.set_index(@right_window.index-1)
  422.         end
  423.         @left_window.refresh
  424.         @right_window.refresh
  425.       else
  426.         $game_system.se_play($data_system.buzzer_se)
  427.       end
  428.     end
  429.     return
  430.   end
  431.   
  432.   def update_data
  433.     if @left_window.active
  434.       if $game_party.actors[@left_window.index] != nil
  435.         @data_window.set_actor($game_party.actors[@left_window.index])
  436.       else
  437.         @data_window.clear
  438.       end
  439.       return
  440.     end
  441.     if @right_window.active
  442.       if $game_party.actors2[@right_window.index] != nil
  443.         @data_window.set_actor($game_party.actors2[@right_window.index])
  444.       else
  445.         @data_window.clear
  446.       end
  447.       return
  448.     end
  449.   end
  450. end
复制代码
和人物仓库脚本错误~~~~帮看下好像是处理角色ID错误了
作者: cZooCz    时间: 2008-1-11 03:41
谁来帮下啊~~~虽然有点麻烦但是……
作者: 趙雲    时间: 2008-1-11 06:32

貌似是报错的那行多了一个end

或者,你没有拷贝截图所需要的 dll 文件
作者: 黑撒旦    时间: 2008-1-11 06:44
[/quote][quote]以下引用趙雲于2008-1-10 22:32:25的发言:


貌似是报错的那行多了一个end

或者,你没有拷贝截图所需要的 dll 文件


LZ的“chaochao的人物仓库ver1.02正式版”脚本304行#      if $data_actors[@actors2.id] != nil
注释掉了,所以会多出个end。

去掉注释,经测试并无冲突。
作者: cZooCz    时间: 2008-1-11 21:42
请LS把你改的2脚本发上来{/fd}{/fd}我去掉#还是有事
作者: 黑撒旦    时间: 2008-1-11 21:52
  1. #==============================================================================
  2. # ■ chaochao的人物仓库ver1.02正式版
  3. # 修改了Game_Party
  4. # 功能:
  5. # 用来存放角色的仓库……
  6. # 召唤画面用$scene = Chaochao_Scene_Party.new
  7. # 其它使用说明在代码里已经备注。
  8. #------------------------------------------------------------------------------
  9. # 作者:chaochao
  10. # http://zhuchao.go1.icpcn.com
  11. #==============================================================================
  12. class Chaochao_Window_PartyLeft < Window_Selectable
  13.   def initialize
  14.     super(0, 0, 320, 224)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.index = 0
  17.     refresh
  18.   end
  19.   def actor
  20.     return @actors[self.index]
  21.   end
  22.   def refresh
  23.     if self.contents != nil
  24.       self.contents.dispose
  25.       self.contents = nil
  26.     end
  27.     @actors = []
  28.     for i in 0...$game_party.actors.size
  29.       @actors.push($game_party.actors[i])
  30.     end
  31.    
  32.     @item_max = 4
  33.     if @item_max > 0
  34.       self.contents = Bitmap.new(width - 32, (row_max+1) * 32)
  35.       for i in 0...@item_max
  36.         draw_item(i)
  37.       end
  38.     end
  39.   end
  40.   def draw_item(index)
  41.     if @actors[index] != nil
  42.       actor = @actors[index]
  43.       text = @actors[index].name
  44.       lv = @actors[index].level.to_s + " "
  45.       if $game_party.chaochao.include?(actor.id) or $game_party.actors.size <= 1
  46.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  47.       else
  48.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  49.       end
  50.       self.contents.draw_text(4, index * 32 + 32, 288, 32, text)
  51.       self.contents.font.color = normal_color
  52.       self.contents.font.size = 16
  53.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  "Level:   ", 2)
  54.       colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  55.       colory = [255.0000 / 60 * @actors[index].level,255].min
  56.       self.contents.font.color = Color.new(colorx, colory, 0)
  57.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  lv, 2)
  58.       self.contents.font.color = normal_color
  59.       self.contents.font.size = 22
  60.     else
  61.       self.contents.draw_text(4, index * 32 + 32, 288, 32,  "米有人物!")
  62.     end
  63.   end
  64.   def update_cursor_rect
  65.     if @index < 0
  66.       self.cursor_rect.empty
  67.       return
  68.     end
  69.     row = @index / @column_max
  70.     if row < self.top_row
  71.       self.top_row = row
  72.     end
  73.     if row > self.top_row + (self.page_row_max - 1)
  74.       self.top_row = row - (self.page_row_max - 1)
  75.     end
  76.     cursor_width = self.width / @column_max - 32
  77.     x = @index % @column_max * (cursor_width + 32)
  78.     y = @index / @column_max * 32 - self.oy + 32
  79.     self.cursor_rect.set(x, y, cursor_width, 32)
  80.   end
  81.   def item_max
  82.     return @item_max
  83.   end
  84.   def actor?(index)
  85.     return @actors[index] == nil ? false : true
  86.   end
  87.   def set_index(x)
  88.     @index = x
  89.   end
  90. end

  91. #------------------------------------------------------------------------------

  92. class Chaochao_Window_PartyRight < Window_Selectable
  93.   def initialize
  94.     super(320, 0, 320, 224)
  95.     self.contents = Bitmap.new(width - 32, height - 32)
  96.     self.index = -1
  97.     refresh
  98.   end
  99.   def actor
  100.     return @actors[self.index]
  101.   end
  102.   def refresh
  103.     if self.contents != nil
  104.       self.contents.dispose
  105.       self.contents = nil
  106.     end
  107.     @actors = []
  108.     for i in 0...$game_party.actors2.size
  109.       @actors.push($game_party.actors2[i])
  110.     end
  111.    
  112.     @item_max = $game_party.actors2.size
  113.     if @item_max > 0
  114.       self.contents = Bitmap.new(width - 32, row_max * 32)
  115.       for i in 0...@item_max
  116.         draw_item(i)
  117.       end
  118.     elsif @item_max == 0
  119.       
  120.     end
  121.   end
  122.   def draw_item(index)
  123.     actor = @actors[index]
  124.     text = @actors[index].name
  125.     lv = @actors[index].level.to_s + " "
  126.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  127.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  128.       else
  129.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  130.       end
  131.     self.contents.draw_text(4, index * 32, 288, 32, text)
  132.     self.contents.font.color = normal_color
  133.     self.contents.font.size = 16
  134.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  "Level:   ", 2)
  135.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  136.     colory = [255.0000 / 60 * @actors[index].level,255].min
  137.     self.contents.font.color = Color.new(colorx, colory, 0)
  138.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  lv, 2)
  139.     self.contents.font.color = normal_color
  140.     self.contents.font.size = 22
  141.   end
  142.   def update_cursor_rect
  143.     if @index < 0
  144.       self.cursor_rect.empty
  145.       return
  146.     end
  147.     row = @index / @column_max
  148.     if row < self.top_row
  149.       self.top_row = row
  150.     end
  151.     if row > self.top_row + (self.page_row_max - 1)
  152.       self.top_row = row - (self.page_row_max - 1)
  153.     end
  154.     cursor_width = self.width / @column_max - 32
  155.     x = @index % @column_max * (cursor_width + 32)
  156.     y = @index / @column_max * 32 - self.oy
  157.     self.cursor_rect.set(x, y, cursor_width, 32)
  158.   end
  159.   def item_max
  160.     return @item_max
  161.   end
  162.   def actor?(index)
  163.     return @actors[index] == nil ? false : true
  164.   end
  165.   def set_index(x)
  166.     @index = x
  167.   end
  168. end

  169. #------------------------------------------------------------------------------

  170. class Chaochao_Window_PartyData < Window_Base
  171.   
  172.   def initialize
  173.     super(0, 224, 640, 256)
  174.     self.contents = Bitmap.new(width - 32, height - 32)
  175.     @actor = nil
  176.   end
  177.   
  178.   def set_actor(actor)
  179.     self.contents.clear
  180.     draw_actor_name(actor, 4, 0)
  181.     draw_actor_state(actor, 140, 0)
  182.     draw_actor_hp(actor, 284, 0)
  183.     draw_actor_sp(actor, 460, 0)
  184.     @actor = actor
  185.     self.visible = true
  186.   end
  187.   def clear
  188.     self.contents.clear
  189.   end
  190. end

  191. #------------------------------------------------------------------------------

  192. class Game_Party
  193.   attr_reader   :actors2
  194.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  195.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  196.   def initialize
  197.     @actors = []
  198.     @gold = 0
  199.     @steps = 0
  200.     @items = {}
  201.     @weapons = {}
  202.     @armors = {}
  203.     @actors2 = []
  204.     @chaochao = []
  205.     @chaochao2 = []
  206.   end
  207.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  208.     case type
  209.     when 1
  210.       if $game_actors[actor_id] != nil
  211.         actor = $game_actors[actor_id]
  212.         #如果队伍没有满和队伍中没有此角色
  213.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  214.           @actors.push(actor)
  215.           $game_player.refresh
  216.         end
  217.       end
  218.     when 2
  219.       if $game_actors[actor_id] != nil
  220.         actor = $game_actors[actor_id]
  221.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  222.         #向备用角色中添加角色
  223.         if not @actors.include?(actor) and not @actors2.include?(actor)
  224.           @actors2.push(actor)
  225.           $game_player.refresh
  226.         end
  227.       end
  228.     end
  229.   end
  230.   
  231.   def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
  232.     actor = $game_actors[index]
  233.     case type
  234.     when 1
  235.       if @actors.size < 4 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
  236.         @actors.push(actor)
  237.         @actors2.delete(actor)
  238.         $game_system.se_play($data_system.decision_se)
  239.         $game_player.refresh
  240.       end
  241.     when 2
  242.       if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
  243.         @actors2.push(actor)
  244.         @actors.delete(actor)
  245.         $game_system.se_play($data_system.decision_se)
  246.         $game_player.refresh
  247.       end
  248.     end
  249.   end
  250.   
  251.   #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  252.   #type2,1是添加不能移动的,2是删除不能移动的。
  253.   def yidong(actor_id,type1,type2=1)
  254.     case type2
  255.     when 1
  256.       case type1
  257.       when 1
  258.         @chaochao.push(actor_id)
  259.       when 2
  260.         @chaochao2.push(actor_id)
  261.       end
  262.     when 2
  263.       case type1
  264.       when 1
  265.         @chaochao.delete(actor_id)
  266.       when 2
  267.         @chaochao2.delete(actor_id)
  268.       end
  269.     end
  270.   end
  271.   
  272.   #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
  273.   def remove_actor(actor_id,type=1)
  274.     actor = $game_actors[actor_id]
  275.     case type
  276.     when 1
  277.       @actors.delete(actor)
  278.       $game_player.refresh
  279.     when 2
  280.       @actors2.delete(actor)
  281.       $game_player.refresh
  282.     when 3
  283.       @actors.delete(actor)
  284.       @actors2.delete(actor)
  285.       $game_player.refresh
  286.     end
  287.   end
  288.   
  289.   def refresh
  290.     new_actors = []
  291.     new_actors2 = []
  292.     for i in [email protected]
  293.       if $data_actors[@actors[i].id] != nil
  294.         new_actors.push($game_actors[@actors[i].id])
  295.       end
  296.     end
  297.     @actors = new_actors
  298.     for i in [email protected]
  299.       if $data_actors[@actors2[i].id] != nil
  300.         new_actors2.push($game_actors[@actors2[i].id])
  301.       end
  302.     end
  303.     @actors2 = new_actors2
  304.   end
  305. end

  306. #------------------------------------------------------------------------------

  307. class Chaochao_Scene_Party
  308.   def main
  309.     @left_temp_command = 0
  310.     @right_temp_command = 0
  311.     @temp = 0
  312.     @left_window = Chaochao_Window_PartyLeft.new
  313.     @left_window.active = true
  314.     @right_window = Chaochao_Window_PartyRight.new
  315.     @right_window.active = false
  316.     @data_window = Chaochao_Window_PartyData.new
  317.     update_data
  318.     Graphics.transition
  319.     loop do
  320.       Graphics.update
  321.       Input.update
  322.       update
  323.       if $scene != self
  324.         break
  325.       end
  326.     end
  327.     Graphics.freeze
  328.     @left_window.dispose
  329.     @right_window.dispose
  330.     @data_window.dispose
  331.   end
  332.   
  333.   def update
  334.     @left_window.update
  335.     @right_window.update
  336.     @data_window.update
  337.     update_command
  338.     update_data
  339.   end
  340.   
  341.   def update_command
  342.     if Input.trigger?(Input::B)
  343.       $game_system.se_play($data_system.cancel_se)
  344.       #画面切换
  345.       $scene = Scene_Map.new
  346.       return
  347.     end
  348.     if @left_window.active
  349.       update_left
  350.       return
  351.     end
  352.     if @right_window.active
  353.       update_right
  354.       return
  355.     end
  356.   end
  357.   
  358.   def update_left
  359.     if Input.trigger?(Input::RIGHT)
  360.       if @right_window.item_max > 0
  361.         @left_temp_command = @left_window.index
  362.         @left_window.set_index(-1)
  363.         $game_system.se_play($data_system.cursor_se)
  364.         @left_window.active = false
  365.         @right_window.active = true
  366.         @left_window.refresh
  367.         @right_window.refresh
  368.         @right_window.set_index(@right_temp_command)
  369.         return
  370.       else
  371.         $game_system.se_play($data_system.buzzer_se)
  372.         return
  373.       end
  374.     end
  375.     if Input.trigger?(Input::C)
  376.       if @left_window.active and @left_window.actor?(@left_window.index) and $game_party.actors.size > 1 and not $game_party.chaochao.include?($game_party.actors[@left_window.index].id)
  377.         $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
  378.         @left_window.refresh
  379.         @right_window.refresh
  380.       else
  381.         $game_system.se_play($data_system.buzzer_se)
  382.       end
  383.     end
  384.     return
  385.   end
  386.   
  387.   def update_right
  388.     if Input.trigger?(Input::LEFT)
  389.       if @left_window.item_max > 0
  390.         @right_temp_command = @right_window.index
  391.         @right_window.set_index(-1)
  392.         $game_system.se_play($data_system.cursor_se)
  393.         @left_window.active = true
  394.         @right_window.active = false
  395.         @left_window.refresh
  396.         @right_window.refresh
  397.         @left_window.set_index(@left_temp_command)
  398.         return
  399.       else
  400.         $game_system.se_play($data_system.buzzer_se)
  401.         return
  402.       end
  403.     end
  404.     if Input.trigger?(Input::C)
  405.       if $game_party.actors.size >= 4
  406.         $game_system.se_play($data_system.buzzer_se)
  407.         return
  408.       end
  409.       if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
  410.         $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
  411.         if $game_party.actors2.size == 0
  412.           @right_temp_command = @right_window.index
  413.           @right_window.set_index(-1)
  414.           $game_system.se_play($data_system.cursor_se)
  415.           @left_window.active = true
  416.           @right_window.active = false
  417.           @left_window.refresh
  418.           @right_window.refresh
  419.           @left_window.set_index(@left_temp_command)
  420.         end
  421.         if @right_window.index > 0
  422.           @right_window.set_index(@right_window.index-1)
  423.         end
  424.         @left_window.refresh
  425.         @right_window.refresh
  426.       else
  427.         $game_system.se_play($data_system.buzzer_se)
  428.       end
  429.     end
  430.     return
  431.   end
  432.   
  433.   def update_data
  434.     if @left_window.active
  435.       if $game_party.actors[@left_window.index] != nil
  436.         @data_window.set_actor($game_party.actors[@left_window.index])
  437.       else
  438.         @data_window.clear
  439.       end
  440.       return
  441.     end
  442.     if @right_window.active
  443.       if $game_party.actors2[@right_window.index] != nil
  444.         @data_window.set_actor($game_party.actors2[@right_window.index])
  445.       else
  446.         @data_window.clear
  447.       end
  448.       return
  449.     end
  450.   end
  451. end
复制代码

作者: 黑撒旦    时间: 2008-1-11 21:52
  1. ###使用说明
  2. #使用前请复制sceneshot.dll到游戏文件下,并新建文件夹Save
  3. #将此文本插入main前面
  4. #游戏前显示头像的文件名为:人物角色名_f,请自行建立几张做测试,不然找不到图片会报错
  5. #自动存档按钮F5 存入档位0(也就是自动存档那栏)
  6. #使用前,请在菜单脚本:scene_menu里面,
  7. #     when 4 # 存档
  8. #     # 禁止存档的情况下
  9. #     if $game_system.save_disabled
  10. #       # 演奏冻结 SE
  11. #       $game_system.se_play($data_system.buzzer_se)
  12. #       return
  13. #     end
  14. #     # 演奏确定 SE
  15. #     $game_system.se_play($data_system.decision_se)
  16. #     # 切换到存档画面
  17. #     $scene = Scene_Save.new <--这行
  18. #替换为:   $scene = Scene_Loadsave.new
  19. #另,在原scene_title里,48行左右
  20. #    for i in 0..3
  21. #          for i in 0..3
  22. #     if FileTest.exist?("Save#{i+1}.rxdata")
  23. ###################改成if FileTest.exist?("Save/Save#{i+1}.rxdata")
  24. #        @continue_enabled = true
  25. #      end
  26. #    end
  27. #否则继续游戏时会检测不到存档

  28. class Window_File < Window_Base
  29. attr_accessor :index
  30. def initialize(index = 0)
  31.    @backsp = Sprite.new
  32.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  33.    @backsp.z = 100
  34.    super(160,64,480,416)
  35.    #这行可以不用
  36.    self.contents = Bitmap.new(width - 32, height - 32)
  37.    @index = index
  38.    #这里我要说明一句,之所以用sprite是为了放缩图片
  39.    @sprite = Sprite.new
  40.    @sprite.visible = false
  41.    @sprite.z = 100
  42.    @sp_ch = []
  43.    @sp_ch[0] = Sprite.new
  44.    refresh
  45. end
  46. def refresh
  47.    self.contents.clear
  48.    for i in @sp_ch
  49.      i.visible = false
  50.    end
  51.    @sprite.visible = false
  52.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  53.      @sprite.visible = true
  54.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  55.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  56.      else
  57.        self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  58.      end
  59.      @sprite.x = 290
  60.      @sprite.y = 96
  61.      @sprite.z = 998
  62.      @sprite.zoom_x = 0.5
  63.      @sprite.zoom_y = 0.5
  64.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  65.      @time_stamp = file.mtime
  66.      @characters = Marshal.load(file)
  67.      @frame_count = Marshal.load(file)
  68.      @game_system = Marshal.load(file)
  69.      @game_switches = Marshal.load(file)
  70.      @game_variables = Marshal.load(file)
  71.      @total_sec = @frame_count / Graphics.frame_rate
  72.      file.close
  73.      for i in [email protected]
  74.        @sp_ch[i] = Sprite.new
  75.        @sp_ch[i].visible = true
  76.        testname = @characters[i][2].name+"_f"
  77.        @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  78.        @sp_ch[i].zoom_x = 0.8
  79.        @sp_ch[i].zoom_y = 0.8
  80.        @sp_ch[i].x = 180        
  81.        @sp_ch[i].y = 96 + i*90
  82.        @sp_ch[i].z = 101
  83.      end
  84.      # 描绘游戏时间
  85.      hour = @total_sec / 60 / 60
  86.      min = @total_sec / 60 % 60
  87.      sec = @total_sec % 60
  88.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  89.      self.contents.font.color = normal_color
  90.      self.contents.draw_text(4, 326, 420, 32, time_string, 2)
  91.      # 描绘时间标记
  92.      self.contents.font.color = normal_color
  93.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  94.      self.contents.draw_text(4, 356, 420, 32, time_string, 2)
  95.    else
  96.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  97.    end

  98. end
  99. def dispose
  100.    super
  101.    @sprite.dispose
  102.    @backsp.dispose
  103.    for i in @sp_ch
  104.      i.dispose
  105.    end
  106. end
  107. end


  108. class Window_File2 < Window_Base
  109. attr_accessor :index
  110. def initialize(index = 0)
  111.    @backsp = Sprite.new
  112.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  113.    @backsp.z = 100
  114.    super(160,0,480,480)
  115.    #这行可以不用
  116.    self.contents = Bitmap.new(width - 32, height - 32)
  117.    @index = index
  118.    #这里我要说明一句,之所以用sprite是为了放缩图片
  119.    @sprite = Sprite.new
  120.    @sprite.visible = false
  121.    @sprite.z = 100
  122.    @sp_ch = []
  123.    @sp_ch[0] = Sprite.new
  124.    refresh
  125. end
  126. def refresh
  127.    self.contents.clear
  128.    for i in @sp_ch
  129.      i.visible = false
  130.    end
  131.    @sprite.visible = false
  132.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  133.      @sprite.visible = true
  134.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  135.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  136.      else
  137.        self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  138.      end
  139.      @sprite.x = 290
  140.      @sprite.y = 32
  141.      @sprite.z = 998
  142.      @sprite.zoom_x = 0.5
  143.      @sprite.zoom_y = 0.5
  144.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  145.      @time_stamp = file.mtime
  146.      @characters = Marshal.load(file)
  147.      @frame_count = Marshal.load(file)
  148.      @game_system = Marshal.load(file)
  149.      @game_switches = Marshal.load(file)
  150.      @game_variables = Marshal.load(file)
  151.      @total_sec = @frame_count / Graphics.frame_rate
  152.      file.close
  153.      for i in [email protected]
  154.        @sp_ch[i] = Sprite.new
  155.        @sp_ch[i].visible = true
  156.        testname = @characters[i][2].name+"_f" #修改
  157.        @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  158.        @sp_ch[i].x = 180        
  159.        @sp_ch[i].y = 24 + i*110
  160.        @sp_ch[i].z = 101
  161.      end
  162.      # 描绘游戏时间
  163.      hour = @total_sec / 60 / 60
  164.      min = @total_sec / 60 % 60
  165.      sec = @total_sec % 60
  166.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  167.      self.contents.font.color = normal_color
  168.      self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  169.      # 描绘时间标记
  170.      self.contents.font.color = normal_color
  171.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  172.      self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  173.    else
  174.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  175.    end

  176. end
  177. def dispose
  178.    super
  179.    @sprite.dispose
  180.    @backsp.dispose
  181.    for i in @sp_ch
  182.      i.dispose
  183.    end
  184. end
  185. end



  186. $打开自动存档用的开关编号 = 999
  187. $自动存档位置 = 1
  188. $按下F5之后的自动存档的音效 = "Audio/SE/系统存档"
  189. $按下F5之后禁止存档时候的音效 = "Audio/Se/系统错误"
  190. DIR = "Save/"
  191. $打开自动存档开关之后调用的公共事件 = 0 #——默认未定义
  192. $按下F5之后可以存档调用的公共事件 = 0 #——默认未定义
  193. $按下F5之后禁止存档调用的公共事件 = 0 #——默认未定义
  194. class Scene_Map
  195. alias auto_update update
  196. def update
  197. auto_update
  198. #——按下F5的时候自动存档,可以修改为F5,F6,F7,F8,也可以修改成默认按键但是不推荐。
  199. #——注意在不可存档的时候是无效的
  200. if Input.trigger?(Input::F5)
  201.   unless $game_system.map_interpreter.running?
  202.   if $game_system.save_disabled
  203.     Audio.se_play($按下F5之后禁止存档时候的音效)
  204.     $game_temp.common_event_id = $按下F5之后禁止存档调用的公共事件
  205.   else
  206.     Audio.se_play($按下F5之后的自动存档的音效)
  207.     $game_temp.common_event_id = $按下F5之后可以存档调用的公共事件
  208.     auto_save
  209.   end
  210.   end
  211. end
  212. #——当BOSS战之前打开一下定义的开关,即可自动存档
  213. if $game_switches[$打开自动存档用的开关编号] == true
  214.   $game_switches[$打开自动存档用的开关编号] = false
  215.   $game_temp.common_event_id = $打开自动存档开关之后调用的公共事件
  216.   auto_save
  217. end
  218. end
  219. def auto_save
  220. #——这里定义了储存的文件,如果不希望用Save4可以自己修改编号
  221. # 写入存档数据
  222. Screen::shot
  223.     file = File.open( DIR+"Save#{$自动存档位置}.rxdata", "wb")
  224.     auto_save_data(file)
  225.     if FileTest.exist?( DIR+"shot.jpg")
  226.       File.rename( DIR+"shot.jpg", DIR+"Save#{$自动存档位置}.jpg")
  227.     end
  228.     file.close
  229. end
  230. def auto_save_data(file)
  231. #——以下定义内容和Scene_Save的write_save_data(file)完全一样
  232. #——如果你修改过该存档方法,不要忘记用你修改的覆盖这部分内容。
  233. # 生成描绘存档文件用的角色图形
  234. characters = []
  235. for i in 0...$game_party.actors.size
  236.   actor = $game_party.actors[i]
  237.   characters.push([actor.character_name, actor.character_hue, actor])
  238. end
  239. # 写入描绘存档文件用的角色数据
  240. Marshal.dump(characters, file)
  241. # 写入测量游戏时间用画面计数
  242. Marshal.dump(Graphics.frame_count, file)
  243. # 增加 1 次存档次数
  244. $game_system.save_count += 1
  245. # 保存魔法编号
  246. # (将编辑器保存的值以随机值替换)
  247. $game_system.magic_number = $data_system.magic_number
  248. # 写入各种游戏对像
  249. Marshal.dump($game_system, file)
  250. Marshal.dump($game_switches, file)
  251. Marshal.dump($game_variables, file)
  252. Marshal.dump($game_self_switches, file)
  253. Marshal.dump($game_screen, file)
  254. Marshal.dump($game_actors, file)
  255. Marshal.dump($game_party, file)
  256. Marshal.dump($game_troop, file)
  257. Marshal.dump($game_map, file)
  258. Marshal.dump($game_player, file)
  259. end
  260. end







  261. DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹


  262. module Screen  
  263. @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  264. @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l

  265. p), 'l'
  266. @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  267. module_function
  268. def shot(file = "shot", typ = 1)
  269.    # to add the right extension...
  270.    if typ == 0
  271.      typname = ".bmp"
  272.    elsif typ == 1
  273.      typname = ".jpg"
  274.    elsif typ == 2
  275.      typname = ".png"
  276.    end   
  277.    file_index = 0   
  278.    dir = "Save/"   
  279.    # make the filename....
  280.    file_name = dir + file.to_s + typname.to_s   
  281.    # make the screenshot.... Attention dont change anything from here on....
  282.    @screen.call(0,0,640,480,file_name,handel,typ)
  283. end
  284. # find the game window...
  285. def handel
  286.    game_name = "\0" * 256
  287.    @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  288.    game_name.delete!("\0")
  289.    return @findwindow.call('RGSS Player',game_name)
  290. end
  291. end


  292. class Scene_Menu
  293. alias shotsave_main main
  294. def main
  295.    if @menu_index == 0
  296.      Screen::shot
  297.    end   
  298.    shotsave_main
  299. end
  300. end

  301. class Interpreter
  302. #--------------------------------------------------------------------------
  303. # ● 调用存档画面
  304. #--------------------------------------------------------------------------
  305. def command_352
  306.    # 设置战斗中断标志
  307.    $game_temp.battle_abort = true
  308.    # 设置调用存档标志
  309.    $game_temp.save_calling = true
  310.    # 推进索引
  311.    @index += 1
  312.    # 结束
  313.    Screen::shot
  314.    return false
  315. end
  316. end

  317. #==============================================================================
  318. # ■ Scene_Load
  319. #------------------------------------------------------------------------------
  320. #  处理读档画面的类。
  321. #==============================================================================

  322. class Scene_Load
  323. #--------------------------------------------------------------------------
  324. # ● 初始化对像
  325. #--------------------------------------------------------------------------
  326. def initialize
  327.    # 再生成临时对像
  328.    $game_temp = Game_Temp.new
  329.    # 选择存档时间最新的文件
  330.    $game_temp.last_file_index = 0
  331.    latest_time = Time.at(0)
  332.    for i in 0..51
  333.      filename = DIR+"Save#{i}.rxdata"
  334.      if FileTest.exist?(filename)
  335.        file = File.open(filename, "r")
  336.        if file.mtime > latest_time
  337.          latest_time = file.mtime
  338.          $game_temp.last_file_index = i
  339.        end
  340.        file.close
  341.      end
  342.    end
  343. end  
  344. def main
  345.    @command_window = Window_Command.new(160,["自动存档","快速存档","进度二",
  346.    "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  347.    "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  348.    "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  349.    "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  350.    "进度二九","进度三十"])
  351.    @command_window.y = 0
  352.    @command_window.height = 480
  353.    @command_window.index = $game_temp.last_file_index
  354.    @content_window = Window_File2.new($game_temp.last_file_index)
  355.    # 执行过渡
  356.    Graphics.transition
  357.    # 主循环
  358.    loop do
  359.      # 刷新游戏画面
  360.      Graphics.update
  361.      # 刷新输入信息
  362.      Input.update
  363.      # 刷新画面
  364.      update
  365.      # 如果画面被切换的话就中断循环
  366.      if $scene != self
  367.        break
  368.      end
  369.    end
  370.    # 准备过渡
  371.    Graphics.freeze
  372.    @command_window.dispose
  373.    @content_window.dispose
  374. end
  375. def update
  376.    @command_window.update
  377.    if @command_window.index != @content_window.index
  378.      @content_window.index = @command_window.index
  379.      @content_window.refresh
  380.    end   
  381.    #——————下面这一部分是原装脚本——————#
  382.    if Input.trigger?(Input::B)  
  383.    # 演奏取消 SE
  384.    $game_system.se_play($data_system.cancel_se)
  385.    # 切换到标题画面
  386.    $scene = Scene_Title.new
  387.    end   
  388.    #———————————————————————#   
  389.    if Input.trigger?(Input::C)
  390.      # 文件不存在的情况下
  391.      unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  392.        # 演奏冻结 SE
  393.        $game_system.se_play($data_system.buzzer_se)
  394.        return
  395.      end
  396.      # 演奏读档 SE
  397.      $game_system.se_play($data_system.load_se)
  398.      # 写入存档数据
  399.      file = File.open(DIR+"Save#{@command_window.index}.rxdata",

  400. "rb")
  401.      read_save_data(file)
  402.      file.close
  403.      # 还原 BGM、BGS
  404.      $game_system.bgm_play($game_system.playing_bgm)
  405.      $game_system.bgs_play($game_system.playing_bgs)
  406.      # 刷新地图 (执行并行事件)
  407.      $game_map.update
  408.      # 切换到地图画面
  409.      $scene = Scene_Map.new
  410.    end
  411.    #———————————————————————#
  412. end
  413. #--------------------------------------------------------------------------
  414. # ● 写入存档数据
  415. #     file : 写入用文件对像 (已经打开)
  416. #--------------------------------------------------------------------------
  417. def read_save_data(file)
  418.    # 读取描绘存档文件用的角色数据
  419.    characters = Marshal.load(file)
  420.    # 读取测量游戏时间用画面计数
  421.    Graphics.frame_count = Marshal.load(file)
  422.    # 读取各种游戏对像
  423.    $game_system        = Marshal.load(file)
  424.    $game_switches      = Marshal.load(file)
  425.    $game_variables     = Marshal.load(file)
  426.    $game_self_switches = Marshal.load(file)
  427.    $game_screen        = Marshal.load(file)
  428.    $game_actors        = Marshal.load(file)
  429.    $game_party         = Marshal.load(file)
  430.    $game_troop         = Marshal.load(file)
  431.    $game_map           = Marshal.load(file)
  432.    $game_player        = Marshal.load(file)
  433.    # 魔法编号与保存时有差异的情况下
  434.    # (加入编辑器的编辑过的数据)
  435.    if $game_system.magic_number != $data_system.magic_number
  436.      # 重新装载地图
  437.      $game_map.setup($game_map.map_id)
  438.      $game_player.center($game_player.x, $game_player.y)
  439.    end
  440.    # 刷新同伴成员
  441.    $game_party.refresh
  442. end
  443. end

  444. #==============================================================================
  445. #  Window_LoadCommand
  446. #------------------------------------------------------------------------------
  447. #  存取档画面选择按钮窗口
  448. #==============================================================================

  449. class Window_LoadCommand < Window_Selectable
  450. #--------------------------------------------------------------------------
  451. #  初始化对象
  452. #--------------------------------------------------------------------------
  453. def initialize
  454. super(320, 0, 320, 64)
  455. self.contents = Bitmap.new(width - 32, height - 32)
  456. self.contents.font.color = normal_color
  457. @item_max = 2
  458. @column_max = 2
  459. @commands = ["读取", "存储"]
  460. refresh
  461. self.index = 0
  462. end
  463. #--------------------------------------------------------------------------
  464. #  刷新
  465. #--------------------------------------------------------------------------
  466. def refresh
  467. self.contents.clear
  468. for i in 0...@item_max
  469.    draw_item(i)
  470. end
  471. end
  472. #--------------------------------------------------------------------------
  473. #  描画按钮文字
  474. #--------------------------------------------------------------------------
  475. def draw_item(index)
  476. x = 4 + index * 160
  477. self.contents.draw_text(x, 0, 144, 32, @commands[index])
  478. end
  479. #--------------------------------------------------------------------------
  480. # ● 项目无效化
  481. #     index : 项目编号
  482. #--------------------------------------------------------------------------
  483. def disable_item(index)
  484.    draw_item(index, disabled_color)
  485. end

  486. end

  487. #==============================================================================
  488. #  Scene_Loadsave
  489. #------------------------------------------------------------------------------
  490. # 处理存取档画面的类。
  491. #==============================================================================

  492. class Scene_Loadsave
  493. #--------------------------------------------------------------------------
  494. # ● 初始化对像
  495. #     $last_savefile_index : 记录光标位置
  496. #--------------------------------------------------------------------------
  497. def initialize
  498.    $last_savefile_index = 0 if $last_savefile_index == nil
  499.    # 再生成临时对像
  500.    $game_temp = Game_Temp.new
  501.    # 选择存档时间最新的文件
  502.    $game_temp.last_file_index = 0
  503.    latest_time = Time.at(0)
  504.    for i in 0..51
  505.      filename =  DIR+"Save#{i}.rxdata"
  506.      if FileTest.exist?(filename)
  507.        file = File.open(filename, "r")
  508.        if file.mtime > latest_time
  509.          latest_time = file.mtime
  510.          $game_temp.last_file_index = i
  511.        end
  512.        file.close
  513.      end
  514.    end
  515. end
  516. #--------------------------------------------------------------------------
  517. #  主处理
  518. #--------------------------------------------------------------------------
  519. def main         

  520.    @savestate = 0
  521.    # 生成窗口
  522.    @help_window = Window_LoadHelp.new
  523.    @help_window.set_text("请选择.")
  524.    @option_window = Window_LoadCommand.new
  525.    @option_window.index = $last_savefile_index
  526.    ########################################################
  527.    @command_window = Window_Command.new(160,["自动存档","快速存档","进度二",
  528.      "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  529.      "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  530.      "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  531.      "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  532.      "进度二九","进度三十"])
  533.      @command_window.y = 64
  534.      @command_window.height = 416
  535.      @command_window.index = $game_temp.last_file_index
  536.      @content_window = Window_File.new($game_temp.last_file_index)
  537.      @command_window.active = false
  538.        ###############覆盖存档
  539.        @confirm_window = Window_Base.new(120, 188, 400, 64)
  540.        @confirm_window.contents = Bitmap.new(368, 32)

  541.        @confirm_window.contents.font.color = Color.new(255,255,255,255)

  542.        string = "确定要覆盖这个进度吗?"
  543.        @confirm_window.contents.font.name = "黑体"
  544.        @confirm_window.contents.font.size = 24
  545.        @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  546.        @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  547.        @confirm_window.z = 1500
  548.        @yes_no_window.index = 1
  549.        @yes_no_window.x = 270
  550.        @yes_no_window.y = 252
  551.        @yes_no_window.z = 1500
  552.        @confirm_window.visible = false
  553.        @yes_no_window.visible = false
  554.        @yes_no_window.active = false

  555.    # 执行过渡
  556.    Graphics.transition
  557.    # 主循环
  558.    loop do
  559.      # 刷新游戏画面
  560.      Graphics.update
  561.      # 刷新输入信息
  562.      Input.update
  563.      # 刷新画面
  564.      update
  565.      # 如果画面被切换的话就中断循环
  566.      if $scene != self
  567.        break
  568.      end
  569.    end
  570.    # 准备过渡
  571.    Graphics.freeze
  572.    # 释放窗口
  573.    @command_window.dispose
  574.    @content_window.dispose
  575.    @confirm_window.dispose
  576.    @yes_no_window.dispose
  577.    @help_window.dispose
  578.    @option_window.dispose
  579. end

  580. #--------------------------------------------------------------------------
  581. #  ● 刷新画面
  582. #--------------------------------------------------------------------------
  583. def update
  584.    # 刷新窗口
  585.    @help_window.update
  586.    @option_window.update
  587. #   @content_window.update
  588.    @command_window.update
  589.    if @yes_no_window.active
  590.        confirm_update
  591.        return
  592.    end
  593.    @content_window.index = @command_window.index
  594.    @content_window.refresh
  595.    case @savestate
  596.    when 0
  597.        if Input.trigger?(Input::B)
  598.        $game_system.se_play($data_system.cancel_se)
  599.        # 返回地图
  600.        if $menu_call == false
  601.        # 切换到地图画面
  602.        $scene = Scene_Map.new
  603.          return
  604.        end
  605.        # 切换到菜单画面
  606.        $menu_call = false
  607.        $scene = Scene_Menu.new(4)
  608.     end
  609.      if Input.trigger?(Input::C)
  610.        case @option_window.index
  611.        when 0
  612.          @command_window.active = true
  613.          @option_window.active = false
  614.          $game_system.se_play($data_system.decision_se)
  615.          @help_window.set_text("请选择一个文件进行读取.")
  616.          @savestate  = 1
  617.          return
  618.        when 1
  619.          @command_window.active = true
  620.          @option_window.active = false
  621.          $game_system.se_play($data_system.decision_se)
  622.          @help_window.set_text("请选择一个文件进行存储.")
  623.          @savestate = 2
  624.          
  625.          return
  626.        return
  627.        end
  628.      end
  629.    when 1,2
  630.      if Input.trigger?(Input::C)
  631.        if @savestate == 1
  632.          $menu_call = false
  633.          load_file
  634.          return
  635.        else
  636.          # 禁止存档的情况下
  637.          if $game_system.save_disabled
  638.            @help_window.set_text("抱歉,这里禁止存储.")
  639.            # 演奏冻结 SE
  640.            $game_system.se_play($data_system.buzzer_se)
  641.            return
  642.          end
  643.         $game_system.se_play($data_system.decision_se)
  644.         $last_savefile_index = @option_window.index

  645.         save_file
  646.          return
  647.        end
  648.      end
  649.      # 取消
  650.      if Input.trigger?(Input::B)
  651.        $game_system.se_play($data_system.cancel_se)
  652.        @command_window.active = false
  653.        @help_window.set_text("请选择.")
  654.        @savestate = 0
  655.        @option_window.active = true
  656.        return
  657.      end
  658.      
  659.      if Input.trigger?(Input::B)
  660.        $game_system.se_play($data_system.cancel_se)
  661.        @savestate = 2
  662.        @command_window.active = true

  663.        return
  664.      end
  665.    end
  666. end
  667. #--------------------------------------------------------------------------
  668. # 建立记录文件索引
  669. #--------------------------------------------------------------------------

  670. #--------------------------------------------------------------------------
  671. #  读取记录文件
  672. #     filename  : 被读取文件
  673. #--------------------------------------------------------------------------
  674. def load_file
  675.      # 文件不存在的情况下
  676.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  677.        # 演奏冻结 SE
  678.        $game_system.se_play($data_system.buzzer_se)
  679.        return
  680.      end
  681.      # 演奏读档 SE
  682.      $game_system.se_play($data_system.load_se)
  683.      # 写入存档数据
  684.      file = File.open( DIR+"Save#{@command_window.index}.rxdata", "rb")
  685.      read_save_data(file)
  686.      file.close
  687.      # 还原 BGM、BGS
  688.      $game_system.bgm_play($game_system.playing_bgm)
  689.      $game_system.bgs_play($game_system.playing_bgs)
  690.      # 刷新地图 (执行并行事件)
  691.      $game_map.update
  692.      # 切换到地图画面
  693.      $scene = Scene_Map.new
  694. end
  695. #--------------------------------------------------------------------------
  696. # ● 读取存档数据
  697. #     file : 读取用文件对像 (已经打开)
  698. #--------------------------------------------------------------------------
  699. def read_save_data(file)
  700.    # 读取描绘存档文件用的角色数据
  701.    characters = Marshal.load(file)
  702.    # 读取测量游戏时间用画面计数
  703.    Graphics.frame_count = Marshal.load(file)
  704.    # 读取各种游戏对像
  705.    $game_system        = Marshal.load(file)
  706.    $game_switches      = Marshal.load(file)
  707.    $game_variables     = Marshal.load(file)
  708.    $game_self_switches = Marshal.load(file)
  709.    $game_screen        = Marshal.load(file)
  710.    $game_actors        = Marshal.load(file)
  711.    $game_party         = Marshal.load(file)
  712.    $game_troop         = Marshal.load(file)
  713.    $game_map           = Marshal.load(file)
  714.    $game_player        = Marshal.load(file)
  715.    # 魔法编号与保存时有差异的情况下
  716.    # (加入编辑器的编辑过的数据)
  717.    if $game_system.magic_number != $data_system.magic_number
  718.      # 重新装载地图
  719.      $game_map.setup($game_map.map_id)
  720.      $game_player.center($game_player.x, $game_player.y)
  721.    end
  722.    # 刷新同伴成员
  723.    $game_party.refresh
  724. end
  725. #--------------------------------------------------------------------------
  726. # ● 写入存档文件
  727. #--------------------------------------------------------------------------
  728. def save_file
  729.    if Input.trigger?(Input::C)
  730.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  731.        # 演奏冻结 SE
  732.        # 演奏存档 SE
  733.          $game_system.se_play($data_system.save_se)
  734.          # 写入存档数据
  735.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  736.          write_save_data(file)
  737.          if FileTest.exist?( DIR+"shot.jpg")
  738.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  739.          end
  740.          file.close
  741.          $game_temp.last_file_index = @command_window.index
  742.          # 如果被事件调用
  743.          if $game_temp.save_calling
  744.            # 清除存档调用标志
  745.            $game_temp.save_calling = false
  746.            @confirm_window.dispose
  747.            # 切换到地图画面
  748.            $scene = Scene_Map.new   
  749.            return
  750.          end
  751.        # 切换到菜单画面
  752.          $scene = Scene_Map.new  
  753.      end
  754.      @yes_no_window.active = true
  755.      @command_window.active = false            
  756.    end
  757.    #———————————————————————#     
  758. end
  759. #-------------------------------------------------------------------
  760. def confirm_update
  761.    @command_index = @command_window.index
  762.    @confirm_window.visible = true
  763.    @confirm_window.z = 1500
  764.    @yes_no_window.visible = true
  765.    @yes_no_window.active = true
  766.    @yes_no_window.z = 1500
  767.    @yes_no_window.update
  768.    if Input.trigger?(Input::C)
  769.      if @yes_no_window.index == 0
  770.          #######################################################
  771.          # 演奏存档 SE
  772.          $game_system.se_play($data_system.save_se)
  773.          # 写入存档数据
  774.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  775.          write_save_data(file)
  776.          if FileTest.exist?( DIR+"shot.jpg")
  777.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  778.          end
  779.          file.close
  780.          $game_temp.last_file_index = @command_window.index
  781.          # 如果被事件调用
  782.          if $game_temp.save_calling
  783.            # 清除存档调用标志
  784.            $game_temp.save_calling = false
  785.            @confirm_window.dispose
  786.            @content_window.dispose
  787.            # 切换到地图画面
  788.            $scene = Scene_Map.new
  789.    
  790.            return
  791.          end
  792.        # 切换到菜单画面
  793.          $scene = Scene_Map.new        
  794.        else
  795.        @yes_no_window.visible = false
  796.        @confirm_window.visible = false
  797.        $game_system.se_play($data_system.cancel_se)
  798.        @yes_no_window.active = false
  799.        @command_window.active = true
  800.        end
  801.    end
  802.    if Input.trigger?(Input::B)
  803.      @yes_no_window.visible = false
  804.      @confirm_window.visible = false
  805.      $game_system.se_play($data_system.cancel_se)
  806.      @yes_no_window.active = false
  807.      @command_window.active = true
  808.    end
  809. end
  810. #--------------------------------------------------------------------------
  811. # ● 写入存档数据
  812. #     file : 写入用文件对像 (已经打开)
  813. #--------------------------------------------------------------------------
  814. def write_save_data(file)
  815.    # 生成描绘存档文件用的角色图形
  816.    characters = []
  817.    for i in 0...$game_party.actors.size
  818.      actor = $game_party.actors[i]
  819.      characters.push([actor.character_name, actor.character_hue, actor])
  820.    end
  821.    # 写入描绘存档文件用的角色数据
  822.    Marshal.dump(characters, file)
  823.    # 写入测量游戏时间用画面计数
  824.    Marshal.dump(Graphics.frame_count, file)
  825.    # 增加 1 次存档次数
  826.    $game_system.save_count += 1
  827.    # 保存魔法编号
  828.    # (将编辑器保存的值以随机值替换)
  829.    $game_system.magic_number = $data_system.magic_number
  830.    # 写入各种游戏对像
  831.    Marshal.dump($game_system, file)
  832.    Marshal.dump($game_switches, file)
  833.    Marshal.dump($game_variables, file)
  834.    Marshal.dump($game_self_switches, file)
  835.    Marshal.dump($game_screen, file)
  836.    Marshal.dump($game_actors, file)
  837.    Marshal.dump($game_party, file)
  838.    Marshal.dump($game_troop, file)
  839.    Marshal.dump($game_map, file)
  840.    Marshal.dump($game_player, file)
  841. end
  842. end

  843. #==============================================================================
  844. # ■ Window_LoadHelp
  845. #------------------------------------------------------------------------------
  846. #  存取档画面帮助信息的显示窗口。
  847. #==============================================================================

  848. class Window_LoadHelp < Window_Base
  849. #--------------------------------------------------------------------------
  850. #  初始化对象
  851. #--------------------------------------------------------------------------
  852. def initialize
  853. super(0, 0, 320, 64)
  854. self.contents = Bitmap.new(width - 32, height - 32)
  855. end
  856. #--------------------------------------------------------------------------
  857. #  刷新文本
  858. #--------------------------------------------------------------------------
  859. def set_text(text, align = 1)
  860. if text != @text or align != @align
  861.    self.contents.clear
  862.    self.contents.font.color = normal_color
  863.    self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  864.    @text = text
  865.    @align = align
  866.    @actor = nil
  867. end
  868. self.visible = true
  869. end
  870. end
复制代码

作者: 黑撒旦    时间: 2008-1-11 21:53
相关设置请按照脚本说明设置。
特别是“截图存取档脚本”

作者: cZooCz    时间: 2008-1-12 05:54
    for i in [email protected]
还是不行~~~~上面这句错误了~~~
作者: 黑撒旦    时间: 2008-1-12 06:09
在下测试的工程:

http://rpg.blue/upload_program/files/Project4_80518108.rar


作者: cZooCz    时间: 2008-1-12 06:49
我把那载图脚本扔了~~~~~~该改的也改会来了~~~~~但是在游戏中存得档可是读档却不得了~~~~~
作者: cZooCz    时间: 2008-1-12 06:53
前面之所以我的错你的对是不是这个的问题
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. # 作者:chaochao+66rpg的66
  4. #==============================================================================

  5. #==============================================================================
  6. #■ Scene_Title
  7. #------------------------------------------------------------------------------
  8. #  处理标题画面的类。
  9. #==============================================================================

  10. class Scene_Title
  11.   WEATHER = 4    # 使用自定义效果(0:无,1:雨,2:暴风雨,3:雪,4:自定义)
  12.   MAXNUMBER = 18  # 天气图片数量
  13.   
  14.   WEATHER_FILE = "Graphics/Pictures/流星.png"
  15.   # 自定义图片路径,这个文件可以从黑暗圣剑DEMO获得,是流星雨
  16.   
  17.   BLEND_TYPE = 0 # 合成方式(0:普通,1:加法,2:减法)
  18.   WEATHER_X = 5 # X方向每回合减少象素
  19.   WEATHER_Y = 5 # Y方向每回合减少象素
  20.   WEATHER_OPACITY = 2 #每回合减低透明度
  21.   START_OPACITY = 200 #出现时的透明度
  22.   RAND_X = 1200 # 随机X范围
  23.   RAND_Y = 600 # 随机Y范围
  24.   HEIGHT = -600 # 出现时候的屏幕Y
  25.   WIDTH = 100 # 出现时候的屏幕X
  26.   #--------------------------------------------------------------------------
  27.   # ● 主处理
  28.   #--------------------------------------------------------------------------
  29.   
  30.   def main
  31.     if $BTEST
  32.       battle_test
  33.       return
  34.     end
  35.     $data_actors = load_data("Data/Actors.rxdata")
  36.     $data_classes = load_data("Data/Classes.rxdata")
  37.     $data_skills = load_data("Data/Skills.rxdata")
  38.     $data_items = load_data("Data/Items.rxdata")
  39.     $data_weapons = load_data("Data/Weapons.rxdata")
  40.     $data_armors = load_data("Data/Armors.rxdata")
  41.     $data_enemies = load_data("Data/Enemies.rxdata")
  42.     $data_troops = load_data("Data/Troops.rxdata")
  43.     $data_states = load_data("Data/States.rxdata")
  44.     $data_animations = load_data("Data/Animations.rxdata")
  45.     $data_tilesets = load_data("Data/Tilesets.rxdata")
  46.     $data_common_events = load_data("Data/CommonEvents.rxdata")
  47.     $data_system = load_data("Data/System.rxdata")
  48.     $game_system = Game_System.new
  49.     # 生成标题图形
  50.     @sprite = Sprite.new
  51.     @sprite.bitmap = RPG::Cache.title($data_system.title_name)
  52.     @ox = 0
  53.     @oy = 0
  54.     color1 = Color.new(255,255,255, 255)
  55.     color2 = Color.new(255, 255, 255, 128)
  56.     @rain_bitmap = Bitmap.new(7, 56)
  57.     for i in 0..6
  58.       @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
  59.     end
  60.     @storm_bitmap = Bitmap.new(34, 64)
  61.     for i in 0..31
  62.       @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
  63.       @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
  64.       @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
  65.     end
  66.     @snow_bitmap = Bitmap.new(6, 6)
  67.     @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
  68.     @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
  69.     @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
  70.     @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
  71.     @sprites = []
  72.     for i in 1..40
  73.       sprite = Sprite.new
  74.       case WEATHER
  75.       when 1
  76.         sprite.bitmap = @rain_bitmap
  77.       when 2
  78.         sprite.bitmap = @storm_bitmap
  79.       when 3
  80.         sprite.bitmap = @snow_bitmap
  81.       when 4
  82.         sprite.bitmap = Bitmap.new(WEATHER_FILE)
  83.       end
  84.       sprite.z = 1000
  85.       sprite.x = -1000
  86.       sprite.y = -1000
  87.       sprite.visible = (i <= MAXNUMBER)
  88.       sprite.blend_type = BLEND_TYPE
  89.       sprite.opacity = START_OPACITY
  90.       @sprites.push(sprite)
  91.     end
  92.     weather_update

  93.     # 生成标题图形
  94.     @sprite = [Sprite.new]
  95.     for i in 0..6
  96.       @sprite[i] = Sprite.new
  97.       @sprite[i].opacity = 0
  98.     end
  99.     @sprite[0].bitmap = RPG::Cache.title($data_system.title_name)
  100.     @sprite[0].opacity = 0
  101.     #开始游戏的图片
  102.     @sprite[1].bitmap = Bitmap.new("Graphics/Pictures/开始1.png")
  103.     @sprite[2].bitmap = Bitmap.new("Graphics/Pictures/开始2.png")
  104.     #继续游戏的图片
  105.     @sprite[3].bitmap = Bitmap.new("Graphics/Pictures/继续1.png")
  106.     @sprite[4].bitmap = Bitmap.new("Graphics/Pictures/继续2.png")
  107.     #结束游戏的图片
  108.     @sprite[5].bitmap = Bitmap.new("Graphics/Pictures/退出1.png")
  109.     @sprite[6].bitmap = Bitmap.new("Graphics/Pictures/退出2.png")
  110.     #图片位置
  111.     for i in 1..6
  112.       x=75
  113.       y=(i+1)/2*45+240
  114.       @sprite[i].x =x
  115.       @sprite[i].y =y
  116.     end
  117.     @continue_enabled = false
  118.     for i in 0..3
  119.       if FileTest.exist?("Save/Save#{i}.rxdata")
  120.         @continue_enabled = true
  121.       end
  122.     end
  123.     if @continue_enabled
  124.       @command_index = 0
  125.     else
  126.       @command_index = 0
  127.       @sprite[4].bitmap = Bitmap.new("Graphics/Pictures/继续1.png")
  128.     end
  129.     $game_system.bgm_play($data_system.title_bgm)
  130.     Audio.me_stop
  131.     Audio.bgs_stop
  132.     Graphics.transition
  133.     loop do
  134.       Graphics.update
  135.       #淡出背景圖形
  136.       if @sprite[0].opacity <= 255
  137.         @sprite[0].opacity += 15
  138.       end
  139.       Input.update
  140.       update
  141.       if $scene != self
  142.         break
  143.       end
  144.     end
  145.     Graphics.freeze
  146.     # 釋放圖形
  147.     for i in 0..6
  148.       @sprite[i].bitmap.dispose
  149.       @sprite[i].dispose
  150.     end
  151.       for sprite in @sprites
  152.       sprite.dispose
  153.     end
  154.     @rain_bitmap.dispose
  155.     @storm_bitmap.dispose
  156.     @snow_bitmap.dispose
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 刷新天气
  160.   #--------------------------------------------------------------------------
  161.   def weather_update
  162.     return if WEATHER == 0
  163.     for i in 1..MAXNUMBER
  164.       sprite = @sprites[i]
  165.       if sprite == nil
  166.         break
  167.       end
  168.       if WEATHER == 1
  169.         sprite.x -= 2
  170.         sprite.y += 16
  171.         sprite.opacity -= 8
  172.       end
  173.       if WEATHER == 2
  174.         sprite.x -= 8
  175.         sprite.y += 16
  176.         sprite.opacity -= 12
  177.       end
  178.       if WEATHER == 3
  179.         sprite.x -= 2
  180.         sprite.y += 8
  181.         sprite.opacity -= 8
  182.       end
  183.       if WEATHER == 4
  184.         sprite.x -= WEATHER_X
  185.         sprite.y += WEATHER_Y
  186.         sprite.opacity -= WEATHER_OPACITY
  187.       end
  188.       x = sprite.x - @ox
  189.       y = sprite.y - @oy
  190.       if sprite.opacity < 32 or x < -100 or x > 750 or y < -1000 or y > 500
  191.         sprite.x = rand(RAND_X) + WIDTH + @ox
  192.         sprite.y = rand(RAND_Y) + HEIGHT + @oy
  193.         sprite.opacity = START_OPACITY
  194.       end
  195.     end
  196.   end


  197.   def update
  198.   chaochaocommandchaochao
  199.   if Input.trigger?(Input::C)
  200.     case @command_index
  201.       when 0
  202.         command_new_game
  203.       when 1
  204.         command_continue
  205.       when 2
  206.         command_shutdown
  207.       end
  208.     end
  209.     weather_update
  210.   end
  211.   
  212.   def chaochaocommandchaochao
  213.     if Input.trigger?(Input::UP)
  214.       @command_index -= 1
  215.       if @command_index < 0
  216.         @command_index = 2
  217.       end
  218.       $game_system.se_play($data_system.cursor_se)
  219.     end
  220.     if Input.trigger?(Input::DOWN)
  221.       @command_index += 1
  222.       if @command_index > 2
  223.         @command_index = 0
  224.       end
  225.       $game_system.se_play($data_system.cursor_se)
  226.     end
  227.     case @command_index
  228.     when 0
  229.       if @sprite[1].opacity >= 0
  230.         @sprite[1].opacity -= 30
  231.       end
  232.       if @sprite[2].opacity <= 240
  233.         @sprite[2].opacity += 30
  234.       end
  235.       if @sprite[3].opacity <= 210
  236.         @sprite[3].opacity += 30
  237.       end
  238.       if @sprite[4].opacity >= 0
  239.         @sprite[4].opacity -= 30
  240.       end
  241.       if @sprite[5].opacity <= 210
  242.         @sprite[5].opacity += 30
  243.       end
  244.       if @sprite[6].opacity >= 0
  245.         @sprite[6].opacity -= 30
  246.       end
  247.     when 1
  248.       if @sprite[1].opacity <= 210
  249.         @sprite[1].opacity += 30
  250.       end
  251.       if @sprite[2].opacity >= 0
  252.         @sprite[2].opacity -= 30
  253.       end
  254.       if @sprite[3].opacity >= 0
  255.         @sprite[3].opacity -= 30
  256.       end
  257.       if @sprite[4].opacity <= 240
  258.         @sprite[4].opacity += 30
  259.       end
  260.       if @sprite[5].opacity <= 210
  261.         @sprite[5].opacity += 30
  262.       end
  263.       if @sprite[6].opacity >= 0
  264.         @sprite[6].opacity -= 30
  265.       end
  266.     when 2
  267.       if @sprite[1].opacity <= 210
  268.         @sprite[1].opacity += 30
  269.       end
  270.       if @sprite[2].opacity >= 0
  271.         @sprite[2].opacity -= 30
  272.       end
  273.       if @sprite[3].opacity <= 210
  274.         @sprite[3].opacity += 30
  275.       end
  276.       if @sprite[4].opacity >= 0
  277.         @sprite[4].opacity -= 30
  278.       end
  279.       if @sprite[5].opacity >= 0
  280.         @sprite[5].opacity -= 30
  281.       end
  282.       if @sprite[6].opacity <= 240
  283.         @sprite[6].opacity += 30
  284.       end
  285.     end
  286.   end
  287. end

  288. # ————————————————————————————————————
  289. # 本脚本来自www.66rpg.com,转载请保留此信息
  290. # ————————————————————————————————————

  291. class Interpreter
  292.   
  293.   BOOK_READING = 50 # 默认打开50开关后进入读书系统
  294.   
  295.   #--------------------------------------------------------------------------
  296.   # ● 显示文章
  297.   #--------------------------------------------------------------------------
  298.   def command_101
  299.     # 另外的文章已经设置过 message_text 的情况下
  300.     if $game_temp.message_text != nil
  301.       # 结束
  302.       return false
  303.     end
  304.     # 设置信息结束后待机和返回调用标志
  305.     @message_waiting = true
  306.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  307.     # message_text 设置为 1 行
  308.     $game_temp.message_text = @list[@index].parameters[0] + "\n"
  309.     line_count = 1
  310.     # 循环
  311.     loop do
  312.       # 下一个事件指令为文章两行以上的情况
  313.       if $game_switches[BOOK_READING] and @list[@index+1].code == 101#阅读书刊报纸
  314.         unless $game_temp.in_battle
  315.           $scene.message_window.height = 320
  316.           $scene.message_window.contents = Bitmap.new($scene.message_window.width - 32, $scene.message_window.height - 32)
  317.           $scene.message_window.contents.font.size = 20
  318.           $game_temp.message_text += @list[@index+1].parameters[0] +"\n"
  319.           line_count+=1
  320.           @index+=1
  321.         end
  322.       end
  323.       if $game_switches[BOOK_READING]==false
  324.         unless $game_temp.in_battle
  325.           if $scene.message_window.height == 320
  326.             $scene.message_window.height = 160
  327.             $scene.message_window.contents = Bitmap.new($scene.message_window.width - 32, $scene.message_window.height - 32)
  328.             $scene.message_window.contents.font.size = 22
  329.           end
  330.         end
  331.       end
  332.       if @list[@index+1].code == 401
  333.         # message_text 添加到第 2 行以下
  334.         $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
  335.         line_count += 1
  336.       # 事件指令不在文章两行以下的情况
  337.       else
  338.         # 下一个事件指令为显示选择项的情况下
  339.         if @list[@index+1].code == 102
  340.           # 如果选择项能收纳在画面里
  341.           if @list[@index+1].parameters[0].size <= 4 - line_count
  342.             # 推进索引
  343.             @index += 1
  344.             # 设置选择项
  345.             $game_temp.choice_start = line_count
  346.             setup_choices(@list[@index].parameters)
  347.           end
  348.         # 下一个事件指令为处理输入数值的情况下
  349.         elsif @list[@index+1].code == 103
  350.           # 如果数值输入窗口能收纳在画面里
  351.           if line_count < 4
  352.             # 推进索引
  353.             @index += 1
  354.             # 设置输入数值
  355.             $game_temp.num_input_start = line_count
  356.             $game_temp.num_input_variable_id = @list[@index].parameters[0]
  357.             $game_temp.num_input_digits_max = @list[@index].parameters[1]
  358.           end
  359.         end
  360.         # 继续
  361.         return true
  362.       end
  363.       # 推进索引
  364.       @index += 1
  365.     end
  366.   end
  367. end

  368. class Scene_Map
  369.   attr_accessor :message_window
  370. end

  371. #==============================================================================
  372. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  373. #==============================================================================
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1