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

Remove wall on StepIn

God Sallonzo

New Member
Joined
Feb 17, 2008
Messages
124
Reaction score
2
Location
The Netherlands
How do i add 2 more walls in here so it removes 3 walls ?
also without the tile transform
just stepin remove walls after some time walls come back

Code:
local config = {
wall = {id = 1039, pos = {x = 94, y = 132, z = 7}},
transformid = 425,
time = 10, -- time in minutes
playerpos = {
{x = 94, y = 130, z = 7},
{x = 94, y = 131, z = 7}
}
}

function onStepIn(cid, item, position, fromPosition)

if(getTileItemById(config.wall.pos, config.wall.id).uid > 0) then
local n = 0
for pos = 1, #config.playerpos do
if(isPlayer(getTopCreature(config.playerpos[pos]).uid)) then
n = n + 1
end
end
if(n == #config.playerpos) then
doSendMagicEffect(config.wall.pos, CONST_ME_MAGIC_RED)
doRemoveItem(getTileItemById(config.wall.pos, config.wall.id).uid,1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Wall is removed.")
addEvent(doCreateItem, config.time * 60 * 1000, config.wall.id, 1, config.wall.pos)
end
end
doTransformItem(item.uid, config.transformid)
return true
end
 
Here you go:
Code:
local config = {
    walls = {
        {id = 1039, pos = {x = 94, y = 132, z = 7}},
        {id = 1039, pos = {x = 94, y = 132, z = 7}},
        {id = 1039, pos = {x = 94, y = 132, z = 7}}
    },
    transformid = 425,
    time = 10, -- time in minutes
    playerpos = {
        {x = 94, y = 130, z = 7},
        {x = 94, y = 131, z = 7}
    }
}

function onStepIn(cid, item, position, fromPosition)
    if(getTileItemById(config.wall.pos, config.wall.id).uid > 0) then
        local n = 0
        for pos = 1, #config.playerpos do
            if(isPlayer(getTopCreature(config.playerpos[pos]).uid)) then
                n = n + 1
            end
        end
        if(n == #config.playerpos) then
            for i = 1, #config.walls do
                doSendMagicEffect(config.walls[i].pos, CONST_ME_MAGIC_RED)
                doRemoveItem(getTileItemById(config.walls[i].pos, config.walls[i].id).uid,1)
                addEvent(doCreateItem, config.time * 60 * 1000, config.walls[i].id, 1, config.walls[i].pos)
            end

            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Wall is removed.")
        end
    end

    doTransformItem(item.uid, config.transformid)
    return true
end
 
Here you go:
Code:
local config = {
    walls = {
        {id = 1039, pos = {x = 94, y = 132, z = 7}},
        {id = 1039, pos = {x = 94, y = 132, z = 7}},
        {id = 1039, pos = {x = 94, y = 132, z = 7}}
    },
    transformid = 425,
    time = 10, -- time in minutes
    playerpos = {
        {x = 94, y = 130, z = 7},
        {x = 94, y = 131, z = 7}
    }
}

function onStepIn(cid, item, position, fromPosition)
    if(getTileItemById(config.wall.pos, config.wall.id).uid > 0) then
        local n = 0
        for pos = 1, #config.playerpos do
            if(isPlayer(getTopCreature(config.playerpos[pos]).uid)) then
                n = n + 1
            end
        end
        if(n == #config.playerpos) then
            for i = 1, #config.walls do
                doSendMagicEffect(config.walls[i].pos, CONST_ME_MAGIC_RED)
                doRemoveItem(getTileItemById(config.walls[i].pos, config.walls[i].id).uid,1)
                addEvent(doCreateItem, config.time * 60 * 1000, config.walls[i].id, 1, config.walls[i].pos)
            end

            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Wall is removed.")
        end
    end

    doTransformItem(item.uid, config.transformid)
    return true
end
Mmm you have this script but with 3 switchs?
 
Code:
local config = {
    walls = {
        {id = 1039, pos = {x = 94, y = 132, z = 7}},
        {id = 1039, pos = {x = 94, y = 132, z = 7}},
        {id = 1039, pos = {x = 94, y = 132, z = 7}}
    },
    transformid = 425,
    time = 10, -- time in minutes
    playerpos = {
        {x = 94, y = 130, z = 7},
        {x = 94, y = 131, z = 7}
    }
}

local function checkWalls(t, n)
    n = n or 1
    if n < 3 then
        if getTileItemById(t[n].pos, t[n].id).uid > 0 then
            return checkWalls(t, n + 1)
        end
    end
    return n == #t
end

function onStepIn(cid, item, position, fromPosition)
    local walls = config.walls
    if checkWalls(walls) then
        local n = 0
        for pos = 1, #config.playerpos do
            n = isPlayer(getTopCreature(config.playerpos[pos]).uid) and n + 1 or n
        end
        if n == #config.playerpos then
            local currPos, currId
            for i = 1, #walls do
                currPos = walls[i].pos
                currId  = walls[i].id
                doSendMagicEffect(currPos, CONST_ME_MAGIC_RED)
                doRemoveItem(getTileItemById(currPos, currId).uid, 1)
                addEvent(doCreateItem, config.time * 60 * 1000, currId, 1, currPos)
            end
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Wall is removed.")
        end
    end
    doTransformItem(item.uid, config.transformid)
    return true
end
 
Back
Top