megachock
Member
- Joined
- Mar 12, 2009
- Messages
- 115
- Reaction score
- 7
Hey, this is my first script, i just followed some guides and i wanted to make this and finally i made it work.
What it does? When you pull the lever this will remove a wall from a position then in X seconds wall will appear again and the lever will be pulled back, also you can pull back the lever and create the wall.
Here it is:
In actions/actions.xml
23891 is the actionid of the lever in the map.
In actions/scripts/
Copy any script and rename it WallRemover.lua
and paste it inside:
wall = Wall ID
level = levelrequirement
pos = {position of the wall}
seconds = seconds the wall will appear again
What it does? When you pull the lever this will remove a wall from a position then in X seconds wall will appear again and the lever will be pulled back, also you can pull back the lever and create the wall.
Here it is:
In actions/actions.xml
Code:
<action actionid="23891" event="script" value="WallRemover.lua"/>
23891 is the actionid of the lever in the map.
In actions/scripts/
Copy any script and rename it WallRemover.lua
and paste it inside:
Code:
local pos = {x = 1656, y = 1135, z = 7}
local wall = 1544
local level = 70
local seconds = 3
local event = 0
local function reset(leverPos)
local lever = getTileItemById(leverPos, 1946).uid
doTransformItem(lever, 1945)
doCreateItem(wall, 1, pos)
doPlayerSendTextMessage(cid,21,"The pass has been closed!")
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 and getPlayerLevel(cid) >= level then
doRemoveItem(getTileItemById(pos,wall).uid)
doPlayerSendTextMessage(cid,21,"You have opened the pass, Beware!")
event = addEvent(reset, seconds * 1000, getThingPos(item.uid))
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946 and getPlayerLevel(cid) >= level then
stopEvent(event)
doPlayerSendTextMessage(cid,21,"You have closed the pass!")
doTransformItem(item.uid,item.itemid-1)
doCreateItem(wall, 1, pos)
end
return true
end
wall = Wall ID
level = levelrequirement
pos = {position of the wall}
seconds = seconds the wall will appear again
Last edited: