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

Project1

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

请问如何解决RTAB和技能发动前调用公共事件的冲突呢?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2007-6-22
帖子
137
跳转到指定楼层
1
发表于 2007-7-4 02:39:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用的是RTAB战斗系统,想实现在技能伤害和动画发布之前就调用这个技能带的公共事件,公共事件执行完毕后再执行这个技能的动画和伤害。搜索到这个代码:

  1. class Scene_Battle
  2.   #--------------------------------------------------------------------------
  3.   # ● 刷新画面
  4.   #--------------------------------------------------------------------------
  5.   def update
  6.     # 执行战斗事件中的情况下
  7.     if $game_system.battle_interpreter.running?
  8.       # 刷新解释器
  9.       $game_system.battle_interpreter.update
  10.       # 强制行动的战斗者不存在的情况下
  11.       if $game_temp.forcing_battler == nil
  12.         # 执行战斗事件结束的情况下
  13.         unless $game_system.battle_interpreter.running?
  14.           # 继续战斗的情况下、再执行战斗事件的设置
  15.           unless @common_event_id != 0
  16.             unless judge
  17.               setup_battle_event
  18.             end
  19.           end
  20.         end
  21.         # 如果不是结束战斗回合的情况下
  22.         if @phase != 5 and @common_event_id == 0
  23.           # 刷新状态窗口
  24.           @status_window.refresh
  25.         end
  26.       end
  27.     end
  28.     # 系统 (计时器)、刷新画面
  29.     $game_system.update
  30.     $game_screen.update
  31.     # 计时器为 0 的情况下
  32.     if $game_system.timer_working and $game_system.timer == 0
  33.       # 中断战斗
  34.       $game_temp.battle_abort = true
  35.     end
  36.     # 刷新窗口
  37.     @help_window.update
  38.     @party_command_window.update
  39.     @actor_command_window.update
  40.     @status_window.update
  41.     @message_window.update
  42.     # 刷新活动块
  43.     @spriteset.update
  44.     # 处理过渡中的情况下
  45.     if $game_temp.transition_processing
  46.       # 清除处理过渡中标志
  47.       $game_temp.transition_processing = false
  48.       # 执行过渡
  49.       if $game_temp.transition_name == ""
  50.         Graphics.transition(20)
  51.       else
  52.         Graphics.transition(40, "Graphics/Transitions/" +
  53.           $game_temp.transition_name)
  54.       end
  55.     end
  56.     # 显示信息窗口中的情况下
  57.     if $game_temp.message_window_showing
  58.       return
  59.     end
  60.     # 显示效果中的情况下
  61.     if @spriteset.effect?
  62.       return
  63.     end
  64.     # 游戏结束的情况下
  65.     if $game_temp.gameover
  66.       # 切换到游戏结束画面
  67.       $scene = Scene_Gameover.new
  68.       return
  69.     end
  70.     # 返回标题画面的情况下
  71.     if $game_temp.to_title
  72.       # 切换到标题画面
  73.       $scene = Scene_Title.new
  74.       return
  75.     end
  76.     # 中断战斗的情况下
  77.     if $game_temp.battle_abort
  78.       # 还原为战斗前的 BGM
  79.       $game_system.bgm_play($game_temp.map_bgm)
  80.       # 战斗结束
  81.       battle_end(1)
  82.       return
  83.     end
  84.     # 等待中的情况下
  85.     if @wait_count > 0
  86.       # 减少等待计数
  87.       @wait_count -= 1
  88.       return
  89.     end
  90.     # 强制行动的角色存在、
  91.     # 并且战斗事件正在执行的情况下
  92.     if $game_temp.forcing_battler == nil and
  93.        $game_system.battle_interpreter.running?
  94.       return
  95.     end
  96.     # 回合分支
  97.     case @phase
  98.     when 1  # 自由战斗回合
  99.       update_phase1
  100.     when 2  # 同伴命令回合
  101.       update_phase2
  102.     when 3  # 角色命令回合
  103.       update_phase3
  104.     when 4  # 主回合
  105.       update_phase4
  106.     when 5  # 战斗结束回合
  107.       update_phase5
  108.     end
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  112.   #--------------------------------------------------------------------------
  113.   def update_phase4_step3
  114.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  115.     if @animation1_id == 0
  116.       @active_battler.white_flash = true
  117.     else
  118.       @active_battler.animation_id = @animation1_id
  119.       @active_battler.animation_hit = true
  120.     end
  121.     # 公共事件 ID 有效的情况下
  122.     if @common_event_id > 0
  123.       # 设置事件
  124.       common_event = $data_common_events[@common_event_id]
  125.       $game_system.battle_interpreter.setup(common_event.list, 0)
  126.     end
  127.     # 移至步骤 4
  128.     @phase4_step = 4
  129.   end

  130.   def update_phase4_step4
  131.     # 对像方动画
  132.     for target in @target_battlers
  133.       target.animation_id = @animation2_id
  134.       target.animation_hit = (target.damage != "Miss")
  135.     end
  136.     if @show_skill_name
  137.       @help_window.set_text(@skill.name, 1)
  138.       @show_skill_name = false
  139.     end
  140.     # 限制动画长度、最低 8 帧
  141.     @wait_count = 8
  142.     # 移至步骤 5
  143.     @phase4_step = 5
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  147.   #--------------------------------------------------------------------------
  148.   def update_phase4_step5
  149.     # 隐藏帮助窗口
  150.     @help_window.visible = false
  151.     # 刷新状态窗口
  152.     @status_window.refresh
  153.     # 显示伤害
  154.     for target in @target_battlers
  155.       if target.damage != nil
  156.         target.damage_pop = true
  157.       end
  158.     end
  159.     if @active_battler.damage != nil
  160.       @active_battler.damage_pop = true
  161.     end
  162.     # 移至步骤 6
  163.     @phase4_step = 6
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  167.   #--------------------------------------------------------------------------
  168.   def update_phase4_step6
  169.     # 清除强制行动对像的战斗者
  170.     $game_temp.forcing_battler = nil
  171.     # 移至步骤 1
  172.     @phase4_step = 1
  173.   end
  174.   
  175.   def make_skill_action_result
  176.     # 获取特技
  177.     @skill = $data_skills[@active_battler.current_action.skill_id]
  178.     # 如果不是强制行动
  179.     unless @active_battler.current_action.forcing
  180.       # 因为 SP 耗尽而无法使用的情况下
  181.       unless @active_battler.skill_can_use?(@skill.id)
  182.         # 清除强制行动对像的战斗者
  183.         $game_temp.forcing_battler = nil
  184.         # 移至步骤 1
  185.         @phase4_step = 1
  186.         return
  187.       end
  188.     end
  189.     # 消耗 SP
  190.     @active_battler.sp -= @skill.sp_cost
  191.     # 刷新状态窗口
  192.     @status_window.refresh
  193.     # 设置动画 ID
  194.     @animation1_id = @skill.animation1_id
  195.     @animation2_id = @skill.animation2_id
  196.    
  197.     @show_skill_name = true
  198.     # 设置公共事件 ID
  199.     @common_event_id = @skill.common_event_id
  200.     # 设置对像侧战斗者
  201.     set_target_battlers(@skill.scope)
  202.     # 应用特技效果
  203.     for target in @target_battlers
  204.       target.skill_effect(@active_battler, @skill)
  205.     end
  206.   end
  207. end
复制代码



但是会起冲突,说是

    # 刷新窗口
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update

这里有问题……茫然,请求指教
KOFIA CHAOS-MAX 混沌之战-极限 剧情2% 系统10% 卡片制作 - -刚出模版 自开了个BLOG报告进度……[http://blog.sina.com.cn/zhanghaozing]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2007-6-22
帖子
137
2
 楼主| 发表于 2007-7-4 02:39:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用的是RTAB战斗系统,想实现在技能伤害和动画发布之前就调用这个技能带的公共事件,公共事件执行完毕后再执行这个技能的动画和伤害。搜索到这个代码:

  1. class Scene_Battle
  2.   #--------------------------------------------------------------------------
  3.   # ● 刷新画面
  4.   #--------------------------------------------------------------------------
  5.   def update
  6.     # 执行战斗事件中的情况下
  7.     if $game_system.battle_interpreter.running?
  8.       # 刷新解释器
  9.       $game_system.battle_interpreter.update
  10.       # 强制行动的战斗者不存在的情况下
  11.       if $game_temp.forcing_battler == nil
  12.         # 执行战斗事件结束的情况下
  13.         unless $game_system.battle_interpreter.running?
  14.           # 继续战斗的情况下、再执行战斗事件的设置
  15.           unless @common_event_id != 0
  16.             unless judge
  17.               setup_battle_event
  18.             end
  19.           end
  20.         end
  21.         # 如果不是结束战斗回合的情况下
  22.         if @phase != 5 and @common_event_id == 0
  23.           # 刷新状态窗口
  24.           @status_window.refresh
  25.         end
  26.       end
  27.     end
  28.     # 系统 (计时器)、刷新画面
  29.     $game_system.update
  30.     $game_screen.update
  31.     # 计时器为 0 的情况下
  32.     if $game_system.timer_working and $game_system.timer == 0
  33.       # 中断战斗
  34.       $game_temp.battle_abort = true
  35.     end
  36.     # 刷新窗口
  37.     @help_window.update
  38.     @party_command_window.update
  39.     @actor_command_window.update
  40.     @status_window.update
  41.     @message_window.update
  42.     # 刷新活动块
  43.     @spriteset.update
  44.     # 处理过渡中的情况下
  45.     if $game_temp.transition_processing
  46.       # 清除处理过渡中标志
  47.       $game_temp.transition_processing = false
  48.       # 执行过渡
  49.       if $game_temp.transition_name == ""
  50.         Graphics.transition(20)
  51.       else
  52.         Graphics.transition(40, "Graphics/Transitions/" +
  53.           $game_temp.transition_name)
  54.       end
  55.     end
  56.     # 显示信息窗口中的情况下
  57.     if $game_temp.message_window_showing
  58.       return
  59.     end
  60.     # 显示效果中的情况下
  61.     if @spriteset.effect?
  62.       return
  63.     end
  64.     # 游戏结束的情况下
  65.     if $game_temp.gameover
  66.       # 切换到游戏结束画面
  67.       $scene = Scene_Gameover.new
  68.       return
  69.     end
  70.     # 返回标题画面的情况下
  71.     if $game_temp.to_title
  72.       # 切换到标题画面
  73.       $scene = Scene_Title.new
  74.       return
  75.     end
  76.     # 中断战斗的情况下
  77.     if $game_temp.battle_abort
  78.       # 还原为战斗前的 BGM
  79.       $game_system.bgm_play($game_temp.map_bgm)
  80.       # 战斗结束
  81.       battle_end(1)
  82.       return
  83.     end
  84.     # 等待中的情况下
  85.     if @wait_count > 0
  86.       # 减少等待计数
  87.       @wait_count -= 1
  88.       return
  89.     end
  90.     # 强制行动的角色存在、
  91.     # 并且战斗事件正在执行的情况下
  92.     if $game_temp.forcing_battler == nil and
  93.        $game_system.battle_interpreter.running?
  94.       return
  95.     end
  96.     # 回合分支
  97.     case @phase
  98.     when 1  # 自由战斗回合
  99.       update_phase1
  100.     when 2  # 同伴命令回合
  101.       update_phase2
  102.     when 3  # 角色命令回合
  103.       update_phase3
  104.     when 4  # 主回合
  105.       update_phase4
  106.     when 5  # 战斗结束回合
  107.       update_phase5
  108.     end
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  112.   #--------------------------------------------------------------------------
  113.   def update_phase4_step3
  114.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  115.     if @animation1_id == 0
  116.       @active_battler.white_flash = true
  117.     else
  118.       @active_battler.animation_id = @animation1_id
  119.       @active_battler.animation_hit = true
  120.     end
  121.     # 公共事件 ID 有效的情况下
  122.     if @common_event_id > 0
  123.       # 设置事件
  124.       common_event = $data_common_events[@common_event_id]
  125.       $game_system.battle_interpreter.setup(common_event.list, 0)
  126.     end
  127.     # 移至步骤 4
  128.     @phase4_step = 4
  129.   end

  130.   def update_phase4_step4
  131.     # 对像方动画
  132.     for target in @target_battlers
  133.       target.animation_id = @animation2_id
  134.       target.animation_hit = (target.damage != "Miss")
  135.     end
  136.     if @show_skill_name
  137.       @help_window.set_text(@skill.name, 1)
  138.       @show_skill_name = false
  139.     end
  140.     # 限制动画长度、最低 8 帧
  141.     @wait_count = 8
  142.     # 移至步骤 5
  143.     @phase4_step = 5
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  147.   #--------------------------------------------------------------------------
  148.   def update_phase4_step5
  149.     # 隐藏帮助窗口
  150.     @help_window.visible = false
  151.     # 刷新状态窗口
  152.     @status_window.refresh
  153.     # 显示伤害
  154.     for target in @target_battlers
  155.       if target.damage != nil
  156.         target.damage_pop = true
  157.       end
  158.     end
  159.     if @active_battler.damage != nil
  160.       @active_battler.damage_pop = true
  161.     end
  162.     # 移至步骤 6
  163.     @phase4_step = 6
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  167.   #--------------------------------------------------------------------------
  168.   def update_phase4_step6
  169.     # 清除强制行动对像的战斗者
  170.     $game_temp.forcing_battler = nil
  171.     # 移至步骤 1
  172.     @phase4_step = 1
  173.   end
  174.   
  175.   def make_skill_action_result
  176.     # 获取特技
  177.     @skill = $data_skills[@active_battler.current_action.skill_id]
  178.     # 如果不是强制行动
  179.     unless @active_battler.current_action.forcing
  180.       # 因为 SP 耗尽而无法使用的情况下
  181.       unless @active_battler.skill_can_use?(@skill.id)
  182.         # 清除强制行动对像的战斗者
  183.         $game_temp.forcing_battler = nil
  184.         # 移至步骤 1
  185.         @phase4_step = 1
  186.         return
  187.       end
  188.     end
  189.     # 消耗 SP
  190.     @active_battler.sp -= @skill.sp_cost
  191.     # 刷新状态窗口
  192.     @status_window.refresh
  193.     # 设置动画 ID
  194.     @animation1_id = @skill.animation1_id
  195.     @animation2_id = @skill.animation2_id
  196.    
  197.     @show_skill_name = true
  198.     # 设置公共事件 ID
  199.     @common_event_id = @skill.common_event_id
  200.     # 设置对像侧战斗者
  201.     set_target_battlers(@skill.scope)
  202.     # 应用特技效果
  203.     for target in @target_battlers
  204.       target.skill_effect(@active_battler, @skill)
  205.     end
  206.   end
  207. end
复制代码



但是会起冲突,说是

    # 刷新窗口
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update

这里有问题……茫然,请求指教
KOFIA CHAOS-MAX 混沌之战-极限 剧情2% 系统10% 卡片制作 - -刚出模版 自开了个BLOG报告进度……[http://blog.sina.com.cn/zhanghaozing]
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2025-9-21 21:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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