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

Osillion

New Member
Joined
Jan 3, 2010
Messages
47
Reaction score
0
Hi everyone!

This is my first tutorial.

What is this tutorial about?


Step on "XXX" item teleport you to X,Y,Z

First of all go to data,movements, script creat a new file and add this save as specialteleport.lua


Code:
 local nPos = {
x = 1408,
y = 1055,
z = 9
}

function onStepIn(cid, item, frompos, item2, topos)
	if item.uid == 4500 then
		doTeleportThing(cid, nPos)
	end
	return TRUE
end

Now what you can change:
Code:
x = 1408,
y = 1055,
z = 9
The place where the player will be teleported to

Code:
	if item.uid == 4500 then
The item uniqueid

Then go to movements.xml and search <!-- Citizen teleport -->

When you'll find it just add this
Code:
       <movevent type="StepIn" uniqueid="4500" event="script" value="specialteleport.lua"/>

Go to your mapeditor place the item somewhere right click on it and add the uniqueid.


Hope It Will Be Helpful!

Yours,
Osillion

REP++ Please
 
You don't need

Code:
if item.uid == 4500 then

Code:
function onStepIn(cid, item, frompos, item2, topos)

local nPos = {x = 1408,y = 1055,z = 9}
		doTeleportThing(cid, nPos)
	end
	return TRUE
end

Theres a shorter version ;)
 
You don't need

Code:
if item.uid == 4500 then

Code:
function onStepIn(cid, item, frompos, item2, topos)

local nPos = {x = 1408,y = 1055,z = 9}
		doTeleportThing(cid, nPos)
	end
	return TRUE
end

Theres a shorter version ;)

You dont need the uniqueID?? wtf o_O
 
PHP:
function onStepIn(cid, item, frompos, item2, topos)
local nPos = {x = 1408,y = 1055,z = 9}
	doTeleportThing(cid, nPos)
return true
end

You don't need the uid because you set it in movements.xml:
PHP:
<movevent type="StepIn" uniqueid="4500" event="script" value="teleport.lua"/>

But it's needed if you do something like this:
PHP:
function onStepIn(cid, item, frompos, item2, topos)
local firstTeleport = {x = 1408,y = 1055,z = 9}
local secondTeleport = {x = 1233, y=2312, z=7}
    if item.uid == 5000 then
	doTeleportThing(cid, firstTeleport)
    elseif item.uid == 5001 then
        doTeleportThing(cid, secondTeleport)
    end
return true
end

and then...
PHP:
<movevent type="StepIn" uniqueid="5000-5001" event="script" value="teleport.lua"/>
 
Last edited:
What about if you want to make it so X vocations teleports to X place..?
 
You don't need uniqueid/actionid for such script:

Code:
<movevent event="StepIn" pos="1000;1000;13" script="myteleport.lua"/>

The position is x;y;z btw
 
You don't need uniqueid/actionid for such script:

Code:
<movevent event="StepIn" pos="1000;1000;13" script="myteleport.lua"/>

The position is x;y;z btw
oww it\'s diffrent for 0.3
 
Back
Top