• 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

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,837
Solutions
18
Reaction score
615
Location
Poland
"Catacombs" Teleporter for TFS 1.1
(Movements, CreatureScripts, Global.lua)

* How it looks? * (Not loading? CLICK > gif (lenght is 1 minute)

GIF:
MerryUglyBlackbuck.gif

Image (after unlock all 3 teleporters):
8YHnRxO.png

☛ Short About it
`Catacombs Teleporter` it's a simple teleport system of catacombs.
You can make and create more teleporters if you want to, just use brain.​

☛ How it works?
It teleports player (when player had unlocked teleport before (visited the catacomb one time at least))
to other catacomb place (player can choose between unlocked teleporters where he want get teleported).​

☛ Scripts

Create in data folder, file: catacombs.lua, put in:
Code:
places =
{
[1] = {placeName = "Zenoya Graveyard", placeStorage = 6661, placepos = {x = 443, y = 527, z = 8}},
[2] = {placeName = "Azshara West Catacomb", placeStorage = 6662, placepos = {x = 246, y = 485, z = 8}},
[3] = {placeName = "Azshara North Catacomb", placeStorage = 6663, placepos = {x = 259, y = 401, z = 7}}
}

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, "Catacombs Teleporter", "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[i].placeStorage) == 1 then
        CatacombWindow:addChoice(i, places[i].placeName)
    end
end  

  
end
CatacombWindow:sendToPlayer(cid)
return true
end

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

Create in creaturescripts\scripts file catacomb_window.lua, put in:
Code:
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:
Code:
<event type="modalwindow" name="catacombw" script="catacomb_window.lua"/>

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

In data\movements.xml add this:
Code:
<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=259, y=400, z=7},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    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 Catacomb Teleporter: Azshara North Catacomb.')
        doSendMagicEffect(t.pos, t.effect, cid)
    end
    return true
end
azsharawest.lua
Code:
local t = {
    pos = {x=246, y=486, z=8},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    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 Catacomb Teleporter: Azshara West Catacomb.')
        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=443, y=526, z=8},
    effect = CONST_ME_TUTORIALARROW
}

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    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 Catacomb Teleporter: Zenoya Graveyard.')
        doSendMagicEffect(t.pos, t.effect, cid)
    end
    return true
end

That's all,
Have fun with use.

PS.
For better quality of using this script,
I recommending you to read it and change yourself everything, so as to fit into your server.
Use your brain and humanity.
 
Woah! thanks Fresh!
 
Don't do 3 scripts with same way of working. That's just a waste of time. Use table instead so it'll be possible to add teleporters faster.
 
Don't do 3 scripts with same way of working. That's just a waste of time. Use table instead so it'll be possible to add teleporters faster.

What do you mean?
Its possible in movements for each "discover" idea?
 
example
Code:
local t = {
-- [actionid] = storage
[2441] = 6661,
[2442] = 6662,
[2443] = 6663,
}

function onStepIn(creature, item, pos, frompos)
creature:setStorageValue(t[item.actionid], 1)
end
 
I agree with zbizu, create a table and merge some files, also compare positions to check if you are teleporting to the same place you are now... because is kinda stupid walk into a teleporter to teleport to the same place you are now :p
Great script!
 
I agree with zbizu, create a table and merge some files, also compare positions to check if you are teleporting to the same place you are now... because is kinda stupid walk into a teleporter to teleport to the same place you are now :p
Great script!
or just create a loop which adds all choices excluding current spot(item.actionid)
 
This is the most awesome thing I've seen. Neat and cool as hell, great job and idé! If you could do it even more complexe like zbizu told you abow it would be amazing.
 
Last edited:
example
Code:
local t = {
-- [actionid] = storage
[2441] = 6661,
[2442] = 6662,
[2443] = 6663,
}

function onStepIn(creature, item, pos, frompos)
creature:setStorageValue(t[item.actionid], 1)
end

Would this work?

local t = {
-- [actionid] = storage
[2441] = 6661,
[2442] = 6662,
}

function onStepIn(creature, item, pos, frompos)
creature:setStorageValue(t[item.actionid], 1)
end

function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
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 Catacomb Teleporter: Azshara North Catacomb.')
elseif 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 Minimalistic Vortex:: Thais Depot.')
end
return true
end

I keep getting errors on line 12 on the "getPlayerStorageValue" in
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
 
Change getPlayerStorageValue(cid, 6661) to player:getStorageValue(6661).
 
Last edited:
OMGGGGG!!! I LOVE IT!

It is possible for TFS 1.0?

Or need changes?
 
Last edited:
Back
Top