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

Action Making a 12sq bridge disappear and re-appear by the pull of a lever.(TFS0.3.6,T8.6)

Sinth

Argardh.com
Joined
Jan 14, 2015
Messages
721
Reaction score
133
Location
Cambodia
Searched a lot for this but didn't find something like this, so thought i'd share it now that I finally got it to work exactly as intended :) Big thanks to master @Xikini for helping and guiding me all the way.

So, basically it's a bridge with 12 squares and a lever on one side. Pull it once, the 12 squares disappears (turns into "Invisibile Blocking Item"/1548) and everything on the bridge gets teleported/Relocated to the south side of the bridge. The bridge is elevated 1 floor above ground and is made of the same tile we transform the "invisible blocking item" into when pulling the lever the second time(1284).

Update: To make it even more noobfriendly, it also needs to be understood that the lever you want to use for the bridge is given ActionId xxxx. And then make a new action in Actions/Actions.xml with the same "action-id" and linked to the location of the script you chose to use.. normally it'd probaby be Actions/Scripts/other/Bridge.lua


Feedback on script, presentation, etc, welcomed!

Bridge.lua
Code:
function onUse(cid, item, topos, frompos)

    local cfg = {
        bridgePos = {x=1114, y=700, z=3, stackpos=0},
        bridge2Pos = {x=1115, y=700, z=3, stackpos=0},
        bridge3Pos = {x=1116, y=700, z=3, stackpos=0},
        bridge4Pos = {x=1114, y=701, z=3, stackpos=0},
        bridge5Pos = {x=1115, y=701, z=3, stackpos=0},
        bridge6Pos = {x=1116, y=701, z=3, stackpos=0},
        bridge7Pos = {x=1114, y=702, z=3, stackpos=0},
        bridge8Pos = {x=1115, y=702, z=3, stackpos=0},
        bridge9Pos = {x=1116, y=702, z=3, stackpos=0},
        bridge10Pos = {x=1114, y=703, z=3, stackpos=0},
        bridge11Pos = {x=1115, y=703, z=3, stackpos=0},
        bridge12Pos = {x=1116, y=703, z=3, stackpos=0},      
        bridgePush = {x=1115, y=704, z=3},
        -- Relocate creature/item to this Pos if it blocks BridgePos
    }

    if item.itemid == 9825 then
        doTransformItem(getThingfromPos(cfg.bridgePos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge2Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge3Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge4Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge5Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge6Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge7Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge8Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge9Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge10Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge11Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge12Pos).uid, 1548)
        doRelocate(cfg.bridgePos, cfg.bridgePush)
        doRelocate(cfg.bridge2Pos, cfg.bridgePush)
        doRelocate(cfg.bridge3Pos, cfg.bridgePush)
        doRelocate(cfg.bridge4Pos, cfg.bridgePush)
        doRelocate(cfg.bridge5Pos, cfg.bridgePush)
        doRelocate(cfg.bridge6Pos, cfg.bridgePush)
        doRelocate(cfg.bridge7Pos, cfg.bridgePush)      
        doRelocate(cfg.bridge8Pos, cfg.bridgePush)
        doRelocate(cfg.bridge9Pos, cfg.bridgePush)
        doRelocate(cfg.bridge10Pos, cfg.bridgePush)
        doRelocate(cfg.bridge11Pos, cfg.bridgePush)
        doRelocate(cfg.bridge12Pos, cfg.bridgePush)
        doTransformItem(item.uid, 9826)
      
    elseif item.itemid == 9826 then
        doTransformItem(getThingfromPos(cfg.bridgePos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge2Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge3Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge4Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge5Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge6Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge7Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge8Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge9Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge10Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge11Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge12Pos).uid, 1284)
        doTransformItem(item.uid, 9825)
    end
    return true
end


@Xikini made another script that worked just as well. If the first script doesn't work this might(If 1st is not working on another version of TFS or whatever problem you might have with it).

Code:
local cfg = {
        bridgePos   = {x = 1114, y = 700, z = 3, stackpos = 0},
        bridge2Pos  = {x = 1115, y = 700, z = 3, stackpos = 0},
        bridge3Pos  = {x = 1116, y = 700, z = 3, stackpos = 0},
        bridge4Pos  = {x = 1114, y = 701, z = 3, stackpos = 0},
        bridge5Pos  = {x = 1115, y = 701, z = 3, stackpos = 0},
        bridge6Pos  = {x = 1116, y = 701, z = 3, stackpos = 0},
        bridge7Pos  = {x = 1114, y = 702, z = 3, stackpos = 0},
        bridge8Pos  = {x = 1115, y = 702, z = 3, stackpos = 0},
        bridge9Pos  = {x = 1116, y = 702, z = 3, stackpos = 0},
        bridge10Pos = {x = 1114, y = 703, z = 3, stackpos = 0},
        bridge11Pos = {x = 1115, y = 703, z = 3, stackpos = 0},
        bridge12Pos = {x = 1116, y = 703, z = 3, stackpos = 0},   
        bridgePush  = {x = 1115, y = 704, z = 3} -- Relocate creature/item to this Pos if it blocks BridgePos
    }

function onUse(cid, item, topos, frompos)

    if item.itemid == 9825 then

    -- relocate item/players
        doRelocate(cfg.bridgePos, cfg.bridgePush)
        doRelocate(cfg.bridge2Pos, cfg.bridgePush)
        doRelocate(cfg.bridge3Pos, cfg.bridgePush)
        doRelocate(cfg.bridge4Pos, cfg.bridgePush)
        doRelocate(cfg.bridge5Pos, cfg.bridgePush)
        doRelocate(cfg.bridge6Pos, cfg.bridgePush)
        doRelocate(cfg.bridge7Pos, cfg.bridgePush)
        doRelocate(cfg.bridge8Pos, cfg.bridgePush)
        doRelocate(cfg.bridge9Pos, cfg.bridgePush)
        doRelocate(cfg.bridge10Pos, cfg.bridgePush)
        doRelocate(cfg.bridge11Pos, cfg.bridgePush)
        doRelocate(cfg.bridge12Pos, cfg.bridgePush)

        -- transform tiles to nothing
        doTransformItem(getThingfromPos(cfg.bridgePos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge2Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge3Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge4Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge5Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge6Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge7Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge8Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge9Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge10Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge11Pos).uid, 1548)
        doTransformItem(getThingfromPos(cfg.bridge12Pos).uid, 1548)

        -- transform lever
        doTransformItem(item.uid, 9826)
    
    elseif item.itemid == 9826 then
    
        -- transform tiles to bridge
        doTransformItem(getThingfromPos(cfg.bridgePos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge2Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge3Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge4Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge5Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge6Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge7Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge8Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge9Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge10Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge11Pos).uid, 1284)
        doTransformItem(getThingfromPos(cfg.bridge12Pos).uid, 1284)

        -- transform lever
        doTransformItem(item.uid, 9825)

    end

    return true
end
 
Last edited:
:rolleyes:
Code:
local tiles = {
     [1]  = {x = 1114, y = 700, z = 3, stackpos = 0},
     [2]  = {x = 1115, y = 700, z = 3, stackpos = 0},
     [3]  = {x = 1116, y = 700, z = 3, stackpos = 0},
     [4]  = {x = 1114, y = 701, z = 3, stackpos = 0},
     [5]  = {x = 1115, y = 701, z = 3, stackpos = 0},
     [6]  = {x = 1116, y = 701, z = 3, stackpos = 0},
     [7]  = {x = 1114, y = 702, z = 3, stackpos = 0},
     [8]  = {x = 1115, y = 702, z = 3, stackpos = 0},
     [9]  = {x = 1116, y = 702, z = 3, stackpos = 0},
     [10] = {x = 1114, y = 703, z = 3, stackpos = 0},
     [11] = {x = 1115, y = 703, z = 3, stackpos = 0},
     [12] = {x = 1116, y = 703, z = 3, stackpos = 0} 
}

local relocate_pos = {x = 1115, y = 704, z = 3}


function onUse(cid, item, fromPosition, itemEx, toPosition)

     if item.itemid == 9825 then
         for i = 1, #tiles do
             doRelocate(walls[i], relocate_pos)
             doTransformItem(getThingfromPos(tiles[i]).uid, 1548)
         end
         doTransformItem(item.uid, 9826)
     
     elseif item.itemid == 9826 then
         for i = 1, #tiles do
             doTransformItem(getThingfromPos(tiles[i]).uid, 1284)
         end
         doTransformItem(item.uid, 9825)
     
     end
   
     return true
end
 
Searched a lot for this but didn't find something like this,
Really?
bridge.gif


https://otland.net/threads/zelda-like-bridge-fiery-death.238195/
 
Yeap, really :)

IF i'd find that one despite the bad title i'd still be clueless as to what to change/how to copy. And it's rather different aswell, far from what I was looking for. The script on top is, if you ask me(a non-scripter), the easiest to understand and use for a non-scripter(like me, and 75%+ of the people here searching for scripts).

Edit: + none of your pics work. And I can say this again: your script is VERY different.
 
Yeap, really :)

IF i'd find that one despite the bad title i'd still be clueless as to what to change/how to copy. And it's rather different aswell, far from what I was looking for. The script on top is, if you ask me(a non-scripter), the easiest to understand and use for a non-scripter(like me, and 75%+ of the people here searching for scripts).

Edit: + none of your pics work. And I can say this again: your script is VERY different.
It isn't different, mine works with stepping on a tile.. yours works with pulling a switch, however mine is automated and works with a starting position where as yours works (although i have not tested it) with set positions.

We all know you are not a programmer/scripter etc... it shows in your code.
Here is a link to the image, if you still cannot see it then the site might be banned or not available in your country/region.
http://s13.postimg.org/hhbnxhjp1/bridge.gif

I've written 100's of these scripts for people, your idea/code is nothing new or groundbreaking.
 
Wow, cool bridge I must say :) Ah yeah, could be that.. living in Cambodia.

Oh really? My idea/script is not groundbreaking? haha.. tell me something new :p It is however groundbreaking in that whoever searches for "Lever bridge" will now have the easiest and most used/wanted bridge.. and not just 1, but 3 versions of it :)

There's a difference between a non-scripter and a scripter in that a non-scripter is looking for the easiest solution possible, while a scripter on the other hand will try and improve it again and again until it is so optimalized it's beyond the capability of a non-scripter to understand.
 
Back
Top