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

4 levers and 1 wall

kokosal

New Member
Joined
Feb 21, 2010
Messages
115
Reaction score
0
Hi, can anybody make this script? :)
When the 4 levers is in the right position (1945,1946,1946,1945) the wall will be removed, and after 1min the wall will came back and the 4 levers will go back the the start position (1945).
 
¡¡¡Hello!!!

I don't test it, but try it. let me know how it works. ;)

Lua:
local wall2 = 2829 -- Action.id of "2"'s in the sistem
local wall1 = 2828 -- Action.id of "1"'s in the sistem
wall = {x=588, y=316, z=7, stackpos=1} -- Position where the wall is
getwall1 = getThingfromPos(wall)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.actionid == wall1 then
		if item.itemid == 1945 and Vino1 == 0 then
			Vino1 = +1
			doTransformItem(item.uid,item.itemid,+1)	
		elseif item.itemid == 1946 and Vino1 >= 1 then
			Vino1 = -1
			doTransformItem(item.uid,item.itemid,-1)
		elseif item.itemid == 1946 and Vino3 >= 1 then
			doTransformItem(item.uid,item.itemid,-1)
		end
	end
	if item.actionid == wall2 then
		if item.itemid == 1945 and Vino2 >= 1 then
			Vino2 = -1
			doTransformItem(item.uid,item.itemid,+1)
		elseif item.itemid == 1946 and Vino2 >= 0 then
			Vino2 = +1
			doTransformItem(item.uid,item.itemid,-1)	
		elseif item.itemid == 1945 and Vino3 > 0 then
			doTransformItem(item.uid,item.itemid,-1)
		end
	end
	if Vino1 == 2 and Vino2 == 2 then
		addEvent(doRemoveItem, 1 * 60000, getwall1, wall)
		addEvent(doTransformItem, 1 * 60000, item.uid, item.itemid, +1)
		addEvent(Vino3, 1 * 60000, +1)
	end
return 1
end

¡¡¡Bless you and Cheers up!!!
(Y)(Y)


-Obsdark-
 
¡¡¡Hello!!!

I don't test it, but try it. let me know how it works. ;)

Lua:
local wall2 = 2829 -- Action.id of "2"'s in the sistem
local wall1 = 2828 -- Action.id of "1"'s in the sistem
wall = {x=588, y=316, z=7, stackpos=1} -- Position where the wall is
getwall1 = getThingfromPos(wall)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.actionid == wall1 then
		if item.itemid == 1945 and Vino1 == 0 then
			Vino1 = +1
			doTransformItem(item.uid,item.itemid,+1)	
		elseif item.itemid == 1946 and Vino1 >= 1 then
			Vino1 = -1
			doTransformItem(item.uid,item.itemid,-1)
		elseif item.itemid == 1946 and Vino3 >= 1 then
			doTransformItem(item.uid,item.itemid,-1)
		end
	end
	if item.actionid == wall2 then
		if item.itemid == 1945 and Vino2 >= 1 then
			Vino2 = -1
			doTransformItem(item.uid,item.itemid,+1)
		elseif item.itemid == 1946 and Vino2 >= 0 then
			Vino2 = +1
			doTransformItem(item.uid,item.itemid,-1)	
		elseif item.itemid == 1945 and Vino3 > 0 then
			doTransformItem(item.uid,item.itemid,-1)
		end
	end
	if Vino1 == 2 and Vino2 == 2 then
		addEvent(doRemoveItem, 1 * 60000, getwall1, wall)
		addEvent(doTransformItem, 1 * 60000, item.uid, item.itemid, +1)
		addEvent(Vino3, 1 * 60000, +1)
	end
return 1
end

¡¡¡Bless you and Cheers up!!!
(Y)(Y)


-Obsdark-

Hi Obsdark, I don't think you understood what I meant :p

Normaly the 4 levers are 1945, 1945, 1945, 1945
If the player move some of the levers so they look like this 1945, 1946, 1946, 1945
The wall (id=1546) will be removed from x=857, y=1292, z=7
After 60 sec the wall (id=1546) will came back to x=857, y=1292, z=7 and the 4 levers will get back to the start position that is 1945, 1945, 1945, 1945

Can you plz try to make it for me ^_^
I'm a little bit noob, so can you also say what I need to write in the actions.xml? :$
 
Put this code in the action.XML

Lua:
<action actionid="2828;2829" event="script" value="leverWallOpenSystem.lua"/>

the "1" are the ones you don't need to remove the wall
the "2" are the other you need to activate to remove the wall

Just use it, and then tell me if is what you need or not. ;)
¡Bless you and Cheers up!
(Y)(Y)


-Obsdark-
 
Lua:
local wall2 = 2829 -- Action.id of "2"'s in the sistem
local wall1 = 2828 -- Action.id of "1"'s in the sistem
local WallClock = 9898 -- Storage Value Global who make it works
wall = {xx=857, y=1292, z=7, stackpos=1} -- Position where the wall is
Cerradura = getGlobalStorageValue(WallClock)
getwall1 = getThingfromPos(wall)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 and item.actionid == wall1 then
		setGlobalStorageValue(WallClock, +1)
		doTransformItem(item.uid,item.itemid,+1)	
	elseif item.itemid == 1946 and item.actionid == wall1 then
		setGlobalStorageValue(WallClock, -1)
		doTransformItem(item.uid,item.itemid,-1)
	end
	if item.itemid == 1945 and item.actionid == wall2 then
		setGlobalStorageValue(WallClock, -1)
		doTransformItem(item.uid,item.itemid,+1)
	elseif item.itemid == 1946 and item.actionid == wall2 then
		setGlobalStorageValue(WallClock, +1)
		doTransformItem(item.uid,item.itemid,-1)	
	end
	if Cerradura == 4 then
		addEvent(doRemoveItem, 1 * 60000, getwall1, wall)
		addEvent(doTransformItem, 1 * 60000, wall1, 1945, false)
		addEvent(doTransformItem, 1 * 60000, wall2, 1946, false)
	end
return 1
end

Try with this one.
This one avoid help to make the wall go down. ;)

Tell me if it works!

¡¡¡Bless you and Cheers up!!!
(Y)(Y)


-Obsdark-
 
Last edited:
Lua:
local switches = {
   [4000] = 1945,  ----- [Unique ID] = Item ID
   [4001] = 1946,
   [4002] = 1945,
   [4003] = 1946,
	}
local wall, id = {x=xxx, y=xxx, z=x, stackpos=1}, WALL_ID  -- wallpos , wallID
local reset = 60 -- seconds
	

local function reset1()
    doCreateItem(id, wall)
    for k, v in pairs(Q_Switches) do
		if getThingPos(k).itemid == 1946 then
			doTransformItem(k, 1945)
		end
	end
end

function onUse(cid, item, frompos, itemEx, topos)
   for i, v in pairs(switches) do
      if not (getTileThingByPos((getThingPos(i))).itemid == v) then
		if item.itemid == 1945 then
			doTransformItem(item.uid, 1946)
		else
			doTransformItem(item.uid, 1945)
		end
         return true
      end
   end
   if item.itemid == 1945 then
			doTransformItem(item.uid, 1946)
		else
			doTransformItem(item.uid, 1945)
		end
   doPlayerSendTextMessage(cid, 22, "A wall was removed for "..reset.." seconds! Hurry!")
   doRemoveItem(getThingFromPos(wall).uid, 1)
   addEvent(reset1, reset*1000)
   return true
end
This should do.
 
Same error, but do i need to do samething with the local "WallClock = 9898 -- Storage Value Global who make it works"?
 
I just feel it wont work:
Lua:
local c = {
	d = {
		[1] = {1945, {x=x, y=y, z=Z}}, --[Lever pos] = what id the lever must be to remove the wall
		[2] = {1946, {x=x, y=y, z=Z}}, --[Lever pos] = what id the lever must be to remove the wall
		[3] = {1946, {x=x, y=y, z=Z}}, --[Lever pos] = what id the lever must be to remove the wall
		[4] = {1945, {x=x, y=y, z=Z}} --[Lever pos] = what id the lever must be to remove the wall
		},
	e = {x=x, y=y, z=z}, --wall pos
	f = 60, -- time to add the wall back
	g = 1230 -- wall id
	} 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local k, v, i = addEvent(doTransformItem(getTileItemById(c.d[x][2], c.d[x][1]).uid, 1945), addEvent(doCreateItem, c.f*1000, c.g, c.e)), 0
doTransformItem(item.uid, item.id == 1945 and 1946 or 1945)
	if getTileItemById(c.e, c.g) then
		for x = 1, #c.g do
			if getTileItemById(c.d[x][2], c.d[x][1]) then
				i = i+1
			end
		end
		if i == #c.g then
			doRemoveItem(getThingFromPos(c.e).uid)
			addEvent(k, 1)
			addEvent(v, 1)
		end
	else
		stopEvent(k)
		stopEvent(v)
		doCreateItem(c.g, c.e)
	end
i = 0
return TRUE
end
 
Last edited:
J.dre, i remember when you help me with the one i need it, it was similar to this one. ;)

I'm trying to make it based on that one, i re-make it almost entirely, with the "ye old apple system" xD

But inspired on that, i can make this script, i hope it works. ;)

Lua:
levers = {
	{x=x, y=y, z=Z}, -- positions of levers
	{x=x, y=y, z=Z},
	{x=x, y=y, z=Z},
	{x=x, y=y, z=Z}
}
Wallid =  -- you put the item.id of the wall here, it must be the number who apparead on remere's. ;)
Wall = {x=x, y=y, z=Z} -- Coords of the wall.
local lever1, lever2, lever3, lever4 = getTileItemById(levers[1], 1945).uid, getTileItemById(levers[2], 1946).uid, getTileItemById(levers[3], 1946).uid, getTileItemById(levers[4], 1945).uid
function onStepIn(cid, item, frompos, itemEx, topos)
	if lever1 then
		if lever2 then
			if lever3 then
				if lever4 then
					doRemoveItem(wallid.uid, 1)
					addEvent(doCreateitem, 60 * 1000, Wallid, Wall)
					addEvent(doTransformItem, 60 * 1000, lever1, 1945)
					addEvent(doTransformItem, 60 * 1000, lever2, 1945)
					addEvent(doTransformItem, 60 * 1000, lever3, 1945)
					addEvent(doTransformItem, 60 * 1000, lever4, 1945)
				end
			end
		end
	end
return 1
end

Remember put the item.id of the wall you wanna eliminate on the script, otherwise it doesn't work. ;)

Now, for use it, you need to write something like this:

Lua:
<action actionid="9898" event="script" value="Levers4Wall1.lua"/>

Beeing "9898" wherever you want BUT WHO AR NOT IN USE IN SOMETHING. ;)

Otherwise you can have troubles. ;)

Another Thing...


Somebody knows a link where i can see a list of Constants?, i really need one, i used to know one posted here, somewhere, but now i can't find it anymore. :S

Tell me how works! ;)

¡Bless you and Cheers up!
(Y)(Y)


-Obsdark-
 
Last edited:
Are you sure you copy right?

Reeplace this part of the script with the part i paste down here.

I already fix the original, just for if you want copy again entirely. ;)

Lua:
levers = {
	{x=x, y=y, z=Z}, -- positions of levers
	{x=x, y=y, z=Z},
	{x=x, y=y, z=Z},
	{x=x, y=y, z=Z}
}

Remember than you must change that coords by the coords of each one of the levers. ;)

¡Have a good day!
(Y)(Y)

Let me know if works or not. ;)

¡Cheers up and Bless you!
(Y)(Y)


-Obsdark-
 
Are you sure you copy right?

Reeplace this part of the script with the part i paste down here.

I already fix the original, just for if you want copy again entirely. ;)

Lua:
levers = {
    {x=x, y=y, z=Z}, -- positions of levers
    {x=x, y=y, z=Z},
    {x=x, y=y, z=Z},
    {x=x, y=y, z=Z}
}

Remember than you must change that coords by the coords of each one of the levers. ;)

¡Have a good day!
(Y)(Y)

Let me know if works or not. ;)

¡Cheers up and Bless you!
(Y)(Y)


-Obsdark-

Dude the runner program will dont run when i use that script, but if i add it when i'm in the game and write "/reload actions" it works, but the wall didn't came back :/

Why don't you use my script?

Will try it now, can i add <action uniqueid="4000;4003" event="script" value="4levers1wall.lua"/>?
 
Last edited by a moderator:
Lua:
levers = {
	{x=x, y=y, z=Z}, -- positions of levers
	{x=x, y=y, z=Z},
	{x=x, y=y, z=Z},
	{x=x, y=y, z=Z}
}
itre = 2674 -- yes, is an apple, but it's make the sistem works trust me, reeplace it for any other item that you want.
Wallid =    -- you put the item.id of the wall here
Wall = {x=x, y=y, z=Z} -- Coords of the wall.
local lever1, lever2, lever3, lever4 = getTileItemById(levers[1], 1945).uid, getTileItemById(levers[2], 1946).uid, getTileItemById(levers[3], 1946).uid, getTileItemById(levers[4], 1945).uid
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if lever1 then
		if lever2 then
			if lever3 then
				if lever4 then
					doRemoveItem(wallid.uid, 1)
					addEvent(doCreateitem, 60 * 1000, Wallid, Wall)
					addEvent(doTransformItem, 4 * 1000, lever1, 1945)
					addEvent(doTransformItem, 4 * 1000, lever2, 1945)
					addEvent(doTransformItem, 4 * 1000, lever3, 1945)
					addEvent(doTransformItem, 4 * 1000, lever4, 1945)
				end
			end
		end
	end
return 1
end

It must return after a minute, but let's try this one with 4 seconds. ;)

¡Tell me how it works!

¡Bless you and Cheers up!
(Y)(Y)

-Obsdark-
 
Back
Top