Untitled
unknown
plain_text
3 years ago
1.1 kB
5
Indexable
function onDeath(cid, corpse, deathList)
math.randomseed(os.time())
if isMonster(cid) then
t = {}
for v, k in pairs(SummConfig) do
if v:lower() == getCreatureName(cid):lower() then
for i = 1, #k.reward do
table.insert(t, {k.reward[i][1], k.reward[i][2]})
end
local pos = getThingPos(cid)
local newIt = t[math.random(1, #t)]
addEvent(function()
doCleanTile(pos)
local rw = doCreateItem(newIt[1], isItemStackable(newIt[1]) and newIt[2] or 1, pos)
if rw and newIt[1] == 6104 then
doAddContainerItem(rw, 2638, 1)
end
if doItemSetAttribute(rw, "aid", 1500) then
local seconds = k.force ~= nil and k.force or SecondsToLoot
for i = 1, seconds do
addEvent(function()
doSendAnimatedText(pos, (seconds - i) + 1, COLOR_WHITE)
if i == seconds then
local it = getTileItemById(pos, newIt[1])
if it.uid > 0 then
doItemSetAttribute(it.uid, "aid", 0)
end
end
end, i * 1000)
end
end
end, 1)
end
end
end
return true
end
Editor is loading...