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

[HELP] Action and Movements for Boss Room. TFS 1.X +

Hyagosrs

Member
Joined
Mar 10, 2018
Messages
94
Solutions
1
Reaction score
10
  • i need a script that i can enter 1 or even 5 players to kill the boss, and that has time to be able to do it again.
  • and that when he leaves the room, the boss disappears.
  • after that, a movement script to check the time left to make the boss and not let him step on the sqm that is on the lever, and this script send a message telling the time.

Screenshot_2.png
 

Lua:
local config = {
    bossName = "Duke Krule",
    lockStorage = 5080291, -- globalstorage
    bossPos = Position(33456, 31472, 13),
    centerRoom = Position(33456, 31472, 13), -- Center Room 
    exitPosition = Position(33455, 31497, 13), -- Exit Position
    newPos = Position(33456, 31480, 13),
    range = 10,
    time = 10, -- time in minutes to remove the player   
}   

--[[local monsters = {
    {pillar = "oberons ire", pos = Position(33367, 31320, 9)},
    {pillar = "oberons spite", pos = Position(33361, 31320, 9)},
    {pillar = "oberons hate", pos = Position( 33367, 31316, 9)},
    {pillar = "oberons bile", pos = Position(33361, 31316, 9)}
}]]

local function clearOberonRoom()
    if Game.getStorageValue(config.lockStorage) == 1 then
        local spectators = Game.getSpectators(config.bossPos, false, false, 10, 10, 10, 10)
        for i = 1, #spectators do
            local spectator = spectators[i]
            if spectator:isPlayer() then
                spectator:teleportTo(config.exitPosition)
                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
        Game.setStorageValue(config.lockStorage, 0)
    end
end
-- Start Script poss principal y action del script
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 9825 and item.actionid == 25139 then
        if player:getPosition() ~= Position(33455, 31493, 13) then
            return true
        end
-- Poss de los players           
    for y = 33455, 33459 do
    local playerTile = Tile(Position(y, 31493, 13)):getTopCreature()
        if playerTile and playerTile:isPlayer() then
            if playerTile:getStorageValue(Storage.Tibiana.DukeKruleTimer) > os.time() then
                playerTile:sendTextMessage(MESSAGE_STATUS_SMALL, "You or a member in your team have to wait 20 hours to challange Duke Krule again!")
                item:transform(9826)
                return true
            end
        end
    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_STATUS_SMALL, "There's someone fighting with Duke Krule.")
            item:transform(9825)
            return true
        end
    end   
            
    if Game.getStorageValue(config.lockStorage) == 1 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need wait 10 minutes to room cleaner!")
        return true
    end
    
    local spectators = Game.getSpectators(config.bossPos, false, false, 15, 15, 15, 15)
    for i = 1, #spectators do
        local spectator = spectators[i]
        if spectator:isMonster() then
            spectator:remove()
        end
    end
        --[[for n = 1, #monsters do
            Game.createMonster(monsters[n].pillar, monsters[n].pos, true, true)
        end]]   
    Game.createMonster(config.bossName, config.bossPos, true, true)   
    Game.setStorageValue(config.lockStorage, 1)
-- poss de los players
    for y = 33455, 33459 do
        local playerTile = Tile(Position(y, 31493, 13)):getTopCreature()
        if playerTile and playerTile:isPlayer() then                     
            playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
            playerTile:teleportTo(config.newPos)
            playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)   
            playerTile:setStorageValue(Storage.Tibiana.DukeKruleTimer, os.time() + 12 * 60 * 60) -- + 20 * 60 * 3600
            addEvent(clearOberonRoom, 60 * config.time * 1000, playerTile:getId(), config.centerRoom, config.range, config.range, config.exitPosition)
            playerTile:sendTextMessage(MESSAGE_STATUS_SMALL, "You have 10 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.")
            item:transform(9826)
        end
    end
    
elseif item.itemid == 9826 then
        item:transform(9825)
    end
        return true
end

1.- Create a new storage in libs / core / storages.lua
2.- and change this line (Storage.Tibiana.DukeKruleTimer)
 
Use this as base:
Lua:
local config = {
newPos = Position(33363, 31342, 9),
backPos = Position(33293, 31288, 9),
storage = 91710
}

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

    if player:getStorageValue(config.storage) >= os.time() then
        player:teleportTo(config.backPos)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to wait to challange this enemy again!")
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    else      
        position:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(config.newPos)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        return true
    end
    return true
end

(I use this for block the player at entering the lever's teleport)
 
Back
Top