Project1

标题: 使用技能脚本错误 [打印本页]

作者: 黑米馒头    时间: 2022-8-24 23:23
标题: 使用技能脚本错误
使用复活技能的时候,脚本出错,啥情况?








RUBY 代码复制
  1. # 受到伤害的情况【改变战斗图位置】
  2.     # 排除捕捉和防御的情况
  3.     if @active_battler.current_action.kind != 3 and
  4.       @active_battler.current_action.basic != 1 and
  5.       target.damage == "Miss" or target.damage.to_i > 0
  6.  
  7.       # 当战斗者为敌人的情况  
  8.       if @active_battler.is_a?(Game_Enemy)
  9.         @a = 8 #抖动幅度【往左上挪动】
  10.       elsif @active_battler.is_a?(Game_Actor)
  11.         @a = -8 #抖动幅度【往右下挪动】
  12.       end
  13.  
  14.       # 【挨打移动】位置
  15.       if @target_battlers.size == 1
  16.         @target_battlers[0].movex = @a
  17.         @target_battlers[0].movey = @a
  18.       else
  19.         for target in @target_battlers      
  20.           target.movex = @a
  21.           target.movey = @a
  22.         end
  23.       end
  24.  
  25.     end

作者: alexncf125    时间: 2022-8-24 23:53
所以这个target在哪赋值了啊??
作者: 我为鱼肉    时间: 2022-8-25 08:52
本帖最后由 我为鱼肉 于 2022-8-25 14:38 编辑

RUBY 代码复制
  1. # 受到伤害的情况【改变战斗图位置】
  2.     # 排除捕捉和防御的情况
  3.     if @active_battler.current_action.kind != 3 and
  4.       @active_battler.current_action.basic != 1
  5.  
  6.  
  7.  
  8.       # 【挨打移动】位置
  9.       for target in @target_battlers      
  10.         next if target.damage == "Miss" or target.damage.to_i <= 0
  11.         target.movex = @active_battler.is_a?(Game_Enemy) ? 8 : -8
  12.         target.movey = target.movex
  13.       end
  14.  
  15.   end

作者: 黑米馒头    时间: 2022-8-25 12:09
我为鱼肉 发表于 2022-8-25 08:52
# 受到伤害的情况【改变战斗图位置】
    # 排除捕捉和防御的情况
    if @active_battler.current_action. ...

还是有点问题,我刚开始那么该,是因为我想让目标【敌人或角色】受到攻击的时候,战斗图会移动几步,形成挨打的效果,别的效果都做好了,但是施法的时候就不行,因为法术分为敌方和我方,法术用到敌人身上的时候,敌人受伤然后战斗图移动,但是现在类似加血的法术,用到自己或队友身上的时候,也会移动战斗图,这就有点奇怪了,所以我就改成面那样,当伤害>0 的时候才会移动战斗图,然后就有BUG了




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