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

|Revscript request| Teleport after a Boss is killed

Joined
Mar 29, 2023
Messages
11
Reaction score
9
Hey Guys,

I Had a system backup and lost a RevScript found right here at OtLand Forums. It was basically a Revsvript that created a teleport when a Boss died. I was actually using it without any issues. Does anyone know where I can find it or better yet, can anyone share it, please?
 
Solution
Maybe this is the one you are talking about?
Lua:
-- Boss teleport spawn script by mdwilliams.
-- https://otland.net/threads/tfs-1-2-portal-created-on-monster-death.265567/#post-2567024
-- Converted to TFS 1.3 Revscriptsys by Evil Hero.

local teleportToPosition = Position(1059, 374, 8)
local teleportCreatePosition = Position(1031,354, 8)
local bossName = "demon"
local killMessage = "You have killed Boss Monster! A teleport has been created but it will disappear in 5 minutes!"

-- Function that will remove the teleport after a given time
local function removeTeleport(position)
    local teleportItem = Tile(position):getItemById(1387)
    if teleportItem then
        teleportItem:remove()
        position:sendMagicEffect(CONST_ME_POFF)...
Hey Guys,

I Had a system backup and lost a RevScript found right here at OtLand Forums. It was basically a Revsvript that created a teleport when a Boss died. I was actually using it without any issues. Does anyone know where I can find it or better yet, can anyone share it, please?

Hello,

To help me better understand your request, could you please provide more information about the script you're looking for? For example, what is the name of the monster that triggers the creation of the teleport? Also, does the teleport created by the script need to disappear after a certain amount of time, or is it permanent?
 
Hello,

To help me better understand your request, could you please provide more information about the script you're looking for? For example, what is the name of the monster that triggers the creation of the teleport? Also, does the teleport created by the script need to disappear after a certain amount of time, or is it permanent?
Hey!

So the script was actioned when a boss was killed (you could add as many bosses you wanted just getting the name) and once the boss was killed it created a teleport (basic script like from pos x, y, z to pos x, y,z.) And the teleport lasted 60 seconds and had a countdown to 0, once it reached 0 the teleport was deleted. It was great because I'm doing custom quests and it fits perfectly.
 
Hello,
Something like this?

Lua:
local bosskillevent = CreatureEvent("BossKill")

local monsters = {
    "Ghazbaran",
    "Morgaroth",
    "Orshabaal"
}

local teleportItemId = 1387
local teleportDuration = 60  -- the duration of the teleport in seconds

function bosskillevent.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    for _, monsterName in ipairs(monsters) do
        if creature:getName() == monsterName then
            -- create a teleport on the position where the monster died
            local position = creature:getPosition()
            local teleport = Game.createItem(teleportItemId, 1, position)
            if teleport then
                teleport:setDestination(position)
            end
            addEvent(function() teleport:remove() end, teleportDuration * 1000)
            break
        end
    end
    return true
end

bosskillevent:register()
 
Last edited:
Hello,
Something like this?

Lua:
local bosskillevent = CreatureEvent("BossKill")

local monsters = {
    "Ghazbaran",
    "Morgaroth",
    "Orshabaal"
}

local teleportItemId = 1387
local teleportDuration = 60  -- the duration of the teleport in seconds

function bosskillevent.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    for _, monsterName in ipairs(monsters) do
        if creature:getName() == monsterName then
            -- create a teleport on the position where the monster died
            local position = creature:getPosition()
            local teleport = Game.createItem(teleportItemId, 1, position)
            if teleport then
                teleport:setDestination(position)
            end
            addEvent(function() teleport:remove() end, teleportDuration * 1000)
            break
        end
    end
    return true
end

bosskillevent:register()
hello friend, excuse my ignorance, where can I add this script in that folder?
 
Hello,
Something like this?

Lua:
local bosskillevent = CreatureEvent("BossKill")

local monsters = {
    "Ghazbaran",
    "Morgaroth",
    "Orshabaal"
}

local teleportItemId = 1387
local teleportDuration = 60  -- the duration of the teleport in seconds

function bosskillevent.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    for _, monsterName in ipairs(monsters) do
        if creature:getName() == monsterName then
            -- create a teleport on the position where the monster died
            local position = creature:getPosition()
            local teleport = Game.createItem(teleportItemId, 1, position)
            if teleport then
                teleport:setDestination(position)
            end
            addEvent(function() teleport:remove() end, teleportDuration * 1000)
            break
        end
    end
    return true
end

bosskillevent:register()
teleport:setDestination should be other position, at the moment it is set to creature:getPosition (wchich is correct, because it tells where to create the script at, but the destination should be in config variables, near the teleportDuration for example.
Actually, the best would be to not create an array, but a table,
local monsters = {
[monsterName] = { teleportTo = ... },
[monsterName2] ...
}
but even now the script is good. well done.

@Mateus Robeerto works only for tfs 1.x (the version that will have revscripts), the revscripts go to folderEngine/data/scripts...
 
hello friend, excuse my ignorance, where can I add this script in that folder?
Hello! To use the code in your project, you'll need to place it in the 'data/creaturescripts/scriptname.lua' directory. Just a heads up: the script is currently named 'scriptname.lua', but you'll want to change that to a name that makes sense.
Post automatically merged:

teleport:setDestination should be other position, at the moment it is set to creature:getPosition (wchich is correct, because it tells where to create the script at, but the destination should be in config variables, near the teleportDuration for example.
Actually, the best would be to not create an array, but a table,
local monsters = {
[monsterName] = { teleportTo = ... },
[monsterName2] ...
}
but even now the script is good. well done.

@Mateus Robeerto works only for tfs 1.x (the version that will have revscripts), the revscripts go to folderEngine/data/scripts...

Something like this?


Lua:
local bosskillevent = CreatureEvent("BossKill")

local monsters = {
    {
        name = "Ghazbaran",
        position = {x = 100, y = 200, z = 7}
    },
    {
        name = "Morgaroth",
        position = {x = 300, y = 400, z = 7}
    },
    {
        name = "Orshabaal",
        position = {x = 500, y = 600, z = 7}
    }
}

local teleportItemId = 1387
local teleportDuration = 60  -- the duration of the teleport in seconds

function bosskillevent.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    for _, monster in ipairs(monsters) do
        if creature:getName() == monster.name then
            local position = Position(monster.position)
            local teleport = Game.createItem(teleportItemId, 1, position)
            if teleport then
                teleport:setDestination(position)
            end
            addEvent(function() teleport:remove() end, teleportDuration * 1000)
            break
        end
    end
    return true
end

bosskillevent:register()
 
Last edited:
Hello! To use the code in your project, you'll need to place it in the 'data/creaturescripts/scriptname.lua' directory. Just a heads up: the script is currently named 'scriptname.lua', but you'll want to change that to a name that makes sense.
Post automatically merged:



Something like this?


Lua:
local bosskillevent = CreatureEvent("BossKill")

local monsters = {
    {
        name = "Ghazbaran",
        position = {x = 100, y = 200, z = 7}
    },
    {
        name = "Morgaroth",
        position = {x = 300, y = 400, z = 7}
    },
    {
        name = "Orshabaal",
        position = {x = 500, y = 600, z = 7}
    }
}

local teleportItemId = 1387
local teleportDuration = 60  -- the duration of the teleport in seconds

function bosskillevent.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    for _, monster in ipairs(monsters) do
        if creature:getName() == monster.name then
            local position = Position(monster.position)
            local teleport = Game.createItem(teleportItemId, 1, position)
            if teleport then
                teleport:setDestination(position)
            end
            addEvent(function() teleport:remove() end, teleportDuration * 1000)
            break
        end
    end
    return true
end

bosskillevent:register()
ok, thank you very much as soon as I get home I will test it
 
@EkkoLua
In this way: loop is not needed, the table is flexible and can easily be extended for other options like rewarding the player with item and other necessary things. Right now, it is positionOut only, as the guy requested.
Lua:
local bosskillevent = CreatureEvent("BossKill")

local monsters = {
    ["ghazbaran"] = { positionOut = {x = 100, y = 200, z = 7} }, -- where the teleport created on the corpse will teleport to.
    ["morgaroth"] = { positionOut = {x = 300, y = 400, z = 7} }
}

local teleportItemId = 1387
local teleportDuration = 60  -- the duration of the teleport in seconds

function bosskillevent.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
        if monsters[creature:getName():lower()] then
            local config = monsters[creature:getName():lower()]
            local position = creature:getPosition()
            local teleport = Game.createItem(teleportItemId, 1, position)
            if teleport then
                teleport:setDestination(config.positionOut)
            end
            addEvent(function() teleport:remove() end, teleportDuration * 1000)
        end
    return true
end

bosskillevent:register()
 
@EkkoLua
In this way: loop is not needed, the table is flexible and can easily be extended for other options like rewarding the player with item and other necessary things. Right now, it is positionOut only, as the guy requested.
Lua:
local bosskillevent = CreatureEvent("BossKill")

local monsters = {
    ["ghazbaran"] = { positionOut = {x = 100, y = 200, z = 7} }, -- where the teleport created on the corpse will teleport to.
    ["morgaroth"] = { positionOut = {x = 300, y = 400, z = 7} }
}

local teleportItemId = 1387
local teleportDuration = 60  -- the duration of the teleport in seconds

function bosskillevent.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
        if monsters[creature:getName():lower()] then
            local config = monsters[creature:getName():lower()]
            local position = creature:getPosition()
            local teleport = Game.createItem(teleportItemId, 1, position)
            if teleport then
                teleport:setDestination(config.positionOut)
            end
            addEvent(function() teleport:remove() end, teleportDuration * 1000)
        end
    return true
end

bosskillevent:register()

Thanks for pointing that out! Just to let you know, I don't actually have TFS 1.5 or 1.4 running. I'm writing these scripts based on things I found here.
 
Hey Guys,

I Had a system backup and lost a RevScript found right here at OtLand Forums. It was basically a Revsvript that created a teleport when a Boss died. I was actually using it without any issues. Does anyone know where I can find it or better yet, can anyone share it, please?
Maybe this is the one you are talking about?
Lua:
-- Boss teleport spawn script by mdwilliams.
-- https://otland.net/threads/tfs-1-2-portal-created-on-monster-death.265567/#post-2567024
-- Converted to TFS 1.3 Revscriptsys by Evil Hero.

local teleportToPosition = Position(1059, 374, 8)
local teleportCreatePosition = Position(1031,354, 8)
local bossName = "demon"
local killMessage = "You have killed Boss Monster! A teleport has been created but it will disappear in 5 minutes!"

-- Function that will remove the teleport after a given time
local function removeTeleport(position)
    local teleportItem = Tile(position):getItemById(1387)
    if teleportItem then
        teleportItem:remove()
        position:sendMagicEffect(CONST_ME_POFF)
    end
end

local event = CreatureEvent("BossKill")

function event.onKill(creature, target)
    if target:isPlayer() or target:getMaster()  or target:getName():lower() ~= bossName then
        return true
    end

    local position = target:getPosition()
    position:sendMagicEffect(CONST_ME_TELEPORT)
    local item = Game.createItem(1387, 1, teleportCreatePosition)

    if item:isTeleport() then
        item:setDestination(teleportToPosition)
    end

    target:say(killMessage, TALKTYPE_MONSTER_SAY, 0, 0, position)

    -- Remove portal after 5 minutes
    addEvent(removeTeleport, 1 * 60 * 1000, position)

    return true
end

event:register()

local login = CreatureEvent("RegisterBossKill")

function login.onLogin(player)
    player:registerEvent("BossKill")
    return true
end

login:register()
 
Maybe this is the one you are talking about?
Lua:
-- Boss teleport spawn script by mdwilliams.
-- https://otland.net/threads/tfs-1-2-portal-created-on-monster-death.265567/#post-2567024
-- Converted to TFS 1.3 Revscriptsys by Evil Hero.

local teleportToPosition = Position(1059, 374, 8)
local teleportCreatePosition = Position(1031,354, 8)
local bossName = "demon"
local killMessage = "You have killed Boss Monster! A teleport has been created but it will disappear in 5 minutes!"

-- Function that will remove the teleport after a given time
local function removeTeleport(position)
    local teleportItem = Tile(position):getItemById(1387)
    if teleportItem then
        teleportItem:remove()
        position:sendMagicEffect(CONST_ME_POFF)
    end
end

local event = CreatureEvent("BossKill")

function event.onKill(creature, target)
    if target:isPlayer() or target:getMaster()  or target:getName():lower() ~= bossName then
        return true
    end

    local position = target:getPosition()
    position:sendMagicEffect(CONST_ME_TELEPORT)
    local item = Game.createItem(1387, 1, teleportCreatePosition)

    if item:isTeleport() then
        item:setDestination(teleportToPosition)
    end

    target:say(killMessage, TALKTYPE_MONSTER_SAY, 0, 0, position)

    -- Remove portal after 5 minutes
    addEvent(removeTeleport, 1 * 60 * 1000, position)

    return true
end

event:register()

local login = CreatureEvent("RegisterBossKill")

function login.onLogin(player)
    player:registerEvent("BossKill")
    return true
end

login:register()

Thanks for your input. It seems like the script you shared might be similar to what OP is looking for.

I wanted to share some updates I made to the code, and I also want to thank mdwilliams and Evil Hero for providing me with a base. The updated code now allows you to add multiple monsters, and you can configure how long it takes for the teleport to disappear for each monster. When you defeat a boss, the message you set will always appear on the monster itself. Additionally, if 'teleportCreateDestination' is set to 'false', the teleport will be created at the spot where the monster was killed.

Lua:
local bosses = {
    ["skeleton"] = {
        teleportCreateDestination = Position(1019, 1027, 7), -- If you set this to false, the teleport will be created at the destination where the monster dies.
        teleportDestination = Position(1021, 1024, 7),
        teleportRemoveTime = 1, -- 1 minute
        message = "You have killed the boss! The teleport will disappear in 1 minute.",
    },
    ["bug"] = {
        teleportCreateDestination = false, -- If you set this to false, the teleport will be created at the destination where the monster dies.
        teleportDestination = Position(1021, 1024, 7),
        teleportRemoveTime = 1, -- 1 minute(s)
        message = "You have killed the boss! The teleport will disappear in 1 minute.",
    },
}

local function removeTeleport(position)
    local teleportItem = Tile(position):getItemById(1387)
    if teleportItem then
        teleportItem:remove()
        position:sendMagicEffect(CONST_ME_POFF)
    end
end

local event = CreatureEvent("BossKill")

function event.onKill(creature, target)
    local bossName = target:getName():lower()
    if not bosses[bossName] then
        return true
    end
 
    local bossConfig = bosses[bossName]
    local bossPosition = target:getPosition()
    local teleportCreateDestination = bossConfig.teleportCreateDestination
    if not teleportCreateDestination then
        teleportCreateDestination = bossPosition
    end
    local teleport = Game.createItem(1387, 1, teleportCreateDestination)
    if teleport:isTeleport() then
        teleport:setDestination(bossConfig.teleportDestination)
    end
    teleportCreateDestination:sendMagicEffect(CONST_ME_TELEPORT)
    target:say(bossConfig.message, TALKTYPE_MONSTER_SAY, 0, 0, bossPosition)
    -- remove teleport
    addEvent(removeTeleport, bossConfig.teleportRemoveTime * 60 * 1000, teleportCreateDestination)

    return true
end

event:register()

local login = CreatureEvent("RegisterBossKill")

function login.onLogin(player)
    player:registerEvent("BossKill")
    return true
end

login:register()
 
Solution
Thanks for your input. It seems like the script you shared might be similar to what OP is looking for.

I wanted to share some updates I made to the code, and I also want to thank mdwilliams and Evil Hero for providing me with a base. The updated code now allows you to add multiple monsters, and you can configure how long it takes for the teleport to disappear for each monster. When you defeat a boss, the message you set will always appear on the monster itself. Additionally, if 'teleportCreateDestination' is set to 'false', the teleport will be created at the spot where the monster was killed.

Lua:
local bosses = {
    ["skeleton"] = {
        teleportCreateDestination = Position(1019, 1027, 7), -- If you set this to false, the teleport will be created at the destination where the monster dies.
        teleportDestination = Position(1021, 1024, 7),
        teleportRemoveTime = 1, -- 1 minute
        message = "You have killed the boss! The teleport will disappear in 1 minute.",
    },
    ["bug"] = {
        teleportCreateDestination = false, -- If you set this to false, the teleport will be created at the destination where the monster dies.
        teleportDestination = Position(1021, 1024, 7),
        teleportRemoveTime = 1, -- 1 minute(s)
        message = "You have killed the boss! The teleport will disappear in 1 minute.",
    },
}

local function removeTeleport(position)
    local teleportItem = Tile(position):getItemById(1387)
    if teleportItem then
        teleportItem:remove()
        position:sendMagicEffect(CONST_ME_POFF)
    end
end

local event = CreatureEvent("BossKill")

function event.onKill(creature, target)
    local bossName = target:getName():lower()
    if not bosses[bossName] then
        return true
    end
 
    local bossConfig = bosses[bossName]
    local bossPosition = target:getPosition()
    local teleportCreateDestination = bossConfig.teleportCreateDestination
    if not teleportCreateDestination then
        teleportCreateDestination = bossPosition
    end
    local teleport = Game.createItem(1387, 1, teleportCreateDestination)
    if teleport:isTeleport() then
        teleport:setDestination(bossConfig.teleportDestination)
    end
    teleportCreateDestination:sendMagicEffect(CONST_ME_TELEPORT)
    target:say(bossConfig.message, TALKTYPE_MONSTER_SAY, 0, 0, bossPosition)
    -- remove teleport
    addEvent(removeTeleport, bossConfig.teleportRemoveTime * 60 * 1000, teleportCreateDestination)

    return true
end

event:register()

local login = CreatureEvent("RegisterBossKill")

function login.onLogin(player)
    player:registerEvent("BossKill")
    return true
end

login:register()
Great, just what I was looking for... TBH even better due to the personalized timer for each boss!
PD: I didn't know the boss's name had to be under-case, if you use uppercase it will not work 🤣
 
Great, just what I was looking for... TBH even better due to the personalized timer for each boss!
PD: I didn't know the boss's name had to be under-case, if you use uppercase it will not work 🤣

I've retested the code with uppercase letters to confirm if it would still work. During my tests, I entered words like Skeleton, Dragon, BUG, and ROTWORM, but I didn't encounter any issues. The reason the code is able to handle uppercase letters is that it uses the ":lower()" function to convert all inputs to lowercase before processing them. So, no matter what case you enter the words in, the function will convert them to lowercase and ensure that the code runs smoothly.
 
I've retested the code with uppercase letters to confirm if it would still work. During my tests, I entered words like Skeleton, Dragon, BUG, and ROTWORM, but I didn't encounter any issues. The reason the code is able to handle uppercase letters is that it uses the ":lower()" function to convert all inputs to lowercase before processing them. So, no matter what case you enter the words in, the function will convert them to lowercase and ensure that the code runs smoothly.
Pretty sure they meant the names in the table. xP
 
Back
Top