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

You need to kill 2 monsters to create teleport

wafuboe

Member
Joined
Dec 24, 2010
Messages
881
Solutions
2
Reaction score
22
TFS 1.2
Im looking for a script that creates a teleport for a small amount of time, when you kill 2 monsters,
like golgordan and latrivan in inquisition quest

thanks c:
 
try this:
Lua:
local bosses = {
    ['YourBossName1'] = 555,
    ['YourBossName2'] = 555
}

local teleportPos = Position(1024, 1024, 7) -- position where tp will be created /to edit
local teleportDestination = Position(1024, 1026, 7) -- teleport destination /to edit
local teleportRemoveTime = 1 * 60 * 1000 -- remove teleport: TIME 1=1min /to edit

local timeMsg = teleportRemoveTime /1000

local function removeTeleport()
    local teleportItem = Tile(teleportPos):getItemById(1387)
    if teleportItem then
        teleportItem:remove()
        teleportPos:sendMagicEffect(CONST_ME_POFF)
    end
end
function onKill(player, target)
    local targetMonster = target:getMonster()
    if not targetMonster then
        return true
    end
    local targetName = targetMonster:getName():lower()
    local bossStorage = bosses[targetName]
    if not bossStorage then
        return true
    end
    local newValue = 2
    if targetName == 'YourBossName1' or targetName == 'YourBossName2' then -- add here yours bosses names! /to edit
        newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1
    end
    Game.setStorageValue(bossStorage, newValue)
    if newValue == 2 then
        player:say('You have '..timeMsg..' seconds to enter the teleport!', TALKTYPE_MONSTER_SAY) -- Msg, u can use another msg function /broadcast etc
        addEvent(Game.setStorageValue, teleportRemoveTime, bossStorage, 0)
        teleportPos:sendMagicEffect(CONST_ME_TELEPORT)
        Game.createItem(1387, 1, teleportPos)
    end
    local teleport = Tile(teleportPos):getItemById(1387)
    if teleport then
        teleport:setDestination(teleportDestination)
        addEvent(removeTeleport, teleportRemoveTime, teleportPos)
    end
    return true
end

creaturescripts.xml:
XML:
    <event type="kill" name="ScriptName" script="scriptName.lua" />

add in login.lua:
Lua:
    'ScriptName'

@edit:
FIXED!
 
Last edited:
Back
Top