Action Bridgelever

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
I've made a script for making\removing a bridge.


Here's the script:

in bridgelever.lua:
Code:
--Script made by Empty
function onUse(cid, item, frompos, item2, topos)
    tile1 = {x=222, y=333, z=5, stackpos=1} --change tilepos
    tile2 = {x=222, y=332, z=5, stackpos=1} --change tilepos
    tile3 = {x=222, y=331, z=5, stackpos=1} --change tilepos
    gettile1 = getThingfromPos(tile1)
    gettile2 = getThingfromPos(tile2)
    gettile3 = getThingfromPos(tile3)

    if item.uid == 7007 and item.itemid == 1945 then
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doRemoveItem(gettile3.uid,1)
        doCreateItem(965,1,tile1)
        doCreateItem(965,1,tile2)
        doCreateItem(965,1,tile3)
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 7007 and item.itemid == 1946 then
        doCreateItem(100,1,tile1) --change itemID
        doCreateItem(100,1,tile2) --change itemID
        doCreateItem(100,1,tile3) --change itemID
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doRemoveItem(gettile3.uid,1)
        doTransformItem(item.uid,item.itemid-1)        
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1
end
and in actions.xml
Code:
<action uniqueid="7007" script="bridgelever.lua" />
Hope it can help you. Oh almost forgot, its easy to change it to make a larger bridge, its just to add more tiles, like this:

Code:
--Script made by Empty
function onUse(cid, item, frompos, item2, topos)
    tile1 = {x=222, y=333, z=5, stackpos=1} --change tilepos
    tile2 = {x=222, y=332, z=5, stackpos=1} --change tilepos
    tile3 = {x=222, y=331, z=5, stackpos=1} --change tilepos
    tile4 = {x=222, y=331, z=5, stackpos=1} --change tilepos
    gettile1 = getThingfromPos(tile1)
    gettile2 = getThingfromPos(tile2)
    gettile3 = getThingfromPos(tile3)
    gettile4 = getThingfromPos(tile4)

    if item.uid == 7007 and item.itemid == 1945 then
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doRemoveItem(gettile3.uid,1)
        doRemoveItem(gettile4.uid,1)
        doCreateItem(965,1,tile1) --change itemID
        doCreateItem(965,1,tile2) --change itemID
        doCreateItem(965,1,tile3) --change itemID
        doCreateItem(965,1,tile4) --change itemID
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 7007 and item.itemid == 1946 then
        doCreateItem(100,1,tile1)
        doCreateItem(100,1,tile2)
        doCreateItem(100,1,tile3)
        doCreateItem(100,1,tile4)
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doRemoveItem(gettile3.uid,1)
        doRemoveItem(gettile4.uid,1)
        doTransformItem(item.uid,item.itemid-1)        
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1
end
Tested in Evolutions (made it a while ago;)) 7.92


EDIT: Shorter version of script, optimized by Talaturen.

Code:
-- Script made by Empty 
-- Optimized by Talaturen 
-- Visit http://otland.net 
-- 00:42 CET >> 2007-08-13 
local tile = {x = 222, y = 334, z = 5, stackpos = 1} 
local newId = 0 
function onUse(cid, item, frompos, item2, topos) 
   if item.itemid == 1945 then 
      newId = 965 
      doTransformItem(item.uid, item.itemid + 1) 
   else 
      newId = 100 
      doTransformItem(item.uid, item.itemid - 1) 
   end 
   for i = 1, 3 do 
      tile.y = tile.y - 1 
      doCreateItem(newId, 1, tile) 
      doRemoveItem(getThingfromPos(tile).uid, 1) 
   end 
   return TRUE 
end
Yours, Empty
 
Last edited:

dekar

New Member
Joined
Jul 3, 2007
Messages
108
Best answers
0
Reaction score
0
this script run in 7.6 - 7.92 :D good!
 

Pank

New Member
Joined
Jul 21, 2007
Messages
34
Best answers
0
Reaction score
1
WooooooooW I loved this.
Certainly I will use in my server.
Thank you very much for sharing.
Hugs hugs hugs :p
 

Loira

New Member
Joined
Aug 13, 2007
Messages
48
Best answers
0
Reaction score
0
nice been looking for a script like this nice been looking for a script like this
 

Supar Kakan

New Member
Joined
Aug 8, 2007
Messages
34
Best answers
0
Reaction score
0
To me, I can't see how this'll work since you're using unique IDs.. Specially since you're trying to use ONE SINGLE unique ID on THREE DIFFERENT coordinated tiles.
I still like the idea. =)
 
OP
JayBeee

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
Think so, Aro.
 
OP
JayBeee

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
I'd be glad to get some rep for this :)
 

4Play

New Member
Joined
Jul 2, 2007
Messages
89
Best answers
0
Reaction score
0
sounds great i ll use it in my server thx!
 
OP
JayBeee

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
No problems, glad to be of help!
 

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
I got like 99% the same script but mine is from 7.6 and released on otcrap...
But mine removed walls. thats the only difference
 
OP
JayBeee

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
Hehe :) well, there aren't very many ways to make this kind of scripts...
 

STiX

Intermediate OT User
Joined
Aug 22, 2007
Messages
437
Best answers
0
Reaction score
105
Location
Western Australia
And what if a player is standing on the bridge and gets it removed from under them?
 

Mokerhamer

Retired Global Mod
Joined
Aug 6, 2007
Messages
1,766
Best answers
0
Reaction score
35
Looks great it's not messy at all like my script :p


And what if a player is standing on the bridge and gets it removed from under them?
as you can see it will send a massega "this is not possible" but if i looked at the script fastly i see what u mean all tiles of the brige will remove only the tile where the player stands not.. so what u could do is an player on the tiles and if a player stand on it it will sai "The brige is to heavey to lift it seems a player is standing on it"
 

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
Looks great it's not messy at all like my script :p




as you can see it will send a massega "this is not possible" but if i looked at the script fastly i see what u mean all tiles of the brige will remove only the tile where the player stands not.. so what u could do is an player on the tiles and if a player stand on it it will sai "The brige is to heavey to lift it seems a player is standing on it"
Yes or teleport the player to the other side.
 
OP
JayBeee

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
Too advanced for me to make... :D
 
Top