Good morning. When I use chameleon rune and logout and login (CTRL+G), the time of the spell performed by the rune does not end, forcing the player to change their outfit to stop the bug. Can anybody help me?
Chameleon.lua:
Chameleon.lua:
Lua:
local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(200000)
function onCastSpell(creature, variant, isHotkey)
local position, item = variant:getPosition()
if position.x == CONTAINER_POSITION then
local container = creature:getContainerById(position.y - 64)
if container then
item = container:getItem(position.z)
else
item = creature:getSlotItem(position.y)
end
else
item = Tile(position):getTopDownItem()
end
if not item or item.itemid == 0 or not isMoveable(item.uid) then
creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
condition:setOutfit({lookTypeEx = item.itemid})
creature:addCondition(condition)
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
return true
end