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

TFS 1.2 Portal created on monster death?

nugo

Australia OT Mapper
Joined
Apr 1, 2009
Messages
396
Solutions
4
Reaction score
194
Has anyone got a script like this or know of something similar? Im trying to have quest rewards available after the monsters death, hence when the monster dies a portal is created. I need multiple bosses to spawn their own portals with separate destinations.

Cheers
 
Solution
I have not tested this, might need to change some small things to work with TFS 1.2

Lua:
-- in creaturescripts.xml add:
-- <event type="kill" name="BossKill" script="BossKill.lua" />

-- in login.lua add:
-- player:registerEvent("BossKill")

local teleportToPosition = Position(1000, 1000, 7)
local teleportCreatePosition = Position(2000, 2000, 7)
local bossName = "boss monster"
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()...
Creaturescript - register

<event type="death" name="script_register_name" script="script/file.lua" />

Script

Code:
function onDeath(creature)

            doCreateTeleport(1387, {x = 7014, y = 1011, z = 15}, {x = 6984, y = 1010, z = 15})    return true

end

7014,1011,15 - teleport destiny, 6984,1010,15 - teleport location

To monster add

Code:
<script>

        <event name="script_register_name" />   
</script>

Sorry but i write this on phone :)
Reply this for all bosses
 
Cheers, is it possible to make the portal decay after 5 minutes?
 
Last edited:
I have not tested this, might need to change some small things to work with TFS 1.2

Lua:
-- in creaturescripts.xml add:
-- <event type="kill" name="BossKill" script="BossKill.lua" />

-- in login.lua add:
-- player:registerEvent("BossKill")

local teleportToPosition = Position(1000, 1000, 7)
local teleportCreatePosition = Position(2000, 2000, 7)
local bossName = "boss monster"
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

function 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, 5 * 60 * 1000, position)

    return true
end

Edit: confirmed working
 
Last edited:
Solution
Hello, Can i use in ot TFS 1.3 ???
Better to use onDeath, and register the event in all the boss xml/lua files.

Then create a script using onDeath, and spawn the teleport etc..
(Also a tip... make sure you set to decay the teleport quicker than its respawn time, if placed as a spawn via RME, otherwise it can possibly spawn the creature into the teleport ^^)
 
Last edited:
Back
Top