Carlitos Flow
Developer (lvl*1)
- Joined
- Mar 2, 2011
- Messages
- 156
- Solutions
- 4
- Reaction score
- 10
Hello, im trying to add the magic effect #55 when x player drops x item (like an item rare) from a corpse of monster, its not working, anyone can help me please? Thanks (already registed in login)
-(Arrow effect appear on the corpse from the monster)
I was testing with print console and only prints number 0 and 1
-(Arrow effect appear on the corpse from the monster)
I was testing with print console and only prints number 0 and 1
Lua:
local effect = 55
local arrow = {55, 60} --Effect and seconds.
function isRare(itemid)
local items = {5897, 2666, 3976} --IDs from items
return isInArray(ids, itemid)
end
function sendEffect(pos, time)
if time < 0 then
return true
end
doSendMagicEffect(pos, arrow[1])
addEvent(sendEffect, 1000, pos, time - 1)
end
local function func(cid, position, corpseid, effect)
print(1)
if not isCreature(cid) then return true end
local corpse = getTileItemById(position, corpseid).uid
if corpse <= 1 then return end
if not isContainer(corpse) then return true end
for slot = 0, (getContainerSize(corpse)-1) do
local item = getContainerItem(corpse, slot)
if item.uid <= 1 then return end
if isRare(item.itemid) then
print(2)
return doSendMagicEffect(position, effect)
end
end
end
function onKill(cid, target, lastHit)
print(0)
if not isMonster(target) then return true end
local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
addEvent(func, 5, getCreatureSummons(cid)[1], getThingPos(target), corpse, effect)
return true
end