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

Lua Other Walkable Teleport [Help] TFS 1.0

Maltexor

Active Member
Joined
Mar 9, 2014
Messages
214
Reaction score
40
Location
Germany
So yea i want to make an Telport but not the Blue Portal i want an other Item thats moveble thats Teleports me to an exact POS.

I tried it with citzen.lua with uniqueid 1125 but it just Ports to Town POS and i want an exact POS.

I don't know the new Functions because last time i coded was 5 years ago xD


My citzen.lua
Code:
local t = {
  [1125] = {id = 2},
}
function onStepIn(cid, item, position, fromPosition)
  local town = t[item.uid]
  if Player(cid) then
    if town then
      doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
      doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
      end
  end
  return true
end

Movements.xml

Code:
<movevent event="StepIn" uniqueid="1125" script="tp.lua"/>
 
So yea i want to make an Telport but not the Blue Portal i want an other Item thats moveble thats Teleports me to an exact POS.

I tried it with citzen.lua with uniqueid 1125 but it just Ports to Town POS and i want an exact POS.

I don't know the new Functions because last time i coded was 5 years ago xD


My citzen.lua
Code:
local t = {
  [1125] = {id = 2},
}
function onStepIn(cid, item, position, fromPosition)
  local town = t[item.uid]
  if Player(cid) then
    if town then
      doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
      doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
      end
  end
  return true
end

Movements.xml

Code:
<movevent event="StepIn" uniqueid="1125" script="tp.lua"/>

Its easy just add this under items which you need it

items.xml
Code:
</item>
        <item id="ID" article="a" name="NAME">
        <attribute key="type" value="teleport" />
        </item>
And you can add it on remer's map editor
 
Try:
Code:
local t = {
    [9056] = {id = 4},
    [9057] = {id = 2},
    [9058] = {id = 1},
    [9059] = {id = 5},
    [9060] = {id = 3},
    [9061] = {id = 10},
    [9062] = {id = 9},
    [9063] = {id = 11},
    [9064] = {id = 7},
    [9065] = {id = 8},
    [9066] = {id = 12},
    [9067] = {id = 13},
    [9068] = {id = 14},
    [9240] = {id = 28}
}
function onStepIn(cid, item, position, fromPosition)
    local town = t[item.uid]
    if Player(cid) then
        if town then
            Player(cid):setTown(Town(town.id))
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are now a citizen of "..getTownName(getPlayerTown(cid))..".")   
        end
    end
    return true
end
 
yea but i cant set teleport pos on rme?
Its easy just add this under items which you need it

items.xml
Code:
</item>
        <item id="ID" article="a" name="NAME">
        <attribute key="type" value="teleport" />
        </item>
And you can add it on remer's map editor

Thanks best an easy way works!
Try:
Code:
local t = {
    [9056] = {id = 4},
    [9057] = {id = 2},
    [9058] = {id = 1},
    [9059] = {id = 5},
    [9060] = {id = 3},
    [9061] = {id = 10},
    [9062] = {id = 9},
    [9063] = {id = 11},
    [9064] = {id = 7},
    [9065] = {id = 8},
    [9066] = {id = 12},
    [9067] = {id = 13},
    [9068] = {id = 14},
    [9240] = {id = 28}
}
function onStepIn(cid, item, position, fromPosition)
    local town = t[item.uid]
    if Player(cid) then
        if town then
            Player(cid):setTown(Town(town.id))
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are now a citizen of "..getTownName(getPlayerTown(cid))..".")  
        end
    end
    return true
end

Not test because elking helped me :)
 
Yea logically I knew it but thanks :)

Just one last question: Is it possible to change that ugly Port Effect after teleport?^^
 
Last edited by a moderator:
Back
Top