Hola chicos, estaba buscando este script y el último que encontré fue
uncionando para mí y otras personas que vi en los comentarios, así que arreglé el script y agregué un pequeña función de cuenta regresiva.
para aquellos que no saben dónde agregar RevScripts, esta es la ruta donde pueden agregar este script:
data/scripts/killMonsterCreatePortal.lua
.

Por favor,
Acceder
or
Registrarse
para ver el contenido de las URL!
y no estaba f
Código:
-- Register script onLogin
---------------------------------------------------------------------------------------
local monsterKillLogin = CreatureEvent("monsterKillLogin")
function monsterKillLogin.onLogin(player)
player:registerEvent("killMonsterCreatePortal")
return true
end
monsterKillLogin:type("login")
monsterKillLogin:register()
para aquellos que no saben dónde agregar RevScripts, esta es la ruta donde pueden agregar este script:
data/scripts/killMonsterCreatePortal.lua
Código:
{
["demon"] = {
message = "You have defeated Demon!",
config = {
createPos = {x = 100, y = 100, z = 7},
toPos = {x = 100, y = 101, z = 7},
portalTime = 1, --minutes
}
},
["orshabaal"] = {
message = "You have defeated Orshabaal!",
config = {
createPos = {}, --NOTE: You may use empty brackets to create the portal where the monster dies.
toPos = {x = 100, y = 100, z = 7},
portalTime = 5, --minutes
}
},
["your mom "] = {
message = "You have defeated your Mom!",
config = {
createPos = {x = 69, y = 69, z = 69}, --NOTE: You may use empty brackets to create the portal where the monster dies.
toPos = {x = 69, y = 69, z = 69},
portalTime = 69, --minutes
}
},
}
---------------------------------------------------------------------------------------
-- Config end
---------------------------------------------------------------------------------------
local function spectatorStartCountdown(time, position)
local spectators = Game.getSpectators(position, false, false, 5, 5, 5, 5)
if #spectators > 0 then
for i = 1, #spectators do
if time > 1 then
spectators[i]:say("" .. time .. "", TALKTYPE_MONSTER_SAY, false, spectators[i], position)
else
spectators[i]:say("Time out!", TALKTYPE_MONSTER_SAY, false, spectators[i], position)
break
end
end
end
addEvent(spectatorStartCountdown, 1000, time - 1, position)
end
local function removePortal(position)
local portal = Tile(position):getItemById(portalId)
if portal then
portal:remove()
end
end
local killMonsterCreatePortal = CreatureEvent("killMonsterCreatePortal")
function killMonsterCreatePortal.onKill(creature, target)
if not target:isMonster() or target:getMaster() then
return true
end
local player = Player(creature:getGuid())
local k = t[target:getName():lower()]
if not k then
return true
end
local pos, cPos = target:getPosition()
if type(k.config.createPos) == 'table' then
if next(k.config.createPos) == nil then
cPos = pos
else
cPos = k.config.createPos
end
end
if Tile(cPos):getItemById(portalId) then
return true
end
local item = Game.createItem(portalId, 1, cPos)
if item:isTeleport() then
item:setDestination(k.config.toPos)
end
local pt = k.config.portalTime
player:sendTextMessage(MESSAGE_STATUS_WARNING, k.message .. "\n\nYou have " .. pt .. " " .. (pt > 1 and "minutes" or "minute") .. " to escape through the portal!")
addEvent(spectatorStartCountdown, 500, pt * 60, cPos)
addEvent(removePortal, pt * 60 * 1000, cPos)
return true
end
killMonsterCreatePortal:type("kill")
killMonsterCreatePortal:register()
