crear tp al matar boss

El Bu

Member
Messages
42
Points
151
Buen dia, me podran ayudar con un script donde al matar a un boss se cree un teleport en cierta posicion y te lleve a otra posicion, gracias.
Tibia 13.21 Canary
 
Solution
Buen dia, me podran ayudar con un script donde al matar a un boss se cree un teleport en cierta posicion y te lleve a otra posicion, gracias.
Tibia 13.21 Canary


Hola, aqui tienes un script, que lo que hace es una zona de palanca, en donde la pongas, al usarla 1 a X players, los teleporta con minimo de nivel.
Después crea el boss en esa zona, de ahi al matarlo sale un teleport, si no lo matas o en el tiempo invertido te hecha fuera.
El tp pones una nueva posicion en donde quieras,


JavaScript:
local config = {
    actionId = 44201,
    bossName = "The Monster",
    bossPosition = Position(33825, 32533, 10),
    bossArea = {
        fromPos = Position(33814, 32529, 10),
        toPos = Position(33835, 32546, 10),
        entrancePos =...
Buen dia, me podran ayudar con un script donde al matar a un boss se cree un teleport en cierta posicion y te lleve a otra posicion, gracias.
Tibia 13.21 Canary


Hola, aqui tienes un script, que lo que hace es una zona de palanca, en donde la pongas, al usarla 1 a X players, los teleporta con minimo de nivel.
Después crea el boss en esa zona, de ahi al matarlo sale un teleport, si no lo matas o en el tiempo invertido te hecha fuera.
El tp pones una nueva posicion en donde quieras,


JavaScript:
local config = {
    actionId = 44201,
    bossName = "The Monster",
    bossPosition = Position(33825, 32533, 10),
    bossArea = {
        fromPos = Position(33814, 32529, 10),
        toPos = Position(33835, 32546, 10),
        entrancePos = Position(33825, 32544, 10),
        exitPosition = Position(33823, 32563, 10)
    },
    participantsAllowAnyCount = true,
    participantsPos = {
        Position(33825, 32566, 10),
        Position(33824, 32566, 10),
        Position(33823, 32566, 10),
        Position(33822, 32566, 10),
        Position(33821, 32566, 10) 
    },
    attempts = {
        level = 100,
        storage = 730506,
        seconds = 3600 -- 1 h
    },
    createTeleportPos = Position(33825, 32545, 10),
    teleportToPosition = Position(33823, 32563, 10),
    teleportRemoveSeconds = 120,
    kickParticipantAfterSeconds = 120 * 10,
    leverIds = {8911, 8912}
}

local function getSpectators()
    if not config.centerPosition then
        config.diffX = math.ceil((config.bossArea.toPos.x - config.bossArea.fromPos.x) / 2)
        config.diffY = math.ceil((config.bossArea.toPos.y - config.bossArea.fromPos.y) / 2)
        config.centerPosition = config.bossArea.fromPos + Position(config.diffX, config.diffY, 0)
    end
    return Game.getSpectators(config.centerPosition, false, false, config.diffX, config.diffX, config.diffY, config.diffY)
end

local brainstealerLever = Action()

function brainstealerLever.onUse(player, item, fromPos, target, toPos, isHotkey)
    local participants = {}
    for index, pos in pairs(config.participantsPos) do
        local tile = Tile(pos)
        if not tile then error("[Warning - Tile not found]") end
        local participant = tile:getTopVisibleCreature(player)
        if participant and participant:isPlayer() then
            if index == 1 and participant ~= player then
                player:sendCancelMessage("Only the first participant can pull the lever.")
                return true
            end

            if participant:getStorageValue(config.attempts.storage) >= os.time() then
                player:sendCancelMessage(string.format("The player %s must wait 1 hour before being able to enter again.", participant:getName()))
                return true
            elseif participant:getLevel() < config.attempts.level then
                player:sendCancelMessage(string.format("The player %s is not level %d.", participant:getName(), config.attempts.level))
                return true
            end
            participants[#participants +1] = participant   
        end
    end

    local spectators = getSpectators()
    for _, spectator in pairs(spectators) do
        if spectator:isPlayer() then
            player:sendCancelMessage("At this time the room is occupied, please try again later.")
            return true
        end
    end

    for _, spectator in pairs(spectators) do spectator:remove() end
    local boss = Game.createMonster(config.bossName, config.bossPosition)
    if not boss then error(Game.getReturnMessage(RETURNVALUE_NOTENOUGHROOM)) end
    boss:registerEvent("monsterBoss")
    for index, participant in pairs(participants) do
        config.participantsPos[index]:sendMagicEffect(CONST_ME_POFF)
        participant:teleportTo(config.bossArea.entrancePos, false)
        config.bossArea.entrancePos:sendMagicEffect(CONST_ME_TELEPORT)
        participant:setStorageValue(config.attempts.storage, os.time() + config.attempts.seconds)
    end

    config.kickEventId = addEvent(function ()
        for _, spectator in pairs(getSpectators()) do
            if spectator:isPlayer() then
                spectator:getPosition():sendMagicEffect(CONST_ME_POFF)
                spectator:teleportTo(config.bossArea.exitPosition, false)
                config.bossArea.exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
                spectator:sendTextMessage(MESSAGE_INFO_DESCR, "It's been a long time and you haven't managed to defeat The Monster.")
            else
                spectator:remove()
            end
        end
    end, config.kickParticipantAfterSeconds * 1000)

    item:transform(item:getId() == config.leverIds[1] and config.leverIds[2] or config.leverIds[1])
    return true
end

brainstealerLever:aid(config.actionId)
brainstealerLever:register()

local creatureEvent = CreatureEvent("monsterBoss")

function creatureEvent.onDeath()
    stopEvent(config.kickEventId)
    local teleport = Game.createItem(34111, 1, config.createTeleportPos)
    if teleport then
        teleport:setDestination(config.teleportToPosition)
        addEvent(function ()
            local tile = Tile(config.createTeleportPos)
            if tile then
                local teleport = tile:getItemById(34111)
                if teleport then
                    teleport:remove()
                    config.teleportToPosition:sendMagicEffect(CONST_ME_POFF)
                end
            end

            for _, spectator in pairs(getSpectators()) do
                if spectator:isPlayer() then
                    spectator:getPosition():sendMagicEffect(CONST_ME_POFF)
                    spectator:teleportTo(config.teleportToPosition, false)
                    config.teleportToPosition:sendMagicEffect(CONST_ME_TELEPORT)
                end
            end
        end, config.teleportRemoveSeconds * 1000)
    end
    return true
end

creatureEvent:register()
 
Solution

Tibia Server Lists

#1 FEATURED US Ultron OT 1,616 / 5,000Online EXPStages PROTO8.6 ENGINEUltron OT RANK PTS5.9 +100% VOTES0 #2 FEATURED US Nefera 156 / 0Online EXPx1 PROTO15.20 ENGINECrystal Server RANK PTS5.1 +100% VOTES0 #3 FEATURED ES Deixis 0 / 0Offline EXPStages PROTO1098 ENGINETFS RANK PTS3.7 +100% VOTES1 #4 FEATURED ES Maeli 7 / 150Online EXPx10 PROTO10.98 ENGINETFS 1.4.2 RANK PTS3.7 +100% VOTES0 #5 MX Marlboro War 40 / 300Online EXP999 PROTO8.6 ENGINETFS 0.3.7 RANK PTS5.5 -33% VOTES0 #6 BR Tibinha YurOts 18 / 150Online EXPStages PROTO7.4 ENGINEYurOTS 1.5 RANK PTS5.2 -14% VOTES0 #7 US Halera 3 / 0Online EXPStages PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.9 -83% VOTES0 #8 BR Exordion Legacy 54 / 2,000Online EXPx2 PROTO7.72 ENGINEExordion RANK PTS4.9 +100% VOTES0 #9 PL Lubelski 3 / 1,000Online EXP200 PROTO7.6 ENGINELubelskiOTS 2.56.0 RANK PTS4.6 -15% VOTES0 #10 DE DBU Online 0 / 400Online EXP11 PROTO8.6 ENGINETFS 1.0 RANK PTS4.3 +100% VOTES0 #11 PL ReWar 0 / 2,000Online EXPcustom PROTO8.6 ENGINEOther RANK PTS4.3 0% VOTES0 #12 PL Velesta 0 / 1,000Offline EXP20 PROTO8.0 ENGINETFS 1.4.2 RANK PTS4.3 -98% VOTES0 #13 ES JustRL FreeTC 1530 13 / 250Online EXPx2 PROTO15.30 ENGINECrystal Server RANK PTS4.3 +100% VOTES0 #14 ES Farlia Global 2026 0 / 333Offline EXPx5 PROTO15.25 ENGINEFarliaServ 1.525 RANK PTS3.9 -22% VOTES0 #15 SE MortalisOT Custom 0 / 500Offline EXP100x -1.2x PROTO10.98 ENGINEMortalisOT V1 RANK PTS3.8 +100% VOTES0 #16 US Rommania 0 / 500Online EXPstages, x10 PROTO7.4 ENGINETFS 0.4 RANK PTS3.6 +100% VOTES0 #17 US BerethaOnline 2 / 2,000Online EXPStages PROTO10.98 ENGINETFS RANK PTS3.5 +100% VOTES0
Top