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

If you step on a tile it teleports you

Samuro

GameDev
Joined
Aug 7, 2007
Messages
1,846
Reaction score
572
Location
Sweden
I need a script (again) for when you step on a tile it will teleport you somewhere else

I'm making a quest room, and if you step on the wrong tile it will teleport you back to the beginning of the room
 
Code:
local attr = "actionid"
local config = {
	[10000] = {x=100, y=100, z=7},
	[10001] = {x=200, y=200, z=7}
}
function onStepIn(cid, item, position, fromPosition)
	local i = config[isInArray({"actionid", "aid"}, attr) == TRUE and item.actionid or isInArray({"uniqueid", "uid"}, attr) == TRUE and item.uid or 0]
	if isPlayer(cid) == TRUE and i then
		doSendMagicEffect(position, CONST_ME_TELEPORT)
		doTeleportThing(cid, i)
		doSendMagicEffect(i, CONST_ME_TELEPORT)
	end
end
Code:
	<movevent event="StepIn" fromaid="10000" toaid="10001" script="scriptname.lua"/>
 
Code:
local attr = "actionid"
local config = {
	[10000] = {x=100, y=100, z=7},
	[10001] = {x=200, y=200, z=7}
}
function onStepIn(cid, item, position, fromPosition)
	local i = config[isInArray({"actionid", "aid"}, attr) == TRUE and item.actionid or isInArray({"uniqueid", "uid"}, attr) == TRUE and item.uid or 0]
	if isPlayer(cid) == TRUE and i then
		doSendMagicEffect(position, CONST_ME_TELEPORT)
		doTeleportThing(cid, i)
		doSendMagicEffect(i, CONST_ME_TELEPORT)
	end
end
Code:
	<movevent event="StepIn" fromaid="10000" toaid="10001" script="scriptname.lua"/>

Doesn't work, nothing happens. I don't see how it could be this but after trying this script, my previous one of;

Code:
function onStepIn(cid, item, frompos, item2, topos) 
local monks = { x = 1240, y = 2045, z = 8 }  

	doTeleportThing(cid, monks)
	doPlayerSendTextMessage(cid,25,"Welcome to the training area.")
end

no longer works
 
local i = config[isInArray({"actionid", "aid"}, attr) == TRUE and item.actionid or isInArray({"uniqueid", "uid"}, attr) == TRUE and item.uid or 0]

good one (:
 
Back
Top