• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

scrpting: adding more item id's/positions (stone lever script)

Swiff

Member
Joined
Apr 6, 2009
Messages
366
Reaction score
12
Location
Sweden
Hello! I'm in need of some minor assistance, I found Cykotitants wall lever script earlier and I tried to edit it, but without any success.

Take a look:
HTML:
local pos, e = {x=535, y=1266, z=10}, 0
local f = function(p)
	doCreateItem(1304, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, 1304).uid)
		e = addEvent(f, 5 * 60 * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end

Okay, so what I want to do is add another position where a similar action will be taken (removing another piece of wall for the same duration of time) but only with the use of 1 lever.

Can anyone decode this? ;D
 
Hello! I'm in need of some minor assistance, I found Cykotitants wall lever script earlier and I tried to edit it, but without any success.

Take a look:
HTML:
local pos, e = {x=535, y=1266, z=10}, 0
local f = function(p)
	doCreateItem(1304, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, 1304).uid)
		e = addEvent(f, 5 * 60 * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end

Okay, so what I want to do is add another position where a similar action will be taken (removing another piece of wall for the same duration of time) but only with the use of 1 lever.

Can anyone decode this? ;D

Try this:

LUA:
local pos, e = {x=535, y=1266, z=10}, 0
local pos2 = {x=x, y=y, z=z}
local wallid = 1304

local f = function(p)
	doCreateItem(wallid, 1, pos)
	doCreateItem(wallid, 1, pos2)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, wallid).uid)
		doRemoveItem(getTileItemById(pos2, wallid).uid)
		e = addEvent(f, 5 * 60 * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end

It should work just fine, didn't test it, any problem just ask = )

PS: I added a "wallid" config to your script, just so it will be easier if you want for some reason to change the wall id = )

Hope it helps!
 
Thanks, This gives me the idea how to make more than a single wall dissapear/reappear!

I haven't tried it yet, I will post again when I tried it.
 
Back
Top