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

Lever removing XX walls for XX seconds (Got a beginning)

survivor

New Member
Joined
Mar 20, 2008
Messages
89
Reaction score
4
Hello,

I was wondering if anyone could make me a script where I pull a lever and 2 walls disappear and reappear after a couple of seconds..

I'm using: cryingdamson 0.3.6 (8.60) V82

///SOLVED///

WORKING SCRIPT (By Limos & ArtOfWork):

Code:
local positions = {
{x = 92, y = 118, z=7},
{x = 92, y = 119, z=7}
}
local wallid = 1546
local wall = {} -- should be a table
local time_ = 30

local function doCreateWalls()
for x = 1, #positions do
doCreateItem(wallid, 1, positions[x])
wall[x] = nil -- delete the table
end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
if #wall < #positions then -- is the wall table empty
for x = 1, #positions do
wall[x] = getTileItemById(positions[x], wallid).uid
doRemoveItem(wall[x], 1)
end
addEvent(doCreateWalls, time_ * 1000)
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
return true
else
doPlayerSendCancel(cid, "The walls are already removed.")
return false
end
end

yours,
 
Last edited:
Code:
function onThink(interval, lastExecution)
     -- add the code here
     return true
end

If you change the type of the script, all you have to do is change the function. All the parts with cid, which is the creatureid of the player who does the action, should be removed then, since globalevent scripts are executed after a certain time and not after a certain player action (as you can see, there is no cid in function onThink).
 
Last edited:
Code:
function onThink(interval, lastExecution)
     -- add the code here
     return true
end

If you change the type of the script, all you have to do is change the function. All the parts with cid, which is the creatureid of the player who does the action, should be removed then, since globalevent scripts are executed after a certain time and not after a certain player action (as you can see, there is no cid in function onThink).
how do i insert it? i created a wall.lua in the actions then in action xml i put
<action uniqueid="2300" event="script" value="Magicwall.lua"/>
but the script does not have uniqeid or something else?
 
Is function onThink in the script magicwall.lua?
the script in magicwall.lua looks :

local positions = {
{x = 1233, y = 985, z=7},
{x = 1233, y = 986, z=7}
}
local wallid = 1546
local wall = {} -- should be a table
local time_ = 30

local function doCreateWalls()
for x = 1, #positions do
doCreateItem(wallid, 1, positions[x])
wall[x] = nil -- delete the table
end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
if #wall < #positions then -- is the wall table empty
for x = 1, #positions do
wall[x] = getTileItemById(positions[x], wallid).uid
doRemoveItem(wall[x], 1)
end
addEvent(doCreateWalls, time_ * 1000)
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
return true
else
doPlayerSendCancel(cid, "The walls are already removed.")
return false
end
end
 
That is an action script (function onUse)
Code:
function onThink(interval, lastExecution)
     -- add the code here
     return true
end

If you change the type of the script, all you have to do is change the function. All the parts with cid, which is the creatureid of the player who does the action, should be removed then, since globalevent scripts are executed after a certain time and not after a certain player action (as you can see, there is no cid in function onThink).
Add globalevent scripts in globalevents.
 
Back
Top