• 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 script needed

leileililasian

New Member
Joined
Sep 27, 2009
Messages
50
Reaction score
0
I need a teleport script that you can only go into after you have walked onto a certain tile. Once the player at anytime walks on this tile, the player has access to use the magic portal. I use 0.3.6, thank you.
 
umm, what exactly is storage? is there a tutorial you redirect me to?

- - - Updated - - -

how do i set a player storage?

- - - Updated - - -

i am not sure which number i am supposed to use for my storage value, but i want the player to be able to use the teleport at any time after they step on the tile for the first time, no matter how much time has passed.
 
tile they walk on so they can pass
Lua:
function onStepIn(cid, item, pos)
	if getPlayerStorageValue(cid, 50505) == -1 then
		setPlayerStorageValue(cid, 50505, 1)
		doPlayerSendTextMessage(cid, 19, "You can now pass")
	end
end

tile they need to walk on to pass
Lua:
function onStepIn(cid, item, pos)
local pos = {x= ,y= ,z= } -- if they havent stepped on tile
	if getPlayerStorageValue(cid, 50505) ~= 1 then
		doTeleportThing(cid, pos)
		doPlayerSendTextMessage(cid, 19, "You cant pass")
	end
end
 
if i were to delete the doplayersendtxtmsg part will that mess up the script, cause i want them to not know that they have access when they step on the square

and what would the xml codes be for these please? thank you.
 
this the edit which you was want to do:
tile they need to walk on to pass
Lua Code:

Lua:
function onStepIn(cid, item, pos)
local pos = {x= ,y= ,z= } -- if they havent stepped on tile
	if getPlayerStorageValue(cid, 50505) ~= 1 then
		doTeleportThing(cid, pos)
	end
end

and xml part : in your movements/movements.xml put the following lines:
XML:
<movevent type="StepIn" uniqueid="8888" event="script" value="script1.lua" /> <!-- first script -->

and

XML:
<movevent type="StepIn" uniqueid="9999" event="script" value="script2.lua" /> <!-- second script -->
 
Last edited:
[26/06/2013 10:13:23] [Error - LuaScriptInterface::loadFile] data/movements/scripts/tiletest.lua:1: '=' expected near 'they'
[26/06/2013 10:13:23] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/tiletest.lua)
[26/06/2013 10:13:23] data/movements/scripts/tileinqui.lua:1: '=' expected near 'they'

i got this error when trying to test the scripts

and without the tiletest working i can still go into the magic portal and it teleports me where i want to go
 
i posted that member script ;@ , now i made this script for you , replace it with the second script:

Lua:
local storage = 50505
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tpos,v = {x=1,y=1,z=1},getThingPos(cid)
	if getPlayerStorageValue(cid, storage) = 1 then
		doTeleportThing(cid,tpos)
		doSendMagicEffect(v,10)
	else
		doTeleportThing(cid,fromPosition)
                doSendMagicEffect(v,2)
	end
	return true
end
 
tile they walk on so they can pass
Lua:
function onStepIn(cid, item, pos)
	if getPlayerStorageValue(cid, 50505) == -1 then
		setPlayerStorageValue(cid, 50505, 1)
		doPlayerSendTextMessage(cid, 19, "You can now pass")
	end
end

tile they need to walk on to pass
Lua:
function onStepIn(cid, item, pos)
local pos = {x= ,y= ,z= } -- if they havent stepped on tile
	if getPlayerStorageValue(cid, 50505) ~= 1 then
		doTeleportThing(cid, pos)
		doPlayerSendTextMessage(cid, 19, "You cant pass")
	end
end





When i tested your script it would either say you can pass/you cant pass when i bipass the tile and go straight for the portal, or it will just say you can pass, when i go for the portal, neither of the ways ive test it have made it to where i could not go inside the portal before stepping on the tile. I am not sure why its happening.

- - - Updated - - -

i posted that member script ;@ , now i made this script for you , replace it with the second script:

Lua:
local storage = 50505
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tpos,v = {x=1,y=1,z=1},getThingPos(cid)
	if getPlayerStorageValue(cid, storage) = 1 then
		doTeleportThing(cid,tpos)
		doSendMagicEffect(v,10)
	else
		doTeleportThing(cid,fromPosition)
                doSendMagicEffect(v,2)
	end
	return true
end

[26/06/2013 10:53:23] [Error - LuaScriptInterface::loadFile] data/movements/scripts/script2.lua:4: 'then' expected near '='
[26/06/2013 10:53:23] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/script2.lua)
[26/06/2013 10:53:23] data/movements/scripts/script2.lua:4: 'then' expected near '='

im getting this error with your script now



before we keep going can we get a recap on what all i was supposed to do, so i can see if it was my error before i say the script really doesnt work.

What i did was i put uniq.id 8888 on a tile. put uniq. id 9999 on a teleport. and then i just put the place where i wanted them to be tped if they didnt step on the tile in the the script for the x,y,z.
 
Last edited:
try this:
first script:
Lua:
local storage = 50505
function onStepIn(cid, item, pos)
    if getPlayerStorageValue(cid, storage) == -1 then
		setPlayerStorageValue(cid, storage, 1)
	end
end

second script:
Lua:
local storage = 50505
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tpos,v = {x=1,y=1,z=1},getThingPos(cid)
    if getPlayerStorageValue(cid, storage) == 1 then
		doTeleportThing(cid,tpos)
		doSendMagicEffect(v,10)
	else
		doTeleportThing(cid,fromPosition)
                doSendMagicEffect(v,2)
	end
	return true
end
 
Last edited:
testing it now. This script did not work either.


[26/06/2013 14:50:55] [Error - MoveEvents Interface]
[26/06/2013 14:50:55] data/movements/scripts/script2.lua:eek:nStepIn
[26/06/2013 14:50:55] Description:
[26/06/2013 14:50:55] data/movements/scripts/script2.lua:4: attempt to index global 'config' (a nil value)
[26/06/2013 14:50:55] stack traceback:
[26/06/2013 14:50:55] data/movements/scripts/script2.lua:4: in function <data/movements/scripts/script2.lua:2>

Also i got this error
 
Last edited:
Just remove this,
Code:
if getPlayerStorageValue(cid, [COLOR=#ff0000]config.[/COLOR]storage) == 1 then
 
Back
Top