• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Boss Room

kraszq95

New Member
Joined
Aug 23, 2020
Messages
1
Reaction score
0
local bconfig = {
boss = 'Hell King', -- Nome do Boss
storagend = 9111, -- Storage Necessária Para Poder Matar o Boss
storagday = 9112, -- Storage for limiting each player per day.
bossposition = Position(1194, 113, 15), -- Onde o Boss Será Criado
destination = Position(1188, 118, 15), -- Onde o Teleporta de Entrada Ira Levar
exitposition = Position(1404, 125, 15), -- Onde o Teleporte de Saida ou Kick ira levar
areacenter = Position(1194, 114, 15), -- O Centro do Lugar onde o Boss Será Criado
areascan = { -- Largura e Altura minima da Área Onde o Boss Será Criado
minx = 15,
maxx = 15,
miny = 15,
maxy = 15
},
timekill = 10, -- Tempo que o Jogador Terá Para Matar o Boss
timeopen = 1, -- Tempo Para o Boss ficar acessivel Novamente Desde a Abertura
aidenter = 65535, -- Action Id do Tile de Entrada
aidexit = 65534, -- Action Id do Tile de Saida
enterpos = DIRECTION_EAST, -- Direçao do Player Quando Entrar na Sala do Boss
exitpos = DIRECTION_EAST, -- Direçao do Player Quando Sair da Sala do Boss
global = 50737, -- stores the global delay before boss can spawn again
throttle = 20 * 60 * 60 -- Setting for personal delay before player can visit again -- 20 hours
}


function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()

if not player then
player:sendTextMessage(MESSAGE_STATUS_WARNING, 'Nao e um jogador')
return true
end

if item.actionid == bconfig.aidenter then
local secs = getGlobalStorageValue(bconfig.global)
local psecs = player:getStorageValue(bconfig.storagday)

if player:getStorageValue(bconfig.storagend) == -1 then
player:sendTextMessage(MESSAGE_STATUS_WARNING, 'You cannot enter the boss now.')
player:teleportTo(fromPosition, true)
fromPosition:sendMagicEffect(CONST_ME_TELEPORT)
return true
end

if psecs > os.time() then
player:sendTextMessage(MESSAGE_STATUS_WARNING, 'Come back tomorrow!')
player:teleportTo(fromPosition, true)
fromPosition:sendMagicEffect(CONST_ME_TELEPORT)
return true
end

if secs < os.time() then
local boss = Game.createMonster(bconfig.boss, bconfig.bossposition)

setGlobalStorageValue(bconfig.global, os.time() + (60 * bconfig.timeopen))
player:setStorageValue(bconfig.storagday, os.time() + throttle)
player:teleportTo(bconfig.destination)
player:setDirection(bconfig.enterpos)
position:sendMagicEffect(CONST_ME_TELEPORT)
bconfig.destination:sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_STATUS_WARNING, 'You have to wait ' .. bconfig.timekill .. ' minutes to kill the boss again')

addEvent(function()
local spectators = Game.getSpectators(bconfig.areacenter, false, false, bconfig.areascan.minx, bconfig.areascan.maxx, bconfig.areascan.miny, bconfig.areascan.maxy)

for i = 1, #spectators, 1 do
if spectators:isMonster() then
spectators:remove()
elseif spectators:isPlayer() then
exitPlayer(player)
player:sendTextMessage(MESSAGE_STATUS_WARNING, 'Time is up.')
end
end
end, (60 * 1000) * bconfig.timekill)
else
local remain = secs - os.time()
local minutes = string.format("%d", math.floor(remain/60))
local seconds = string.format("%d", remain-(math.floor(remain/60)*60))

player:teleportTo(fromPosition, true)
fromPosition:sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_STATUS_WARNING, 'The portal will be available again in ' .. minutes .. ' minuto(s) e ' .. seconds .. ' segundo(s).')
end
elseif item.actionid == bconfig.aidexit then
exitPlayer(player)
end
return true
end

function exitPlayer(player)
player:setStorageValue(bconfig.storagend, -1)
player:teleportTo(bconfig.exitposition)
player:setDirection(bconfig.exitpos)
bconfig.exitposition:sendMagicEffect(CONST_ME_TELEPORT)
end

1617806602090.png
1617806573733.png
Question is... Why i cant Enter ?

No tfs errors
 
Back
Top