Project1

标题: 特技中的公共事件顺序 [打印本页]

作者: RPG河童    时间: 2010-9-9 15:59
标题: 特技中的公共事件顺序
本帖最后由 RPG河童 于 2010-9-9 19:54 编辑

请教一下大家:我在特技中加入了一个“显示图片”,“等待”,“图片消失”的公共事件。结果每次使用特技时按 Scene_Battle 中默认的顺序是:
主回合步骤 1 : 准备行动
主回合步骤 2 : 开始行动
主回合步骤 3 : 行动方动画
主回合步骤 4 : 对像方动画
主回合步骤 5 : 显示伤害
主回合步骤 6 : 刷新
其中步骤6中的内容是对公共事件的播放。于是我改变了执行的顺序,让脚本执行完步骤2后执行步骤6,然后再执行步骤3。结果公共事件确实在行动之前播放了,可是当最后一个敌人被该特技消灭后,只播放了一下公共事件,然后直接就战斗结束了,没有了行动方动画等等。是之前的操作有哪里不对吗?
以下是改动过的脚本(红色为改动位置):
#--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 2 : 开始行动)
  #--------------------------------------------------------------------------
  def update_phase4_step2
    # 如果不是强制行动
    unless @active_battler.current_action.forcing
      # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
      if @active_battler.restriction == 2 or @active_battler.restriction == 3
        # 设置行动为攻击
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
      end
      # 限制为 [不能行动] 的情况下
      if @active_battler.restriction == 4
        # 清除行动强制对像的战斗者
        $game_temp.forcing_battler = nil
        # 移至步骤 1
        @phase4_step = 1
        return
      end
    end
    # 清除对像战斗者
    @target_battlers = []
    # 行动种类分支
    case @active_battler.current_action.kind
    when 0  # 基本
      make_basic_action_result
    when 1  # 特技
      make_skill_action_result
    when 2  # 物品
      make_item_action_result
    end
    # 移至步骤 3
    if @phase4_step == 2
      @phase4_step = 6    end
  end
            .
            .
            .
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  #--------------------------------------------------------------------------
  def update_phase4_step3
    # 行动方动画 (ID 为 0 的情况下是白色闪烁)
    if @animation1_id == 0
      @active_battler.white_flash = true
    else
      @active_battler.animation_id = @animation1_id
      @active_battler.animation_hit = true
    end
    # 移至步骤 4
    @phase4_step = 4
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  #--------------------------------------------------------------------------
  def update_phase4_step4
    # 对像方动画
    for target in @target_battlers
      target.animation_id = @animation2_id
      target.animation_hit = (target.damage != "Miss")
    end
    # 限制动画长度、最低 8 帧
    @wait_count = 8
    # 移至步骤 5
    @phase4_step = 5
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  #--------------------------------------------------------------------------
  def update_phase4_step5
    # 隐藏帮助窗口
    @help_window.visible = false
    # 刷新状态窗口
    @status_window.refresh
    # 显示伤害
    for target in @target_battlers
      if target.damage != nil
        target.damage_pop = true
      end
    end
    # 移至步骤 6
   @phase4_step = 1  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 6 : 刷新)
  #--------------------------------------------------------------------------
  def update_phase4_step6
    # 清除强制行动对像的战斗者
    $game_temp.forcing_battler = nil
    # 公共事件 ID 有效的情况下
    if @common_event_id > 0
      # 设置事件
      common_event = $data_common_events[@common_event_id]
      $game_system.battle_interpreter.setup(common_event.list, 0)
    end
    # 移至步骤 1
    @phase4_step = 3  end


本想自己解决,不麻烦大家了。可实在不知道到底问题出在哪里,希望大家帮忙解决一下。谢谢啦!
作者: 叶子    时间: 2010-9-9 16:21
    # 公共事件 ID 有效的情况下
    if @common_event_id > 0
      # 设置事件
      common_event = $data_common_events[@common_event_id]
      $game_system.battle_interpreter.setup(common_event.list, 0)
    end
你直接把这段移到update_phase4_step2结尾执行可能会更好
作者: RPG河童    时间: 2010-9-9 16:50
回复 叶子 的帖子
多谢回帖。用了你说的方法了,可是还是会出现同样的问题……

   
作者: 叶子    时间: 2010-9-9 17:02
回复 RPG河童 的帖子


如果用上面的那种方法就不要改变各种step的顺序了o.o
作者: RPG河童    时间: 2010-9-9 17:16
回复 叶子 的帖子
啊,是啊。顺序也已经该回来了。而且为了不让公共事件再次发生,在第五步之后就直接移至步骤1了。可效果是一样的啊!

   
作者: 叶子    时间: 2010-9-9 17:43
本帖最后由 叶子 于 2010-9-9 17:44 编辑

我错了..主要是update方法中的unless judge那行导致随时都在判定是否战斗结束..

请参考这个
http://rpg.blue/web/htm/news19.htm
这个脚本中在unless judge之前加了个unless @common_event_id != 0的判定

作者: RPG河童    时间: 2010-9-9 19:29
回复 叶子 的帖子

:D 噢,太感谢了,问题解决了。多谢多谢!
   
作者: 叶子    时间: 2010-9-9 19:34
回复 RPG河童 的帖子


不好意思,之前误导了一下




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