Project1

标题: 脚本错误(有图)!麻烦各位看下... [打印本页]

作者: zyq11321    时间: 2008-5-31 22:46
标题: 脚本错误(有图)!麻烦各位看下...
#--------------------------------------------------------------------------
# ● 通常攻撃の効果適用
#     attacker : 攻撃者 (バトラー)
#--------------------------------------------------------------------------
def attack_effect(attacker)
   # クリティカルフラグをクリア   
   self.critical[attacker] = false  #《--显示出错的地方
   state_p[attacker] = []
   state_m[attacker] = []
   
   # 第一命中判定
   hit_result = (rand(100) < attacker.hit)
   # 命中の場合
   if hit_result == true
     #暴击率加成(默认为0)
     criticalrate = 0
   # 基本ダメージを計算
     atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage[attacker] = atk * (20 + attacker.str) / 20
     #========66原脚本◎改======================
   if attacker.is_a?(Game_Actor)and attacker.weapon_id != 0  #当武器含有20号属性的时候,攻击消耗100SP
    if $data_weapons[attacker.weapon_id].element_set.include?(20)
      self.damage[attacker] *= [100,attacker.sp].min
      self.damage[attacker] /= 100
      attacker.sp -= [100,attacker.sp].min #如果SP不足100,则按比例减少伤害值
      #+暴击(criticalrate = 增加的暴击率)
      criticalrate = 100
    end
  end  
  #=======================
     # 属性修正
     self.damage[attacker] *= elements_correct(attacker.element_set)
     self.damage[attacker] /= 100
     # ダメージの符号が正の場合
     if self.damage[attacker] > 0
       # クリティカル修正(加成暴击率)
       if rand(100) < 4 * attacker.dex / self.agi + criticalrate
         self.damage[attacker] *= 2
         self.critical[attacker] = true
       end
       # 防御修正
       if self.guarding?
         self.damage[attacker] /= 2
       end
     end
     # 分散
     if self.damage[attacker].abs > 0
       amp = [self.damage[attacker].abs * 15 / 100, 1].max
       self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
     end
     # 第二命中判定
     eva = 8 * self.agi / attacker.dex + self.eva
     hit = self.damage[attacker] < 0 ? 100 : 100 - eva
     hit = self.cant_evade? ? 100 : hit
     hit_result = (rand(100) < hit)
   end
   # 命中の場合
   if hit_result == true
     # ステート衝撃解除
     remove_states_shock
     # HP からダメージを減算
     # ステート変化
     @state_changed = false
     states_plus(attacker, attacker.plus_state_set)
     states_minus(attacker, attacker.minus_state_set)
   # ミスの場合
   else
     # ダメージに "Miss" を設定
     self.damage[attacker] = "Miss"
     # クリティカルフラグをクリア
     self.critical[attacker] = false
   end
   # メソッド終了
   return true
end

使用脚本进入战斗以后就会出现上图的情况,自己找不到原因,郁闷哦~
请懂脚本的朋友帮忙修改下。 [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: 禾西    时间: 2008-5-31 22:59
方法
attr_accessor :critical
被幹掉了...
在那個def attack_effect(attacker)
的上面加個看看行不行 ==a
作者: 3535    时间: 2008-5-31 23:00
self.critical[attacker] = false

那些damage和critical都不是数组,把[attacker]全删掉。
作者: wy29    时间: 2008-5-31 23:04
提示: 作者被禁止或删除 内容自动屏蔽
作者: 禾西    时间: 2008-5-31 23:06
原來如此...
我果然睏了。跑去睡覺 XD
作者: havealook    时间: 2008-5-31 23:08
把出错的地方全部注释掉(表PIA我。。){/gg}{/gg}
作者: zyq11321    时间: 2008-5-31 23:18
按2L的不行
按3L的做则会出现:ArgumentError wrong number of arguments (2 for 1)
然后脚本显示在:
states_plus(attacker, attacker.plus_state_set)
states_minus(attacker, attacker.minus_state_set)

作者: wy29    时间: 2008-6-1 08:43
提示: 作者被禁止或删除 内容自动屏蔽
作者: Infrared    时间: 2008-6-1 08:47
提示: 作者被禁止或删除 内容自动屏蔽
作者: zyq11321    时间: 2008-6-2 02:39
http://rpg.blue/web/htm/news439.htm
来自:让部分魔法武器攻击时也会消耗SP 更新添加:RTAB版 {/fd}
偶只想做个能增加武器暴击率的东西...


作者: wy29    时间: 2008-6-2 08:38
提示: 作者被禁止或删除 内容自动屏蔽




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