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

Unique Teleport knows location

wafuboe

Member
Joined
Dec 24, 2010
Messages
881
Solutions
2
Reaction score
22
Hello well my idea is to make a teleport in each of the temples of my server, that leads to a lobby with shops, trainers, events etc.

But i need please when you enter want to take back the teleport to the town temple it travel you to the temple you use the teleport

The teleport should recognize the temple where yoou access and get you back there.


srry for my bad english
 
Solution
TFS 1.2

Lua:
local teleports = {
    [1001] = {pos = {x = 1000, y = 1000, z = 7}, value = 1},
    [1002] = {pos = {x = 1000, y = 1000, z = 7}, value = 2},
    [1003] = {pos = {x = 1000, y = 1000, z = 7}, value = 3}
}

local temples = {
    [1] = {x = 1000, y = 1000, z = 7}, --Storage value 1 with bring them to this temple
    [2] = {x = 1000, y = 1000, z = 7}, -- Storage value 2 will bring them to this one
    [3] = {x = 1000, y = 1000, z = 7} -- Storage value 3 will bring them to this one
}

local storage = 16000
local aid = 1000
local portalId = 1367

function onStepIn(creature, item, position, fromPosition)
    if item.itemid ~= portalId then return true end
    if not creature:isPlayer() then return true end
   
    local TELEPORT =...
TFS 1.2

Lua:
local teleports = {
    [1001] = {pos = {x = 1000, y = 1000, z = 7}, value = 1},
    [1002] = {pos = {x = 1000, y = 1000, z = 7}, value = 2},
    [1003] = {pos = {x = 1000, y = 1000, z = 7}, value = 3}
}

local temples = {
    [1] = {x = 1000, y = 1000, z = 7}, --Storage value 1 with bring them to this temple
    [2] = {x = 1000, y = 1000, z = 7}, -- Storage value 2 will bring them to this one
    [3] = {x = 1000, y = 1000, z = 7} -- Storage value 3 will bring them to this one
}

local storage = 16000
local aid = 1000
local portalId = 1367

function onStepIn(creature, item, position, fromPosition)
    if item.itemid ~= portalId then return true end
    if not creature:isPlayer() then return true end
   
    local TELEPORT = teleports[item:getActionId()]
   
    if not TELEPORT then
        if item:getActionId() == 1000 then
            local TEMPLE = temples[creature:getStorageValue(storage)]
            if not TEMPLE then return true end
           
            creature:teleportTo(TEMPLE)
            Position(creature:getPosition()):sendMagicEffect(CONST_ME_TELEPORT)
        end
    else
        creature:teleportTo(TELEPORT.pos)
        creature:setStorageValue(storage, TELEPORT.value)
        Position(creature:getPosition()):sendMagicEffect(CONST_ME_TELEPORT)
    end
return true
end
 
Solution
TFS 1.2

Lua:
local teleports = {
    [1001] = {pos = {x = 1000, y = 1000, z = 7}, value = 1},
    [1002] = {pos = {x = 1000, y = 1000, z = 7}, value = 2},
    [1003] = {pos = {x = 1000, y = 1000, z = 7}, value = 3}
}

local temples = {
    [1] = {x = 1000, y = 1000, z = 7}, --Storage value 1 with bring them to this temple
    [2] = {x = 1000, y = 1000, z = 7}, -- Storage value 2 will bring them to this one
    [3] = {x = 1000, y = 1000, z = 7} -- Storage value 3 will bring them to this one
}

local storage = 16000
local aid = 1000
local portalId = 1367

function onStepIn(creature, item, position, fromPosition)
    if item.itemid ~= portalId then return true end
    if not creature:isPlayer() then return true end
 
    local TELEPORT = teleports[item:getActionId()]
 
    if not TELEPORT then
        if item:getActionId() == 1000 then
            local TEMPLE = temples[creature:getStorageValue(storage)]
            if not TEMPLE then return true end
         
            creature:teleportTo(TEMPLE)
            Position(creature:getPosition()):sendMagicEffect(CONST_ME_TELEPORT)
        end
    else
        creature:teleportTo(TELEPORT.pos)
        creature:setStorageValue(storage, TELEPORT.value)
        Position(creature:getPosition()):sendMagicEffect(CONST_ME_TELEPORT)
    end
return true
end

I got an error

2ynow3l.png


Code:
local teleports = {
    [1001] = {pos = {x = 286, y = 44, z = 14}, value = 1},
    [1002] = {pos = {x = 286, y = 44, z = 14}, value = 2},
    [1003] = {pos = {x = 1000, y = 1000, z = 7}, value = 3}
}

local temples = {
    [1] = {x = 433, y = 504, z = 7}, --Storage value 1 with bring them to this temple
    [2] = {x = 339 y = 517, z = 7}, -- Storage value 2 will bring them to this one
    [3] = {x = 1000, y = 1000, z = 7} -- Storage value 3 will bring them to this one
   
}

local storage = 16000
local aid = 1000
local portalId = 1367

function onStepIn(creature, item, position, fromPosition)
    if item.itemid ~= portalId then return true end
    if not creature:isPlayer() then return true end
 
    local TELEPORT = teleports[item:getActionId()]
 
    if not TELEPORT then
        if item:getActionId() == 1000 then
            local TEMPLE = temples[creature:getStorageValue(storage)]
            if not TEMPLE then return true end
         
            creature:teleportTo(TEMPLE)
            Position(creature:getPosition()):sendMagicEffect(CONST_ME_TELEPORT)
        end
    else
        creature:teleportTo(TELEPORT.pos)
        creature:setStorageValue(storage, TELEPORT.value)
        Position(creature:getPosition()):sendMagicEffect(CONST_ME_TELEPORT)
    end
return true
end
 
Back
Top