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

Solved Bridge lever! ++rep for help!:)

Bacheer

New Member
Joined
Jun 18, 2009
Messages
246
Reaction score
0
Location
Sweden
Hello, my problem is.. i dont know how to fix this script! please help me.. its like the rat bridge in rook script but with 2 bridges!

note:i didnt understand this thread http://otland.net/f81/rookgard-rats-lever-50534/ thats why i am made this thread!

2d0ch1i.jpg


This is my map positions!

upper bridge:
Poss[1]= [X: 570] [Y: 525] [Z: 10]
Poss[2]= [X: 571] [Y: 525] [Z: 10]
Poss[3]= [X: 572] [Y: 525] [Z: 10]


Down bridge:
Poss[1]= [X: 570] [Y: 526] [Z: 10]
Poss[2]= [X: 571] [Y: 526] [Z: 10]
Poss[3]= [X: 572] [Y: 526] [Z: 10]


Lever1:
Lever[1]= [X: 573] [Y: 524] [Z: 10]
What ActionID should i put?

lever2:
Lever[2]= [X: 574] [Y: 546] [Z: 10]
What ActionID should i put?

This is my .lua script!
Lua:
  -- rook lever by QuaS~
local posi3 = {x=301, y=287, z=8} --
poss = {
[1] = {x=159, y=108, z=7},
[2] = {x=160, y=108, z=7},
[3] = {x=161, y=108, z=7}
}

local lever = {
[1] = {x=158, y=107, z=7},
[2] = {x=164, y=107, z=7}
}
local itemids = 5770
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if item.itemid == 1945 then
                doCreateItem(itemids,poss[2])
                if getTileItemById(poss[1],4645).itemid ~= nil then
                        doTransformItem(getTileItemById(poss[1],4645).uid,itemids)
                end
                if getTileItemById(poss[3],4647).itemid > 0 then
                        doTransformItem(getTileItemById(poss[3],4647).uid,itemids)
                end
                for i=1,#lever do
                        if lever[i].x == fromPosition.x then
                                o = i
                        end
                end
                if o == 1 then
                        b = 2
                else
                        b = 1
                end
                doTransformItem(item.uid,item.itemid+1)
                doTransformItem(getTileItemById(lever[b],1945).uid,1946)
        elseif item.itemid == 1946 then
                for p = 1,#poss do
                doRelocate(poss[p], posi3)
                end
                for z =1,#poss do
                                poss[z].stackpos = 254
                                if getThingFromPos(poss[z]).itemid > 1000 then
                                        doRemoveItem(getThingFromPos(poss[z]).uid)
                                end
                                poss[z].stackpos = 1
                                if getThingFromPos(poss[z]).itemid > 1000 then
                                        doRemoveItem(getThingFromPos(poss[z]).uid)
                                end

                end
                for i=1,#lever do
                        if lever[i].x == toPosition.x then
                                o = i
                        end
                end
                if o == 1 then
                        b = 2
                else
                        b = 1
                end
                doCreateItem(4616,poss[2])
                doCreateItem(351,poss[1])
                doCreateItem(351,poss[3])
                doCreateItem(4645,poss[1])
                doCreateItem(4647,poss[3])
                doTransformItem(item.uid,item.itemid-1)
                doTransformItem(getTileItemById(lever[b],1946).uid,1945)
        end
        return TRUE
end

Please fix my script!!
 
Last edited:
you have an outer lever when you use the floors are created when you use the one inside the flors disappear ? or what
 
you have an outer lever when you use the floors are created when you use the one inside the flors disappear ? or what

I want both lever to do same thing.. i got one outsider and one insider. It will happens same thing if you pull any of them. just like levers in rook down at rats!
 
Lua:
local poss = {
[1] = {x=571, y=525, z=10},
[2] = {x=571, y=526, z=10},
[3] = {x=570, y=525, z=10},
[4] = {x=570, y= 526, z=10}
}

local lever = {
[1] = {x=573, y=524, z=10, stackpos = 1},
[2] = {x=574, y=546, z=10,stackpos = 1 }
}
function onUse(cid, item, frompos, item2, topos)
        if item.itemid == 1945 then
                    for i = 3, 4 do
                            if getTileItemById(poss[i],4799).itemid > 0 then
                               doRemoveItem(getThingFromPos(poss[i]).uid)
                            end
                    end
                    for i = 1, #poss do
                             if getTileItemById(poss[i],4616).itemid ~= nil then
	                            doTransformItem(getThingFromPos(poss[i]).uid,5770)
                             end
                    end
                    for i = 1, #lever do
                             if getThingFromPos(lever[i]).itemid == 1945 then
                                doTransformItem(getThingFromPos(lever[i]).uid,1946)
                             end
                    end
        elseif item.itemid == 1946 then
                    for i = 1, 2 do
                             if getTileItemById(poss[i],5770).itemid ~= nil then
	                            doTransformItem(getThingFromPos(poss[i]).uid,4616)
                             end
                    end
                    for i = 3, 4 do
                             if getTileItemById(poss[i],5770).itemid ~= nil then
	                            doTransformItem(getThingFromPos(poss[i]).uid,4616)
		                        doCreateItem(4799,poss[i])
                             end
                    end
                    for i = 1, #lever do
                             if getThingFromPos(lever[i]).itemid == 1946 then
                                doTransformItem(getThingFromPos(lever[i]).uid,1945)
                             end
                    end
        end
	return true
end

Code:
<action actionid="xxxx" event="script" value="xxxx.lua"/>
make 2 levers with id 1945 and put the aid you will make on both
 
Last edited:
Lua:
local poss = {
[1] = {x=571, y=525, z=10},
[2] = {x=571, y=526, z=10},
[3] = {x=570, y=525, z=10},
[4] = {x=570, y= 526, z=10}
}

local lever = {
[1] = {x=573, y=524, z=10, stackpos = 1},
[2] = {x=574, y=546, z=10,stackpos = 1 }
}
function onUse(cid, item, frompos, item2, topos)
        if item.itemid == 1945 then
                    for i = 3, 4 do
                            if getTileItemById(poss[i],4799).itemid > 0 then
                               doRemoveItem(getThingFromPos(poss[i]).uid)
                            end
                    end
                    for i = 1, #poss do
                             if getTileItemById(poss[i],4616).itemid ~= nil then
	                            doTransformItem(getThingFromPos(poss[i]).uid,5770)
                             end
                    end
                    for i = 1, #lever do
                             if getThingFromPos(lever[i]).itemid == 1945 then
                                doTransformItem(getThingFromPos(lever[i]).uid,1946)
                             end
                    end
        elseif item.itemid == 1946 then
                    for i = 1, 2 do
                             if getTileItemById(poss[i],5770).itemid ~= nil then
	                            doTransformItem(getThingFromPos(poss[i]).uid,4616)
                             end
                    end
                    for i = 3, 4 do
                             if getTileItemById(poss[i],5770).itemid ~= nil then
	                            doTransformItem(getThingFromPos(poss[i]).uid,4616)
		                        doCreateItem(4799,poss[i])
                             end
                    end
                    for i = 1, #lever do
                             if getThingFromPos(lever[i]).itemid == 1946 then
                                doTransformItem(getThingFromPos(lever[i]).uid,1945)
                             end
                    end
        end
	return true
end

Code:
<action actionid="xxxx" event="script" value="xxxx.lua"/>
make 2 levers with id 1945 and put the aid you will make on both
No, put other action id but same script :D
 
Back
Top