• 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 3 Lever for 1 Bridge Script

Blysco

New Member
Joined
Oct 12, 2013
Messages
163
Reaction score
2
Hey, i want to make a bridge out of 3 tiles that means.
When i pull 1 Lever 2 SQM of 6 get created so when i pulled all 3 levers a bridge with 6Sqm got createt.
That means 1 lever create 2 Sqm
Cann someone give me a link or something for that ?
Would be awesom, ty
 
Im using this but it wont work..
I registered it in actions.xml

But nothing happend

Code:
local posi3 = {x=301, y=287, z=8} --
poss = {
[1] = {x = 32442, y = 32167, z = 10},{x = 32443, y = 32167, z = 10}
[2] = {x = 32442, y = 32166, z = 10},{x = 32443, y = 32166, z = 10}
[3] = {x = 32442, y = 32165, z = 10},{x = 32443, y = 32165, z = 10}
}

local lever = {
[1] = {x = 32440, y = 32160, z = 10},
}
local itemids = 1284
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.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,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.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,1946).uid,1945)
end
return TRUE
end
 
it won't work in the air, I've tried it already
just use doCreateItem to switch between floor and water

and use this to avoid getting players stuck in the middle:
Code:
doRelocate(frompos, topos)
where parameters are {x = xxx, y = yyy, z = zzz}
 
Cann someone give me a working script ???
I dont find any working script...
I get no Errors but it wont work...
 
Here is one working script :)
For them who are seraching a Bridge script.

Code:
local cfg = {
    {x=32441, y=32167, z=10, stackpos=0},
    {x=32441, y=32166, z=10, stackpos=0},
    {x=32441, y=32165, z=10, stackpos=0}
} -- 60137 and 60138 are lever UIDs! :p
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        for i = 60137, 60138 do
            doTransformItem(i, 1946)
        end
        for i = 1, 3 do
            doRelocate(cfg[i], {x = 32441, y = 32168, z = 10})
            doTransformItem(getThingfromPos(cfg[i]).uid, i == 2 and 1284 or 4820)
        end
        doCreateItem(4820, 1, {x = 32441, y = 32165, z = 10})
        doCreateItem(4820, 1, {x = 32441, y = 32166, z = 10})
        doCreateItem(4820, 1, {x = 32441, y = 32167, z = 10})
       
    elseif item.itemid == 1946 then
        for i = 60137, 60138 do
            doTransformItem(i, 1945)
        end
        doCreateItem(1284, 1, {x = 32441, y = 32165, z = 10})
        doCreateItem(1284, 1, {x = 32441, y = 32166, z = 10})
        doCreateItem(1284, 1, {x = 32441, y = 32167, z = 10})
        for i = 1, 3 do
            doTransformItem(getThingfromPos(cfg[i]).uid, 1284)
        end
    end
    return true
end
 
Back
Top