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

Lua Moveable problem.

Lares

Member
Joined
Feb 8, 2010
Messages
315
Reaction score
7
Hello i have small problem because i dont know how i can do it:

check position xyz and if here is tree wall or something then i cant push player on this sqm when i use function (doMoveCreature(cid, direction))

Lua:
function onSay(cid, words, param, channel)

	local me = getCreaturePosition(cid)
	local x,y,z = me.x,me.y,me.z
	local N = {x=x, y=(y-1), z=z, stackpos = 255}
	
	if isCreature(getThingFromPos(N).uid)  then
		if isWalkable(getThingFromPos(N).uid,N) then
			doMoveCreature(getThingFromPos(N).uid, 0)
		else
		doSendMagicEffect(me, 21)
		end
	end
	
	return true
end


And error

Code:
[10/08/2010 14:55:12] [Error - TalkAction Interface] 
[10/08/2010 14:55:12] data/talkactions/scripts/me.lua:onSay
[10/08/2010 14:55:12] Description: 
[10/08/2010 14:55:12] data/talkactions/scripts/me.lua:16: attempt to call global 'isWalkable' (a nil value)
[10/08/2010 14:55:12] stack traceback:
[10/08/2010 14:55:12] 	data/talkactions/scripts/me.lua:16: in function <data/talkactions/scripts/me.lua:1>


Maybe someone have better idea how i can do it?
 
nothng called isWalkable, try isMovable(uid), and can u explain what do you want , when u use this the player beside you is moved north?
 
Last edited:
When i use command script check position x,y-2,z and when on this sqm isnt tree wall or something (player can stand here) push player from y-1 to y-2.

You understand?


When i use isMovable script push player on wall, tree etc.
 
Last edited:
this wont move them except on movable items :) [the isMovable if you use it rightt], as you checked if it wasnt walkable in the place y-1 not y-2]
and for isWalkable you need to add that in script or in function
Lua:
 function isWalkable(cid, pos)
	pos.stackpos = 253
	if (doTileQueryAdd(cid, pos) == 1 and getTilePzInfo(pos) == FALSE and isCreature(getThingFromPos(pos).uid) == FALSE) then
		return TRUE
	end
	return FALSE
end
 
so it will be like that
Lua:
function onSay(cid, words, param, channel)
 function isWalkable(cid, pos)
	pos.stackpos = 253
	if (doTileQueryAdd(cid, pos) == 1 and getTilePzInfo(pos) == FALSE and isCreature(getThingFromPos(pos).uid) == FALSE)  then
		return TRUE
	end
	return FALSE
end
	local me = getCreaturePosition(cid)
	local x,y,z = me.x,me.y,me.z
	local N = {x=x, y=(y-1), z=z, stackpos = 255}
    local ns = {x=x, y=(y-2), z=z, stackpos = 255}
	if isCreature(getThingFromPos(N).uid) then
		if isWalkable(getThingFromPos(N).uid,ns) then
			doMoveCreature(getThingFromPos(N).uid, 0)
		else
		   doSendMagicEffect(me, 10)
		 end
	else
		doSendMagicEffect(me, 21)
		
	end
 
	return true
end
 
Function in function? Probably this script dont work but I written script and work fine.

Thx for help i need only function.
 
ehmm i have just testes this script :0 , and it worked perfectly , just use it without edits, and ye add the function in lib--> 050function.lua
 
Back
Top