local config = {
centerRoom = Position(33353, 31350, 7),
bossPosition = Position(33353, 31350, 7),
newPosition = Position(33353, 31350, 7)
}
local function clearForgottenLloyd()
local spectators = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15)
for i = 1, #spectators do
local spectator = spectators[i]
if spectator:isPlayer() then
spectator:teleportTo(Position(32815, 32873, 13))
spectator:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
spectator:say('Time out! You were teleported out by strange forces.', TALKTYPE_MONSTER_SAY)
elseif spectator:isMonster() then
spectator:remove()
end
end
end
function onStepIn(player, item, fromPosition, target, toPosition, isHotkey)
local player = creature:getPlayer()
if not player then
return
end
local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Lloyd.")
return true
end
Game.createMonster("lloyd", config.bossPosition, true, true)
if player:getStorageValue(Storage.ForgottenKnowledge.LloydTimer) < os.time() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:teleportTo(config.newPosition)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:setStorageValue(Storage.ForgottenKnowledge.LloydTimer, os.time() + 20 * 3600)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenge Lloyd.")
return true
end
addEvent(clearForgottenLloyd, 30 * 60 * 1000)
end
return true
end