• 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 How to check is an item is released from a backpack to a tile?

Jetro

jangeldev
Joined
Aug 1, 2011
Messages
452
Reaction score
68
Location
Venezuela
i refer to the CreatureEvent onMoveItem made by Mock, i tried with this code:

LUA:
function onMoveItem(moveItem, frompos, position, cid)
 
	if( moveItem.itemid == 3232) then
		if(frompos.x == 65535 and  frompos.y >= 64 and  frompos.y <= 79 and  position.x ~= 65535) then
			return false
		elseif(frompos.x == 65535 and  frompos.y <= 10 and  position.x ~= 65535) then
			return false
		else
			return true
		end
	end
	
	return true 
end

it doesn't work, what's the correct way?
thanks in advance
 
Last edited:
Code:
function onMoveItem(moveItem, frompos, position, cid)
 
	if( moveItem.itemid == 3232) then
		if(frompos.x == pos.x and  frompos.y >= pos.y and  frompos.y <= pos.y and  position.x ~= pos.x) then
			return false
		elseif(frompos.x == pos.x and  frompos.y <= pos.y and  position.x ~= pos.x) then
			return false
		else
			return true
		end
	end
 
	return true 
end

try that.
 
it didn't worked, thanks anyway xD

i was comparing positions, stackpos and i built this code:
LUA:
function onMoveItem(moveItem, frompos, position, cid)
 	local item = getThingPos(moveItem.uid)
	local item2 = getThingPos(getThingFromPos(position).uid)
	if( moveItem.itemid == 3232) then

		if (frompos.x ~= position.x  or frompos.y ~= position.y  or item.stackpos == -1 and frompos.y > item2.y) then
			return false
		end
	end
	
	return true
end
now the item it can't be dropped but it can't be added to a depot and can be dropped into player.y pos

i need some help :)
 
Last edited:
Back
Top