Aeronx
Intermediate OT User
- Joined
- Dec 17, 2015
- Messages
- 735
- Solutions
- 9
- Reaction score
- 119
Hello everybody,
I've been trying to add a condition by having and item on your inventori
This is the code at /events/players.lua
Everything works fine, all msg show up, i get the condition.. but when i put the item back on the floor, my condition is still there :S I dont know why my condition wont get removed.
Also, i've been trying to add a magic effect happening every X seconds. But addEvent didnt seem to work here.
Any help would be really appreciated.
Thanks
I've been trying to add a condition by having and item on your inventori
This is the code at /events/players.lua
Code:
local mlvl = Condition(CONDITION_ATTRIBUTES)
mlvl:setParameter(CONDITION_PARAM_TICKS, -1)
mlvl:setParameter(CONDITION_PARAM_SUBID, 390)
mlvl:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 15)
function Player:onMoveItem1(item, count, fromPosition, toPosition)
if item:getId() == 2349 and toPosition.x == CONTAINER_POSITION then
self:sendTextMessage(MESSAGE_INFO_DESCR, "You moved item to inside a container.")
self:addCondition(mlvl)
end
return true
end
function Player:onMoveItem2(item, count, fromPosition, toPosition)
if item:getId() == 2349 and toPosition.x ~= CONTAINER_POSITION then
self:sendTextMessage(MESSAGE_INFO_DESCR, "You moved item to outside a container.")
self:removeCondition(mlvl)
end
return true
end
function Player:onMoveItem(item, count, fromPosition, toPosition)
local ret1 = self:onMoveItem1(item, count, fromPosition, toPosition)
local ret2 = self:onMoveItem2(item, count, fromPosition, toPosition)
return ret1 and ret2
end
Everything works fine, all msg show up, i get the condition.. but when i put the item back on the floor, my condition is still there :S I dont know why my condition wont get removed.
Also, i've been trying to add a magic effect happening every X seconds. But addEvent didnt seem to work here.
Any help would be really appreciated.
Thanks