• 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!

Boss teleport with cooldown help tfs 1.3

robert100

Member
Joined
May 2, 2011
Messages
33
Solutions
1
Reaction score
5
Hello everyone looking for a script for the boss teleport in the teleport you can enter every 20 hours for one person
 
No this is the teleport idea, I thought you already have a boss script/teleport then you can only copy the needed lines, Don't you have boss teleport script?
 
Unfortunately, I have nothing, I tried to remake warzone, but I don't know which side to bite from, so I'm looking for a script for teleporting every 20 hours and a respawn boss
Post automatically merged:

bump
 
Last edited:
Try this:
Lua:
local config = {
    [58059] = {timer = 517635,
    range = 13,
    newPos = Position(31674, 31363, 9),
    bossName = 'Unaz The Mean',
    bossPos = Position(31681, 31369, 9)}
}

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return
    end

    local teleport = config[item.actionid]
    if not teleport then
        return
    end

    if player:getStorageValue(teleport.timer) > os.time() then
        position:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:say('You have to wait to challenge this enemy again!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if roomIsOccupied(teleport.bossPos, teleport.range, teleport.range) then
        position:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:say('Someone is fighting against the boss! You need wait awhile.', TALKTYPE_MONSTER_SAY)
        return true
    end
    clearRoom(teleport.bossPos, teleport.range, teleport.range, fromPosition)
    local monster = Game.createMonster(teleport.bossName, teleport.bossPos, true, true)
    if not monster then
        return true
    end

    position:sendMagicEffect(CONST_ME_TELEPORT)
    player:teleportTo(teleport.newPos)
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    player:say('You have ten minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.', TALKTYPE_MONSTER_SAY)
    addEvent(clearBossRoom, 60 * 10 * 1000, player.uid, monster.uid, teleport.bossPos, teleport.range, teleport.range, fromPosition)
    player:setStorageValue(teleport.timer, os.time() + 20 * 3600)
    return true
end

In libs:
Lua:
function clearBossRoom(playerId, bossId, centerPosition, rangeX, rangeY, exitPosition)
    local spectators, spectator = Game.getSpectators(centerPosition, false, false, rangeX, rangeX, rangeY, rangeY)
    for i = 1, #spectators do
        spectator = spectators[i]
        if spectator:isPlayer() and spectator.uid == playerId then
            spectator:teleportTo(exitPosition)
            exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
        end

        if spectator:isMonster() then
            spectator:remove()
        end
    end
end

function clearRoom(centerPosition, rangeX, rangeY, exitPosition)
    local spectators, spectator = Game.getSpectators(centerPosition, false, false, rangeX, rangeX, rangeY, rangeY)
    for i = 1, #spectators do
        spectator = spectators[i]
        if spectator:isMonster() then
            spectator:remove()
        end
    end
end

function roomIsOccupied(centerPosition, rangeX, rangeY)
    local spectators = Game.getSpectators(centerPosition, false, true, rangeX, rangeX, rangeY, rangeY)
    if #spectators ~= 0 then
        return true
    end

    return false
end
 
Back
Top Bottom