Log in

View Full Version : EQUIP ENERGY RING WHEN X BURST DMG



shadowseka
01-15-2016, 06:30 PM
As tittle says im looking if any of you guys have a script that equips a energy ring if you receive damage above x quantity, for mage.

eldera
01-15-2016, 08:06 PM
Only equip or should it be unequipped under some condition?

shadowseka
01-15-2016, 10:29 PM
only equip should be good

eldera
01-16-2016, 11:14 AM
local equipRingAboveDmg = 10
local ringToEquipAboveDmg = "Energy ring"

--[[ DO NOT EDIT ANYTHING BELOW THIS LINE ]]--

local ringToEquipAboveDmgId = Item.GetItemIDFromDualInput(ringToEquipAboveDmg)

function battleMessageProxyCallback(proxy, text)
local first = string.match(text, "You lose ")
local dmg = tonumber(string.match(text, "%d+") or string.match(text, "%d"))
local second = string.match(text, " hitpoints due to an attack by ")

if (first and dmg and second) then
if (equipRingAboveDmg < dmg) then
while (Self.Ring().id ~= Item.GetRingActiveID(ringToEquipAboveDmgId) and Self.ItemCount(ringToEquipAboveDmgId) > 0) do
Self.Equip(ringToEquipAboveDmgId, "ring")
end
end
end
end

BattleMessageProxy.OnReceive('server', battleMessageProxyCallback)