• 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 to empty tile

kamilcioo

Veteran OT User
Joined
Jul 25, 2008
Messages
979
Solutions
1
Reaction score
291
I example: If someone go to teleport it find empty tile from xyz to xyz and teleport there. I want do this because it will be good for fast training monk find. Do this for me :D.
 
I don't know how your teleport room looks..
If it is a big area and only free trainer spots are empty tiles then its easy, if there are more empty tiles then you have to enter the positions seperate..
 
I mean you go to tp and tp you to empty tile in area
Look:
thist.jpg
 
Rep++ then :>

Just set the from and to position in the script.
from is top left corner of the area, to the bottom right corner..
Register to moveevents:
Code:
<movevent type="StepIn" actionid="9797" event="script" value="trainers.lua" />
Now give the item (teleporter) actionid 9797 and don't set a destination..

Save this in data/movements/trainers.lua:
Code:
function isWalkable(pos)  --found: posted by Cyko
	pos.stackpos = 0
	local tile = getThingfromPos(pos, false)
	if tile ~= 0 and not hasProperty(tile.uid, CONST_PROP_BLOCKSOLID) and not isCreature(getTopCreature(pos).uid) then
		return true
	end
end


local area = {
	from = {x=1012,y=1017,z=7},
	to = {x=1027,y=1029,z=7}
}

function onStepIn(cid, item, position, fromPosition)
	for x = area.from.x, area.to.x do
		for y = area.from.y, area.to.y do
			local p = {x=x,y=y,z=area.from.z}
			if isWalkable(p) then
				return doTeleportThing(cid, p) and doSendMagicEffect(getThingPos(cid), 10) and doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You were brought to a free training spot.")
			end
		end
	end
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "There is no free training spot at the moment.")
    return true
end
 
Idea from me btw. Just because someone got the idea in his server isn't owner. My server got that script 2 years ago, just with other script then this one..
 
Back
Top