DUVIDA SCRIPT RING %HP


pikachu rosa

Recommended Posts

Pessoal, o script abaixo é do faramir, troca ring conforme % de hp, contudo, nao entendi direito como funciona...

*********Alguem pode me ajudar a configurar pra deixar ring healing com hp acima de 70% e trocar para might ring abaixo de 69%de hp ************

 

 

 

Equipar item com HP < X e manter item com HP > Y:

Este script é configurável, vc coloca o valor do lowhp para a quantidade de %HP que ira usar o item lowid, e no highhp a quantidade de %HP que ira usar o item, o ultimo parametro é o slot, que coloca o valor do slot referente ao jogador, 9 para ring, 2 para amuleto, etc.. 
No exemplo abaixo o script está configurado para trocar energy ring quando a vida chega a 30% e ira tentar manter o uso do might ring nos demais casos. (Este script necessita a versão 0.2 do script manager)

 

  Hide contents

 

local lowhp, lowid, highhp, highid, slot = 30, {3051, 3088}, 90, 3048, 9

cycleEvent(
  function ()       
    if g_game.isOnline() then
      local player = g_game.getLocalPlayer()
      local equipped = player:getInventoryItem(slot)
      local equippedId = equipped and equipped:getId() or 0
      local isLowId = false
      if type(lowid) == "table" then
        for i,v in pairs(lowid) do
          isLowId = isLowId or v == equippedId
        end
      else
        isLowId = lowid == equippedId
      end
      local isHighId = false
      if type(highid) == "table" then
        for i,v in pairs(highid) do
          isHighId = isHighId or v == equippedId
        end
      else
        isHighId = highid == equippedId
      end
      
      local hp = player:getHealthPercent()
      local equipId = 0
      if equippedId == 0 then
        if hp <= highhp then
          equipId = lowid
        else
          equipId = highid
        end
      elseif isLowId and hp >= highhp then
        equipId = highid
      elseif not isLowId and hp <= lowhp then
        equipId = lowid
      elseif not isHighId and not isLowId then
        equipId = highid
      end

      if equipId ~= 0 then
        if type(equipId) == "table" then equipId = equipId[1] end
        sendEquipItem(equipId)
      end
    end
  end
, 500)

Link to comment
Share on other sites

  • Kings locked this topic
Guest
This topic is now closed to further replies.