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

Dominik ms

Member
Joined
Jan 20, 2010
Messages
424
Reaction score
6
PHP:
pos = getCreaturePosition(pid)
	for i = 0, 7 do
		ground = {x=pos.x, y=pos.y, z=0+i}
		if isWalkable(ground) == true then
			doTeleportThing(pid, ground, true)
			doRemoveConditions(pid, false)
			return true
		end
	end
works perfect, but if tile not found i have error
I am on pos z = 0, use script, now if tile under my self is walkable the i am teleporting down, up to ground tile (7).
 
PHP:
function isWalkable(pos) -- by nord
   -- by nord
	local wall0 = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=0})
	local wall1 = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=1})
	local wall2 = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=2})
	local creature = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=255})
	if isCreature(creature.uid) == FALSE then
	if wall0.uid ~= 0 and hasProperty(wall0.uid, 3) == FALSE and hasProperty(wall0.uid, 7) == FALSE then
		if wall1.uid == 0 or (hasProperty(wall1.uid, 3) == FALSE and hasProperty(wall1.uid, 7) == FALSE) then
			if wall2.uid == 0 or (hasProperty(wall2.uid, 3) == FALSE and hasProperty(wall2.uid, 7) == FALSE) then
					return TRUE
				end
			end
		end
	end
	return FALSE
end
 
Code:
function isWalkable(pos)
	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
 
ehh not work, i remove error form source and is great :D


I am use fly system, 460 items on pos z 0.
When i use fly, then i am teleporting to pos 0, if i use again then i am teleporting to first walkable floor
if floor 1 is not walkable then script chceck next 2 floor, up to 7 (8 is undergorund)
But when floor dont exist (on pos z 1-6) then i have error
 
Last edited:
Back
Top