• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

MoveEvent Teleport frompos topos

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,767
Solutions
5
Reaction score
769
Here is a script I made, it teleports u to 2 diff places and u can chose wich vocs can go on it

Lua:
--Made by Amiroslo
local areas = {
    pos1 = {
        fromPos = {x=1, y=1, z=1},
        toPos = {x=1, y=1, z=1}
        },
    pos2 = {
        fromPos = {x=2, y=2, z=2},
        toPos = {x=2, y=2, z=2}
        }
    }
	
local voc = {1,2,3,4,5,6,7,8}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   if isInArray(voc, getPlayerVocation(cid)) then
    doTeleportThing(cid, {x=math.random(areas.pos1.fromPos, areas.pos1.toPos), y=math.random(areas.pos1.fromPos, areas.pos1.toPos), z=math.random(areas.pos1.fromPos, areas.pos1.toPos)})
    doPlayerSendTextMessage(cid, 21, "You have been teleported to room1")
   elseif isInArray(voc, getPlayerVocation(cid)) then
    doTeleportThing(cid, {x=math.random(areas.pos2.fromPos, areas.pos2.toPos), y=math.random(areas.pos2.fromPos, areas.pos2.toPos), z=math.random(areas.pos2.fromPos, areas.pos2.toPos)})
	doPlayerSendTextMessage(cid, 21, "You have been teleported to room2")
   else
    doPlayerSendCancel(cid, "Sorry you cant enter here!.")
   end
   return true
end

in movements.xml
XML:
	<movevent type="stepIn" actionid="CHOSE AN ID" event="script" value="script.lua"/>

Not tested, Report bugs!
 
Last edited:
Amiroslo, I dont understand what frompos is and what topos is, please explain, I will probably use this if I knew what that meant :D
 
Frompos would be the position of the teleport or the tile
topos is where u want him to be teleported after walking on the teleport or the tile
pos1- room 1
pos2- room2
u can make so same teleport take u to diff places randomly i think
its not tested tho
 
[23:29:53.723] [Error - MoveEvents Interface]
[23:29:53.723] data/movements/scripts/hellgate1.lua:eek:nStepIn
[23:29:53.723] Description:
[23:29:53.723] data/movements/scripts/hellgate1.lua:17: bad argument #1 to 'rand
om' (number expected, got table)
[23:29:53.724] stack traceback:
[23:29:53.724] [C]: in function 'random'
[23:29:53.724] data/movements/scripts/hellgate1.lua:17: in function <data/movem
ents/scripts/hellgate1.lua:15>


I got this error when trying it.. Im trying to make it an enterance to hellgate. a tile you step on and takes you over
 
Back
Top