太阳神三国杀lua吧 关注:2,628贴子:73,363
  • 4回复贴,共1

【求助】给义从加配音,出错了

取消只看楼主收藏回复



IP属地:北京1楼2015-01-30 22:19回复
    jiexian_yicongyx = sgs.CreateTriggerSkill{
    name = "#jiexian_yicong",
    events = {sgs.HpChanged},
    on_trigger = function(self, event, player, data)
    local room = player:getRoom()
    local hp = player:getHp()
    if (hp > 2) then
    room:broadcastSkillInvoke("jiexian_yicong1")
    end
    if (hp <= 2) then
    room:broadcastSkillInvoke("jiexian_yicong2")
    end
    }
    jiexian_gongsunzan:addSkill(jiexian_qiaomeng)
    jiexian_gongsunzan:addSkill(jiexian_yicong)
    jiexian_gongsunzan:addSkill(jiexian_yicongyx)
    extension:insertRelatedSkills("jiexian_yicong", "#jiexian_yicong")


    IP属地:北京2楼2015-01-30 22:20
    回复
      jiexian_yicong = sgs.CreateDistanceSkill{
      name = "jiexian_yicong" ,
      correct_func = function(self, from, to)
      local correct = 0
      if from:hasSkill(self:objectName()) and (from:getHp() > 2) then
      correct = correct - 1
      end
      if to:hasSkill(self:objectName()) and (to:getHp() <= 2) then
      correct = correct + 1
      end
      return correct
      end
      }


      IP属地:北京5楼2015-01-30 22:43
      回复
        终于完成了,最终版,感谢帮助
        jiexian_yicongyx = sgs.CreateTriggerSkill{
        name = "#jiexian_yicong",
        events = {sgs.HpRecover, sgs.PostHpReduced},
        on_trigger = function(self, event, player, data)
        local room = player:getRoom()
        local hp = player:getHp()
        if event == sgs.HpRecover and (hp == 3) then
        room:broadcastSkillInvoke("jiexian_yicong",1)
        end
        if event == sgs.PostHpReduced and (hp == 2) then
        room:broadcastSkillInvoke("jiexian_yicong",2)
        end
        end
        }


        IP属地:北京8楼2015-01-30 23:24
        收起回复
          jiexian_yicongyx = sgs.CreateTriggerSkill{
          name = "#jiexian_yicong",
          events = {sgs.HpRecover, sgs.PostHpReduced},
          on_trigger = function(self, event, player, data)
          local room = player:getRoom()
          local hp = player:getHp()
          if event == sgs.HpRecover then
          local recover = data:toRecover()
          if (hp > 2) and (hp - recover.recover) <=2 then
          room:broadcastSkillInvoke("jiexian_yicong",1)
          end
          end
          if event == sgs.PostHpReduced then
          local damage = data:toDamage()
          if (hp <= 2) and (hp + damage.damage) > 2 then
          room:broadcastSkillInvoke("jiexian_yicong",2)
          end
          end
          end
          }


          IP属地:北京12楼2015-01-31 17:02
          回复