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

problem with a door

Elaney

Member
Joined
Jan 1, 2009
Messages
1,561
Reaction score
12
Location
Sweden
LUA:
function onUse(cid, item, frompos, item2, topos)

local door = getThingFromPos(doorPos)
local doorPos = {x=401, y=766, z=2}
		
		doTransformItem(door.uid, door.itemid + 1)
	return true
end

when using lever the door should open.

errorlog:

Code:
attempt to index a nil value
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local door = getTileItemById({x = 100, y = 100, z = 7}, DOOR) -- remember to change the position and door ID
	if door.uid ~= 0 then
		doTransformItem(door.uid, door.itemid + 1)
	end
	return true
end

getTileItemById, does that find the item in a specific tile regardless of stack position?
Have not used this before.

Yes, it will remove, transform, or create the item regardless. For example, if you're trying to remove an apple from a position, even if you put a crystal coin above the apple, it will still remove the apple.
 
Last edited:
getTileItemById, does that find the item in a specific tile regardless of stack position?
Have not used this before.
 
Back
Top