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

Teleport!

Thaman

New Member
Joined
Aug 16, 2007
Messages
66
Reaction score
1
Hello i need some help with a teleport sqript Like when you go in a teleport you can be teleported to three diffrent places this is random.
Hopfully some can help me with it :D
 
Here you if wanna rep me :D but it should not work not tested :p

Lua:
local config = {
       d = 1500 -- unique id of item (teleport)
       teleportId = 1387, -- set teleport id self
       {{ { x = 581, y = 577, z = 9 }, { x = 581, y = 575, z = 10 },{ x = 581, y = 575, z = 10 }}}, -- self set positions :P



            }


function onStepIn(cid, item, fromPosition, itemEx, toPosition)
	
	if item.uniqueid == config.d then
		doCreateTeleport(config.teleportId,math.random pos[1], pos[2], pos[3])
	end
	return TRUE
end
 
That wouldn't work.

Fixed, changed, optimized.

This should work.

Lua:
local config = {
	pos = { -- positions, feel free to add a new one, or change either.
	{x=1000, y=1000, z=7},
	{x=1000, y=1000, z=7},
	{x=1000, y=1000, z=7}
	},
	teleportId = 1387 -- ID of portal.
}


function onStepIn(cid, item, fromPosition, itemEx, toPosition) -- Do not edit below from hear.
	doCreateTeleport(config.teleportId, math.random(config.pos[1], config.pos[#config.pos]))
end
 
Sorry to be a noob but where to put this?
Whont it make it to every teleport?
No uncueid?

At movements/scripts

etc; teleport.lua
Code:
local config = {
        pos = { -- positions, feel free to add a new one, or change either.
        {x=1000, y=1000, z=7},
        {x=1000, y=1000, z=7},
        {x=1000, y=1000, z=7}
        },
        teleportId = 1387 -- ID of portal.
}


function onStepIn(cid, item, fromPosition, itemEx, toPosition) -- Do not edit below from hear.
        doCreateTeleport(config.teleportId, math.random(config.pos[1], config.pos[#config.pos]))
end

movements.xml

Code:
	<movevent type="StepIn" actionid="xxxx" event="script" value="teleport.lua"/>

Just edit the actionid /\ and add that actionid to the teleport at ur map.
 
Last edited:
Lua:
local config = {
	pos = { -- positions, feel free to add a new one, or change either.
	{x=1000, y=1000, z=7},
	{x=1000, y=1000, z=7},
	{x=1000, y=1000, z=7}
	},
	teleportId = 1387 -- ID of portal.
}


function onStepIn(cid, item, fromPosition, itemEx, toPosition) -- Do not edit below from hear.
	doTeleportThing(cid, math.random(config.pos[1], config.pos[#config.pos]))
end

Fixed. I hadn't read your post correctly, and now it would do what you want it to do. (Sorry, I had only read the other guy's post)

@UP
Use actionids~
 
Sry but it don´t work nothing happends and i have done everything right. But nothing happends when i step on the teleport. :(
 
Lua:
local config = {
	pos = { -- positions, feel free to add a new one, or change either.
	{x=1000, y=1000, z=7},
	{x=1000, y=1000, z=7},
	{x=1000, y=1000, z=7}
	},
	teleportId = 1387 -- ID of portal.
}


function onStepIn(cid, item, fromPosition, itemEx, toPosition) -- Do not edit below from hear.
	doTeleportThing(cid, math.random(config.pos[1], config.pos[#config.pos]))
end




Fixed. I hadn't read your post correctly, and now it would do what you want it to do. (Sorry, I had only read the other guy's post)

@UP
Use actionids~

This one did i use :D but nothing works.
<movevent type="StepIn" actionid="4050" event="script" value="tele.lua"/>

and that is in movments.
Yes ofc. have i put actionid on the teleport on the map. i have also check if i have the right id on the teleport and i have.

Use 0.3.5
 
[15/12/2009 21:05:44] data/movements/scripts/tele.lua:12: bad argument #1 to 'random' (number expected, got table)
[15/12/2009 21:05:44] stack traceback:
[15/12/2009 21:05:44] [C]: in function 'random'
[15/12/2009 21:05:44] data/movements/scripts/tele.lua:12: in function <data/movements/scripts/tele.lua:11>

I get this error:D
 
Code:
local config = {
	pos = {
		{x=1000, y=1000, z=7},
		{x=1000, y=1000, z=7},
		{x=1000, y=1000, z=7}
	},
	teleportId = 1387
}
function onStepIn(cid, item, position, fromPosition)
	doTeleportThing(cid, config.pos[math.random(#config.pos)])
end
 
Code:
local config = {
	pos = {
		{x=1000, y=1000, z=7},
		{x=1000, y=1000, z=7},
		{x=1000, y=1000, z=7}
	},
	teleportId = 1387
}
function onStepIn(cid, item, position, fromPosition)
	doTeleportThing(cid, config.pos[math.random(#config.pos)])
end
Whoop dee doo!

My bad! :]
 
Back
Top