Project1

标题: 吸血脚本出错错误 [打印本页]

作者: 无忧谷主幻    时间: 2015-12-3 15:02
标题: 吸血脚本出错错误
也并不是每次战斗都出错,这次出错的结果是混乱(普通攻击敌人)或失明(普通攻击同伴)解除后普通攻击弹出的,当然具体我也不知道究竟什么时候会弹出

RUBY 代码复制
  1. $xh ={}
  2. $xh[103] =[256,100]
  3. $xh[104] =[256,200]
  4. $xh[140] =[256,200]
  5.  
  6. class Scene_Battle
  7.     def update_phase4_step5
  8.     # 隐藏帮助窗口
  9.     @help_window.visible = false
  10.     # 刷新状态窗口
  11.     @status_window.refresh
  12.     # 显示伤害
  13.     for target in @target_battlers
  14.       if target.damage != nil
  15.         target.damage_pop = true
  16.       end
  17.     end
  18.     # 条件分歧 开始 当角色使用吸收HP技能
  19.     if $xh.include?(@active_battler.current_action.skill_id)   
  20.       # 条件分歧 开始 当原始伤害不为nil和大于1
  21.       if target.damage != nil and target.damage > 1
  22.         # 播放动画
  23.         @active_battler.animation_id =$xh[@active_battler.current_action.skill_id][0]
  24.         # 显示回血
  25.  
  26.         @active_battler.damage = -(target.damage * $xh[@active_battler.current_action.skill_id][1] /100.0 ).truncate       #额,好吧,弄成整数就行了.
  27.         @active_battler.damage_pop = true
  28.         # 恢复HP
  29.         @active_battler.hp += (target.damage *  $xh[@active_battler.current_action.skill_id][1] /100.0  ).truncate    #额,好吧,弄成整数就行了.
  30.       # 条件分歧 结束
  31.       end
  32.     # 条件分歧 结束
  33.     end
  34.     # 移至步骤 6
  35.     @phase4_step = 6
  36.   end
  37. end

作者: myownroc    时间: 2015-12-3 20:53
字符串和数值进行比较=。=
如果截图里的21行就是脚本里的21行的话,用.class方法检查一下target.damage是不是字符串……
不过我记得target.damage是数值啊……
作者: RyanBern    时间: 2015-12-8 09:14
脚本21行,改成
RUBY 代码复制
  1. if target.damage.is_a?(Numeric) && target.damage > 1





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