jeffaklumpen
Member
I have a script that causes a teleport to appear after you kill a certain boss. After 2 minutes the portal should disappear. The portal will appear but it stays forever. It used to work fine when I used TFS 0.3.6 but I switched to 0.4 and now the script won't work :/
Lua:
function onDeath(cid, corpse, killer)
registerCreatureEvent(cid, "Zalzabane")
local creaturename = getCreatureName(cid)
local in_pos = {x=31954, y=32337, z=10, stackpos=2}
local checkIID = getThingfromPos(in_pos)
local to_pos = {x=31954, y=32326, z=10, stackpos=1}
local time_to_pass = 120 -- in seconds
local tpID = 1387
if creaturename == 'Zalzabane' then
teleport = doCreateTeleport(tpID, to_pos, in_pos)
doSendMagicEffect(in_pos, CONST_ME_TELEPORT)
doCreatureSay(cid, "Zalzabane is defeated! Hurry, get to the portal!", TALKTYPE_ORANGE_1)
addEvent(removeTeleport, (1000*time_to_pass))
end
return TRUE
end
function removeTeleport()
if getThingfromPos({x=31954, y=32337, z=10, stackpos=1}).itemid == 1387 then
doRemoveItem(getThingfromPos({x=31954, y=32337, z=10, stackpos=1}).uid,1)
doSendMagicEffect({x=31954, y=32337, z=10, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end