• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Monsters] RevScripts - Crear Portal al Matar un Monsters [TFS 1.3 OR OTX 3.1]

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    SoyFabi

    SoyFabi
    Miembro
    Miembro
    Estaba investigando un poco el foro y me di cuenta que no hay scripts de Crear un Portal al matar un Boss mas completo.

    Me di la idea de compartirlo por aqui:
    PD: El Scripts no es mio, solo hago el aporte para el foro... jeje. [Monsters] RevScripts - Crear Portal al Matar un Monsters [TFS 1.3 OR OTX 3.1] 1f601

    Esto es un Revscripts que se colocaria en:

    data/scripts/nuevoarchivo.lua


    Dentro del lua pegamos esto;
    Código:
    ---------------------------------------------------------------------------------------
    -- This script creates a portal when monster dies
    ---------------------------------------------------------------------------------------


    ---------------------------------------------------------------------------------------
    -- Config start (always write creature name in lower case for ex: "demon" not "Demon")
    ---------------------------------------------------------------------------------------
    local portalId, t = 1387,
    {
        ["demon"] = {
            message = "You have defeated Demon!",
            config = {
                createPos = {x = 987, y = 1008, z = 7},
                toPos = {x = 988, y = 1012, z = 7},
                portalTime = 1, --minutes
            }
        },
        ["orshabaal"] = {
            message = "You have defeated Orshabaal!",
            config = {
                createPos = {}, --NOTE: You may use empty brackets to create the portal where the monster dies.
                toPos = {x = 100, y = 100, z = 7},
                portalTime = 5, --minutes
            }
        },
        ["your mom "] = {
            message = "You have defeated your Mom!",
            config = {
                createPos = {x = 69, y = 69, z = 69}, --NOTE: You may use empty brackets to create the portal where the monster dies.
                toPos = {x = 69, y = 69, z = 69},
                portalTime = 69, --minutes
            }
        },
    }
    ---------------------------------------------------------------------------------------
    -- Config end
    ---------------------------------------------------------------------------------------

    local function spectatorStartCountdown(time, position)
        local spectators = Game.getSpectators(position, false, false, 5, 5, 5, 5)

        if #spectators > 0 then
            for i = 1, #spectators do
                if time > 1 then
                    spectators[i]:say("" .. time .. "", TALKTYPE_MONSTER_SAY, false, spectators[i], position)
                else
                    spectators[i]:say("Time out!", TALKTYPE_MONSTER_SAY, false, spectators[i], position)
                end
            end
        end
        if time > 1 then
            addEvent(spectatorStartCountdown, 1000, time - 1, position)
        end
    end

    local function removePortal(position)
        local portal = Tile(position):getItemById(portalId)
        if portal then
            portal:remove()
        end
    end

    local killMonsterCreatePortal = CreatureEvent("killMonsterCreatePortal")

    function killMonsterCreatePortal.onKill(creature, target)
        if not target:isMonster() or target:getMaster() then
            return true
        end
        
        local player = Player(creature:getGuid())
        local k = t[target:getName():lower()]
        if not k then
            return true
        end
        
        local pos, cPos = target:getPosition()
        if type(k.config.createPos) == 'table' then
            if next(k.config.createPos) == nil then
                cPos = pos
            else
                cPos = k.config.createPos
            end
        end

        if Tile(cPos):getItemById(portalId) then
            return true
        end

        local item = Game.createItem(portalId, 1, cPos)
        if item:isTeleport() then
            item:setDestination(k.config.toPos)
        end
        
        local pt = k.config.portalTime

        player:sendTextMessage(MESSAGE_STATUS_WARNING, k.message .. "\n\nYou have " .. pt .. " " .. (pt > 1 and "minutes" or "minute") .. " to escape through the portal!")
        addEvent(spectatorStartCountdown, 500, pt * 60, cPos)
        addEvent(removePortal, pt * 60 * 1000, cPos)
        return true
    end

    killMonsterCreatePortal:type("kill")
    killMonsterCreatePortal:register()

    ---------------------------------------------------------------------------------------
    -- Register script onLogin
    ---------------------------------------------------------------------------------------
    local monsterKillLogin = CreatureEvent("monsterKillLogin")

    function monsterKillLogin.onLogin(player)
        player:registerEvent("killMonsterCreatePortal")
        return true
    end

    monsterKillLogin:type("login")
    monsterKillLogin:register()

    Para los que tengan duda de como se configura:

    createPos - Es el lugar donde se creara el portal al matar el monster.

    toPos - Es el lugar donde te llevara el portal.

    portalTime - El tiempo que durara el portal.

    Para agregar mas monster solo basta con colocar:
    Código:
    ["test "] = {
            message = "You have defeated you test!",
            config = {
                createPos = {x = 69, y = 69, z = 69}, --NOTE: You may use empty brackets to create the portal where the monster dies.
                toPos = {x = 69, y = 69, z = 69},
                portalTime = 69, --minutes
            }
        },

    Debajo de:
    Código:
    ["your mom "] = {
            message = "You have defeated your Mom!",
            config = {
                createPos = {x = 69, y = 69, z = 69}, --NOTE: You may use empty brackets to create the portal where the monster dies.
                toPos = {x = 69, y = 69, z = 69},
                portalTime = 69, --minutes
            }
        },

    Bueno... suerte con sus proyectos!

    2 participantes

    GalaxyDev

    GalaxyDev
    Miembro
    Miembro
    SoyFabi escribió:Estaba investigando un poco el foro y me di cuenta que no hay scripts de Crear un Portal al matar un Boss mas completo.

    Me di la idea de compartirlo por aqui:
    PD: El Scripts no es mio, solo hago el aporte para el foro... jeje. [Monsters] RevScripts - Crear Portal al Matar un Monsters [TFS 1.3 OR OTX 3.1] 1f601

    Esto es un Revscripts que se colocaria en:

    data/scripts/nuevoarchivo.lua


    Dentro del lua pegamos esto;
    Código:
    ---------------------------------------------------------------------------------------
    -- This script creates a portal when monster dies
    ---------------------------------------------------------------------------------------


    ---------------------------------------------------------------------------------------
    -- Config start (always write creature name in lower case for ex: "demon" not "Demon")
    ---------------------------------------------------------------------------------------
    local portalId, t = 1387,
    {
        ["demon"] = {
            message = "You have defeated Demon!",
            config = {
                createPos = {x = 987, y = 1008, z = 7},
                toPos = {x = 988, y = 1012, z = 7},
                portalTime = 1, --minutes
            }
        },
        ["orshabaal"] = {
            message = "You have defeated Orshabaal!",
            config = {
                createPos = {}, --NOTE: You may use empty brackets to create the portal where the monster dies.
                toPos = {x = 100, y = 100, z = 7},
                portalTime = 5, --minutes
            }
        },
        ["your mom "] = {
            message = "You have defeated your Mom!",
            config = {
                createPos = {x = 69, y = 69, z = 69}, --NOTE: You may use empty brackets to create the portal where the monster dies.
                toPos = {x = 69, y = 69, z = 69},
                portalTime = 69, --minutes
            }
        },
    }
    ---------------------------------------------------------------------------------------
    -- Config end
    ---------------------------------------------------------------------------------------

    local function spectatorStartCountdown(time, position)
        local spectators = Game.getSpectators(position, false, false, 5, 5, 5, 5)

        if #spectators > 0 then
            for i = 1, #spectators do
                if time > 1 then
                    spectators[i]:say("" .. time .. "", TALKTYPE_MONSTER_SAY, false, spectators[i], position)
                else
                    spectators[i]:say("Time out!", TALKTYPE_MONSTER_SAY, false, spectators[i], position)
                end
            end
        end
        if time > 1 then
            addEvent(spectatorStartCountdown, 1000, time - 1, position)
        end
    end

    local function removePortal(position)
        local portal = Tile(position):getItemById(portalId)
        if portal then
            portal:remove()
        end
    end

    local killMonsterCreatePortal = CreatureEvent("killMonsterCreatePortal")

    function killMonsterCreatePortal.onKill(creature, target)
        if not target:isMonster() or target:getMaster() then
            return true
        end
        
        local player = Player(creature:getGuid())
        local k = t[target:getName():lower()]
        if not k then
            return true
        end
        
        local pos, cPos = target:getPosition()
        if type(k.config.createPos) == 'table' then
            if next(k.config.createPos) == nil then
                cPos = pos
            else
                cPos = k.config.createPos
            end
        end

        if Tile(cPos):getItemById(portalId) then
            return true
        end

        local item = Game.createItem(portalId, 1, cPos)
        if item:isTeleport() then
            item:setDestination(k.config.toPos)
        end
        
        local pt = k.config.portalTime

        player:sendTextMessage(MESSAGE_STATUS_WARNING, k.message .. "\n\nYou have " .. pt .. " " .. (pt > 1 and "minutes" or "minute") .. " to escape through the portal!")
        addEvent(spectatorStartCountdown, 500, pt * 60, cPos)
        addEvent(removePortal, pt * 60 * 1000, cPos)
        return true
    end

    killMonsterCreatePortal:type("kill")
    killMonsterCreatePortal:register()

    ---------------------------------------------------------------------------------------
    -- Register script onLogin
    ---------------------------------------------------------------------------------------
    local monsterKillLogin = CreatureEvent("monsterKillLogin")

    function monsterKillLogin.onLogin(player)
        player:registerEvent("killMonsterCreatePortal")
        return true
    end

    monsterKillLogin:type("login")
    monsterKillLogin:register()

    Para los que tengan duda de como se configura:

    createPos - Es el lugar donde se creara el portal al matar el monster.

    toPos - Es el lugar donde te llevara el portal.

    portalTime - El tiempo que durara el portal.

    Para agregar mas monster solo basta con colocar:
    Código:
    ["test "] = {
            message = "You have defeated you test!",
            config = {
                createPos = {x = 69, y = 69, z = 69}, --NOTE: You may use empty brackets to create the portal where the monster dies.
                toPos = {x = 69, y = 69, z = 69},
                portalTime = 69, --minutes
            }
        },

    Debajo de:
    Código:
    ["your mom "] = {
            message = "You have defeated your Mom!",
            config = {
                createPos = {x = 69, y = 69, z = 69}, --NOTE: You may use empty brackets to create the portal where the monster dies.
                toPos = {x = 69, y = 69, z = 69},
                portalTime = 69, --minutes
            }
        },

    Bueno... suerte con sus proyectos!



    Buen aporte bro de igual manera dejo otro que es revscript igual pero este funciona con palanca y tipo ANI

    Código:
    local config = {
        actionId = 5900, -- ActionID to use in the lever
        bossName = "Demon",
        bossPosition = Position(3111, 1846, 7), -- Position where the boss will appear
        bossArea = {
            fromPos = Position(3101, 1845, 7), -- Upper left corner of the room
            toPos = Position(3120, 1855, 7), -- Lower right corner of the room
            entrancePos = Position(3119, 1845, 7), -- Position where players will be teleported when they enter
            exitPosition = Position(3118, 1842, 7) -- If the participants take too long they will be kicked from the room to this position
        },
        allowedAnyParticipantsCount = true, -- allow any valid number of participants to enter. example: 1,2,3 or 4
        participantsPos = {
            Position(3117, 1842, 7), -- Player 1, this player should be the one to pull the lever
            Position(3118, 1842, 7), -- Player 2
            Position(3119, 1842, 7), -- Player 3
            Position(3120, 1842, 7) -- Player 4
        },
        attempts = {
            level = 200, -- Level required to enter
            storage = 20000, -- Storage where we keep the waiting time
            seconds = 72000 -- 20 hours
        },
        createTeleportPos = Position(3112, 1845, 7), -- Position where the teleport is created when the boss dies
        teleportToPosition = Position(3122, 1845, 7), -- Position where the teleport created by the boss will take you when you die
        teleportRemoveSeconds = 10, -- seconds
        kickParticipantAfterSeconds = 60 * 15, -- 15 minutes
        leverIds = {1945, 1946} -- Lever animation, on/off
    }

    local function getSpectators(onlyPlayers)
        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, onlyPlayers, config.diffX, config.diffX, config.diffY, config.diffY)
    end

    local action = Action()

    function action.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 a while before being able to enter again.", participant:getName()))
                elseif participant:getLevel() < config.attempts.level then
                    player:sendCancelMessage(string.format("The player %s is not level %d.", participant:getName(), config.attempts.level))
                else
                    participants[#participants +1] = participant
                end
            end
        end

        if #participants == 0 then
            player:sendCancelMessage("You need at least one participant.")
            return true
        elseif not config.allowedAnyParticipantsCount and #participants ~= #config.participantsPos then
            player:sendCancelMessage("You need all participants.")
            return true
        end

        if #getSpectators(true) > 0 then
            player:sendCancelMessage("At this time the room is occupied, please try again later.")
            return true
        end

        stopEvent(config.kickEventId)

        for _, monsterSpectator in pairs(getSpectators()) do
            monsterSpectator:remove()
        end

        local boss = Game.createMonster(config.bossName, config.bossPosition)
        if not boss then
            player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        boss:registerEvent("bossSystemDeath")

        for index, participant in pairs(participants) do
            participant:getPosition():sendMagicEffect(CONST_ME_POFF)
            participant:teleportTo(config.bossArea.entrancePos, false)
            participant:getPosition():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)
                    spectator:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                    spectator:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It's been a long time and you haven't managed to defeat the boss.")
                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

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

    local creatureEvent = CreatureEvent("bossSystemDeath")

    function creatureEvent.onDeath()
        stopEvent(config.kickEventId)
        local teleport = Game.createItem(1387, 1, config.createTeleportPos)
        if teleport then
            teleport:setDestination(config.teleportToPosition)
            addEvent(function ()
                local tile = Tile(config.createTeleportPos)
                if tile then
                    local teleport = tile:getItemById(1387)
                    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)
                        spectator:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                    else
                        spectator:remove()
                    end
                end
            end, config.teleportRemoveSeconds * 1000)
        end
        return true
    end

    creatureEvent:register()


    [Monsters] RevScripts - Crear Portal al Matar un Monsters [TFS 1.3 OR OTX 3.1] Screen10

    ESTO TAMBIEN ES OTRO FORO. CREDITOS A SARAH WESKER POR HACER ESTE SCRIPT



    [Tienes que estar registrado y conectado para ver este vínculo] Servidor 24/7 Full Animes  Smile    MI GITHUB (REVSCRIPTS TFS 1.3-1.5))
    2 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).