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

Movement + addEvent

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
I made this:
LUA:
 local function removal(p)

doRemoveItem(1304,1,{x=434, y=1326, z=10})

end 

function onStepIn(cid, item, frompos, item2, topos) 
	wall1 = {x=434, y=1326, z=10, stackpos=1}
	getwall1 = getThingfromPos(wall1)

	if item.uid == 10257 and getwall1.itemid == 1304 then
		doCreateItem(1304,1,wall1)
	p = {wall1id = getwall1.itemid}
	addEvent(removal, 10*1000, p)
end
end

The problem is: wall are not being removed S:
 
LUA:
local remove, event = function()
doRemoveItem(getTileItemById({x=434, y=1326, z=10}, 1304).uid)
event = 0
end, 0

function onStepIn(cid, item, position, fromPosition)
	if event == 0 then
		doCreateItem(1304, 1, {x=434, y=1326, z=10})
		event = addEvent(remove, 10000)
	end
end
 
2 Problems found:
1. It will create a wall only the first time.
2. If wall get removed(this os the wall of POI's entrance, it can be removed by a lever) it will show bug in console.
LUA:
local remove, event = function()
doRemoveItem(getTileItemById({x=434, y=1326, z=10}, 1304).uid)
event = 0
end, 0
 
function onStepIn(cid, item, position, fromPosition)
	if event == 0 then
		doCreateItem(1304, 1, {x=434, y=1326, z=10})
		event = addEvent(remove, 15000)

	end
end
 
LUA:
local remove, event = function()
	local a = getTileItemById({x=434, y=1326, z=10}, 1304).uid
	if a ~= 0 then
		doRemoveItem(a)
	end
end, 0
 
function onStepIn(cid, item, position, fromPosition)
	if getTileItemById({x=434, y=1326, z=10}, 1304).uid == 0 then
		stopEvent(event)
		doCreateItem(1304, 1, {x=434, y=1326, z=10})
		event = addEvent(remove, 15000)
	end
end
 
Back
Top