local config = {
useCountdown = true -- true or false
}
local t = {
["Panda"] = {
toPos = {x = 1592, y = 1913, z = 2}, -- enter a position OR a town's name \\ toPos = {x = 100, y = 100, z = 7} //
createPos = {x = 1592, y = 1914, z = 3, stackpos = 0},
time = 5, -- seconds until the TP is removed
msg = "You have taken my life!" -- the message the monster says upon death
}
}
local function remove(position)
local k = getTileItemById(position, 1387).uid
return k > 0 and doRemoveItem(k), doSendMagicEffect(position, CONST_ME_POFF)
end
function onKill(cid, target)
local v = t[string.lower(getCreatureName(target))]
if(v and isMonster(target)) then
doCreatureSay(cid, v.msg, TALKTYPE_MONSTER, nil, nil, getCreaturePosition(target))
doSendMagicEffect(v.createPos, CONST_ME_ENERGYAREA)
doCreateTeleport(1387, type(v.toPos) == 'table' and v.toPos or getTownTemplePosition(getTownId(v.toPos)), v.createPos)
if(config.useCountdown) then
for j = 0, v.time do
local i = v.time - j
addEvent(doSendAnimatedText, j * 1000, v.createPos, i > 0 and tostring(i), TEXTCOLOR_WHITE)
end
end
addEvent(remove, v.time * 1000, v.createPos)
end
return true
end