Hello, I'm going to release my customized teleport script. It's simple and maybe there is someone that want to use this useless script ^_^
I'm sure there's another way to do this script, with less codelines. I'm new to LUA, don't blame me.
First off we have to create an walkable tile with the Action ID: 9500 (the Action ID can be any value, remember to change the action ID, both in the mapeditor and in movements.xml)
I've added 2 images on how to change the Action IDs of a tile
after that we are going to add a line in:
data/movements/movements.xml
After that, we're going to create a new .lua dokument. Name it "teleports.lua", without the quotes.
data/movements/scripts/teleports.lua
How to edit:
To change the coordinates of the tiles position we have to change the
fromPos.x, fromPos.y and fromPos.z.
The red numbers are the X coordinates
The green numbers are the Y coordinates
The blue numbers are the Z coordinates
These are the coordiantes you have to enter in order to get teleported.
The destination of our teleport are simple, just these coordinates:
Note: I know that this thread, may be a little to detailed.
Best regards,
Dridia
I'm sure there's another way to do this script, with less codelines. I'm new to LUA, don't blame me.
First off we have to create an walkable tile with the Action ID: 9500 (the Action ID can be any value, remember to change the action ID, both in the mapeditor and in movements.xml)
I've added 2 images on how to change the Action IDs of a tile
after that we are going to add a line in:
data/movements/movements.xml
XML:
<movevent type="StepIn" actionid="9500" event="script" value="teleports.lua"/>
After that, we're going to create a new .lua dokument. Name it "teleports.lua", without the quotes.
data/movements/scripts/teleports.lua
Lua:
function onStepIn(cid, item, frompos, itemEx, topos)
local fromPos = getPlayerPosition(cid)
local toMonster = {x=1310, y=1024, z=8}
local toQuest = {x=1308, y=1059, z=8}
local toShop = {x=1031, y=1002, z=7}
local toHouse = {x=1564, y=1489, z=7}
local toOB = {x=1214, y=1073, z=7}
if fromPos.x == 997 and fromPos.y == 994 and fromPos.z == 7 then
local fromMonster = {x=998, y=994, z=7}
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING,"Welcome to the monster teleports!")
doTeleportThing(cid, toMonster)
doSendMagicEffect(toMonster, 37)
doSendMagicEffect(fromMonster, 67)
elseif fromPos.x == 995 and fromPos.y == 994 and fromPos.z == 7 then
local fromQuest = {x=996, y=994, z=7}
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING,"Welcome to the quest room!")
doTeleportThing(cid, toQuest)
doSendMagicEffect(toQuest, 37)
doSendMagicEffect(fromQuest, 67)
elseif fromPos.x == 991 and fromPos.y == 994 and fromPos.z == 7 then
local fromShop = {x=992, y=994, z=7}
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING,"Welcome to the shops!")
doTeleportThing(cid, toShop)
doSendMagicEffect(toShop, 37)
doSendMagicEffect(fromShop, 67)
elseif fromPos.x == 990 and fromPos.y == 995 and fromPos.z == 7 then
local fromHouse = {x=991, y=995, z=7}
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING,"Welcome to the house island!")
doTeleportThing(cid, toHouse)
doSendMagicEffect(toHouse, 37)
doSendMagicEffect(fromHouse, 67)
elseif fromPos.x == 990 and fromPos.y == 996 and fromPos.z == 7 then
local fromOB = {x=991, y=996, z=7}
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING,"Welcome to the open battle!")
doTeleportThing(cid, toOB)
doSendMagicEffect(toOB, 37)
doSendMagicEffect(fromOB, 67)
end
end
To change the coordinates of the tiles position we have to change the
fromPos.x, fromPos.y and fromPos.z.
Code:
if fromPos.x == [COLOR="#FF0000"]997[/COLOR] and fromPos.y == [COLOR="#00FF00"]994[/COLOR] and fromPos.z == [COLOR="#0000FF"]7[/COLOR] then
The red numbers are the X coordinates
The green numbers are the Y coordinates
The blue numbers are the Z coordinates
These are the coordiantes you have to enter in order to get teleported.
The destination of our teleport are simple, just these coordinates:
Lua:
local toMonster = {x=1310, y=1024, z=8}
Note: I know that this thread, may be a little to detailed.
Best regards,
Dridia