I have an item and when unequipping it I check if another instance of this item is in any attack hand of any champion in the party.
My code is this
Code: Select all
onUnequipItem = function(self,champion,slot)
if slot==1 or slot==2 then
local hascandle = false
for i = 1,4 do
local ch = party.party:getChampion(i)
if ch:getItem(1) == candle or ch:getItem(2) == candle then
hascandle = true
break
end
end
if hascandle == false then
party.candle:disable()
end
end
end,
But it seems that the onUnequipItem function is executed in the same moment the item is still equipped. Means: When I search for a champion having the item in a hand the one who unequips it still has it and the result will alway be hasItem == true. But I cannot leave the champion unequipping the item out because he could have that item in the other hand.
Has anyone an idea how to solve this?