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

MoveEvent [TFS 1.1] "Catacombs" Teleporter like Diablo 3 Teleport - Great for RPG servers

I've made some changes and now it is working on TFS 1.0

Is the same script by @Fresh but converted to TFS 1.0


SCRIPT:

add this at the bottom of compat.lua
getCreatureStorage = getPlayerStorageValue


Create in data folder, file: catacombs.lua, put in:
places =
{
[1] = {placeName = "Dorion (Depot)", placeStorage = 6671, placepos = {x = 80, y = 64, z = 6}},
[2] = {placeName = "Venonh (Pits of Inferno)", placeStorage = 6672, placepos = {x = 346, y = 359, z = 8}},
[3] = {placeName = "Roshamuul (Gaz'Haragoth Lair)", placeStorage = 6673, placepos = {x = 2074, y = 228, z = 9}}
}

function getCatacombByName(name)
for k, v in pairs(places) do
if v.placeName:lower() == name:lower() then
return k
end
end
return false
end

function sendCatacombWindow(cid)
CatacombWindow = ModalWindow(1900, "Waypoints reached", "Select place:")

if CatacombWindow:getId() == 1900 then
CatacombWindow:addButton(1, "Teleport")
CatacombWindow:setDefaultEnterButton(1)
CatacombWindow:addButton(2, "Cancel")
CatacombWindow:setDefaultEscapeButton(2)

for i = 1, #places do
if getCreatureStorage(cid, places.placeStorage) == 1 then
CatacombWindow:addChoice(i, places.placeName)
end
end

end
CatacombWindow:sendToPlayer(cid)
return true
end


Add in file global.lua on top, this:
dofile('data/catacombs.lua')

Create in creaturescripts\scripts file catacomb_window.lua, put in:
function onModalWindow(cid, modalWindowId, buttonId, choiceId)

local player = Player(cid)
local pos = player:getPosition()

if modalWindowId ~= 1900 then
return false
end

if buttonId == 1 then -- Teleport

if getCreatureStorage(cid, places[choiceId].placeStorage) == 1 then
pos:sendMagicEffect(11)
player:teleportTo(places[choiceId].placepos)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have succesfully teleported to ' .. places[choiceId].placeName .. '.')
doSendMagicEffect(places[choiceId].placepos, 11)
else
sendCatacombWindow(cid)
end

elseif buttonId == 255 then
doPlayerPopupFYI(cid,"Please use a button.")
sendCatacombWindow(cid)
end

return true
end


In data\creaturescripts.xml add this:
<event type="modalwindow" name="catacombw" script="catacomb_window.lua"/>


And declare it in data\creaturescripts\login.lua by paste this:
player:registerEvent("catacombw")


In data\movements.xml add this:
<movevent event="StepIn" itemid="_ YOUR ITEMID of Teleport Rock on ground _" script="catacombs/teleporter.lua"/>
<movevent event="StepIn" uniqueid="6661" script="catacombs/zenoyagraveyard.lua"/>
<movevent event="StepIn" uniqueid="6662" script="catacombs/azsharawest.lua"/>
<movevent event="StepIn" uniqueid="6663" script="catacombs/azsharanorth.lua"/>


Create folder "catacombs" in data\movements\scripts


In folder data\movements\scripts\catacombs\
Create in sequence files: azsharanorth.lua, azsharawest.lua, teleporter.lua, zenoyagraveyard.lua

Files:
azsharanorth.lua
Code:
local t = {
    pos = {x=2073, y=228, z=9},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
    if not player then
        return true
    end

    if player:getStorageValue(6663) < 1 then
        player:setStorageValue(6663, 1)
        player:say('It looks like a teleporter..', TALKTYPE_MONSTER_SAY)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have unlocked a Waypoint: Gaz Haragoth.')
        doSendMagicEffect(t.pos, t.effect, cid)
    end
    return true
end



azsharawest.lua
Code:
local t = {
    pos = {x=346, y=358, z=8},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
    if not player then
        return true
    end

    if player:getStorageValue(6662) < 1 then
        player:setStorageValue(6662, 1)
        player:say('It looks like a teleporter..', TALKTYPE_MONSTER_SAY)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have unlocked a Waipoint: Pits of Inferno.')
        doSendMagicEffect(t.pos, t.effect, cid)
    end
    return true
end



teleporter.lua
Code:
local choose = {}

function onStepIn(cid, item, position, fromPosition)

    local player = Player(cid)
    local pos = player:getPosition()

    if not player then
        return true
    end

    if getPlayerStorageValue(cid, 6661) == 1 then
    return sendCatacombWindow(cid)
    end
 
    return true
end



zenoyagraveyard.lua

Code:
local t = {
    pos = {x=79, y=63, z=6},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)   
    if not player then
        return true
    end

    if player:getStorageValue(6661) < 1 then
        player:setStorageValue(6661, 1)
        player:say('It looks like a teleporter..', TALKTYPE_MONSTER_SAY)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have unlocked a Waypoint: Depot.')
        doSendMagicEffect(t.pos, t.effect, cid)
    end
    return true
end


I did my best
If someone wants to improve, it will be a pleasure to learn!​
 
Last edited:
Sorry me, but its same
look for teleporter.lua
Code:
local choose = {}

function onStepIn(cid, item, position, fromPosition)

    local player = Player(cid)
    local pos = player:getPosition()

    if not player then
        return true
    end

    if getPlayerStorageValue(cid, 6661) == 1 then
    return sendCatacombWindow(cid)
    end
 
    return true
end
Where should I change something ?
 
@trayron1
@Hugofasima
I've gone ahead and converted the remainder to metatables. If I missed anything, let me know. getCreatureStorage is no longer needed.
data/catacombs.lua
Code:
places = {
    [1] = {placeName = "Dorion (Depot)", placeStorage = 6671, placepos = {x = 80, y = 64, z = 6}},
    [2] = {placeName = "Venonh (Pits of Inferno)", placeStorage = 6672, placepos = {x = 346, y = 359, z = 8}},
    [3] = {placeName = "Roshamuul (Gaz'Haragoth Lair)", placeStorage = 6673, placepos = {x = 2074, y = 228, z = 9}}
}

function getCatacombByName(name)
    for k, v in pairs(places) do
        if v.placeName:lower() == name:lower() then
            return k
        end
    end
    return false
end

function Player:sendCatacombWindow()
    CatacombWindow = ModalWindow(1900, "Waypoints reached", "Select place:")

    if CatacombWindow:getId() == 1900 then
        CatacombWindow:addButton(1, "Teleport")
        CatacombWindow:setDefaultEnterButton(1)
        CatacombWindow:addButton(2, "Cancel")
        CatacombWindow:setDefaultEscapeButton(2)

        for i = 1, #places do
            if self:getStorageValue(places.placeStorage) == 1 then
                CatacombWindow:addChoice(i, places.placeName)
            end
        end 

    end
    CatacombWindow:sendToPlayer(self)
    return true
end

creaturescripts/scripts/catacomb_window.lua
Code:
function onModalWindow(player, modalWindowId, buttonId, choiceId)
    local pos = player:getPosition()
    if modalWindowId ~= 1900 then
        return false
    end
    if buttonId == 1 then -- Teleport
        if player:getStorageValue(places[choiceId].placeStorage) == 1 then
            pos:sendMagicEffect(CONST_ME_POFF)
            player:teleportTo(places[choiceId].placepos)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have succesfully teleported to ' .. places[choiceId].placeName .. '.')
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            player:sendCatacombWindow()
        end
    elseif buttonId == 255 then
        player:popupFYI("Please use a button.")
        player:sendCatacombWindow()
    end
    return true
end

azsharanorth.lua
Code:
local t = {
    pos = {x=2073, y=228, z=9},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
    if not player then
        return true
    end

    if player:getStorageValue(6663) < 1 then
        player:setStorageValue(6663, 1)
        player:say('It looks like a teleporter..', TALKTYPE_MONSTER_SAY)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have unlocked a Waypoint: Gaz Haragoth.')
        Position(t.pos):sendMagicEffect(t.effect, player)
    end
    return true
end

azsharawest.lua
Code:
local t = {
    pos = {x=346, y=358, z=8},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
    if not player then
        return true
    end

    if player:getStorageValue(6662) < 1 then
        player:setStorageValue(6662, 1)
        player:say('It looks like a teleporter..', TALKTYPE_MONSTER_SAY)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have unlocked a Waipoint: Pits of Inferno.')
        Position(t.pos):sendMagicEffect(t.effect, player)
    end
    return true
end

teleporter.lua
Code:
local choose = {}

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
    if not player then
        return true
    end
    local pos = player:getPosition()


    if player:getStorageValue(6661) == 1 then
        return player:sendCatacombWindow()
    end

    return true
end

zenoyagraveyard.lua
Code:
local t = {
    pos = {x=79, y=63, z=6},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)  
    if not player then
        return true
    end

    if player:getStorageValue(6661) < 1 then
        player:setStorageValue(6661, 1)
        player:say('It looks like a teleporter..', TALKTYPE_MONSTER_SAY)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have unlocked a Waypoint: Depot.')
        Position(t.pos):sendMagicEffect(t.effect, player)
    end
    return true
end
 
Well, look in image, now im have unlocked 3 places and none open a Window, im put uniqueid with map editor 6661 in north sqm, 6662 in right sqm and 6663 in left sqm
https://imgur.com/Xe5i1fB

If I'm doing something wrong , please teach me s2
 
Last edited:
Why a Window for i select a place for teleport dont opens? in console dont have none error, only happens this, the Window dont open when im on sqm
 
@trayron1
Replace
Code:
[1] = {placeName = "Dorion (Depot)", placeStorage = 6671, placepos = {x = 80, y = 64, z = 6}},
[2] = {placeName = "Venonh (Pits of Inferno)", placeStorage = 6672, placepos = {x = 346, y = 359, z = 8}},
[3] = {placeName = "Roshamuul (Gaz'Haragoth Lair)", placeStorage = 6673, placepos = {x = 2074, y = 228, z = 9}}
with
Code:
[1] = {placeName = "Dorion (Depot)", placeStorage = 6661, placepos = {x = 80, y = 64, z = 6}},
[2] = {placeName = "Venonh (Pits of Inferno)", placeStorage = 6662, placepos = {x = 346, y = 359, z = 8}},
[3] = {placeName = "Roshamuul (Gaz'Haragoth Lair)", placeStorage = 6663, placepos = {x = 2074, y = 228, z = 9}}

I'm not 100% familiar with how this system is supposed to work, as I have my own system for fast travel that I made.

My recommendation if you want a system like this is to use this one:
https://otland.net/threads/tfs-1-1-teleporter-spot-configurable-price-and-storage.230096/
 
Already dont work, maybe teleport works 100%, but dont open a Window for im select a place for teleport :/
 
Godlike script and idea, I'll use this for sure, thanks for sharing.
 
News? u.u
teleport.lua
try this
Code:
local choose = {}
function onStepIn(creature, item, position, fromPosition)
 local player = Player(creature)
 if not player then
 return true
 end
 local pos = player:getPosition()
 return player:sendCatacombWindow()
end
 
Again nothing happens when I go up in sqm, i cannot understand :/
Please, help me @RazorBlade
I don't know what's wrong. It isn't my script, I only converted it to metatables. If it didn't work with the default code, I doubt @Fresh would have released it. Follow all the steps in the first post and make sure you did every step.
 
I again did file by file , and teleporter.lua i used your and then @Fresh , however the only thing that happens is not open the window to choose the location ...
This is not possible :/

If the window does not open , i do not think the problem is in teleporter.lua but in catacomb_window.lua or no ?
 
Back
Top