----------->Scripetd by JDB<------------
---->Credits to JDB for this script<----
local m = {
["monster name"] = {
message = "Escape through the teleport quickly before it closes!",
cfg = {
{
time = 60, -- Seconds until tp closes.
to = { x = ???, y = ??, z = ? }, -- Where the tp takes you.
tp = { x = ???, y = ??, z = ? } -- Where the tp creates.
},
}
}
}
function onKill(cid, target)
if isPlayer(target) then
return true
end
local monster = m[getCreatureName(target)]
if monster then
for i = 1, #monster.cfg do
local c = monster.cfg[i]
local function deleteTeleport()
local teleport = getTileItemById(c.tp, 1387).uid
if(teleport > 0) then
doRemoveItem(teleport)
doSendMagicEffect(c.tp, CONST_ME_POFF)
doSendAnimatedText(c.tp, "Closed", TEXTCOLOR_RED)
end
return true
end
doCreateTeleport(1387, c.to, c.tp)
doSendMagicEffect(c.tp, CONST_ME_ENERGYAREA)
addEvent(deleteTeleport, c.time * 1000)
end
doCreatureSay(cid, monster.message, TALKTYPE_ORANGE_1)
end
return true
end
registerCreatureEvent(cid, "MonsterPortal")
<event type="kill" name="MonsterPortal" event="script" value="portals.lua"/>
i change the coordinates.. and ths dont work
function onKill(cid, target)
local m = {
["CHANGE THIS TO THE MONSTER NAME"] = {
message = "Text...",
teaser = { "Teaser text.." }
cfg = {
{
deaths = 1, -- How many times the monster must die.
time = 10, -- Seconds until tp closes.
to = { x = 1000, y = 1000, z = 7 }, -- Where the tp takes you
tp = { x = 1000, y = 1000, z = 7 } -- Where the tp creates
},
}
}
}
if isPlayer(target) then
return true
end
local monster = m[getCreatureName(target)]
local check = getGlobalStorageValue(monster)
if monster then
for i = 1, #monster.cfg do
local c = monster.cfg[i]
return check >= c.deaths and c.deaths ~= 0 and setGlobalStorageValue(monster, ((c.deaths ~= nil and (check == -1 and 1) or check + 1) or -1)) and doCreatureAddHealth(monster, getCreatureMaxHealth(monster), true) and doCreatureSay(monster, monster.teaser[math.random(1, #monster.teaser)], TALKTYPE_ORANGE_1) and doCreateTeleport(c.to, c.tp) and doSendMagicEffect(c.tp, CONST_ME_TELEPORT) and addEvent(function() doRemoveItem(getTileItemById(c.tp, 1387).uid) end, c.time * 1000) or c.deaths <= 1 and doCreatureSay(cid, monster.message, TALKTYPE_ORANGE_1) and doCreateTeleport(c.to, c.tp) and doSendMagicEffect(c.tp, CONST_ME_TELEPORT) and addEvent(function() doRemoveItem(getTileItemById(c.tp, 1387).uid) end, c.time * 1000)
end
end
return true
end
registerCreatureEvent(cid, "Portals")
<event type="kill" name="Portals" event="script" value="portals.lua"/>