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

Wall Script [help]

Lucifer

Active Member
Joined
Dec 27, 2014
Messages
145
Reaction score
33
Location
Sweden
I have this Script but can't make so i can remove 5 walls in (lucky wall)
And + i want to count down in both "walls" to countdown when the wall is removd

Can someone help me? I really have tried to fix this but cant make it work...

Code:
local config = {
    walls = {
        [1] = {position = Position(1276, 995, 7), chance = 100, id = 1546},
        [2] = {position = Position(1412, 1000, 6), chance = 20, id = 1546},
    },
    levers = {notPulled = 1945, pulled = 1946}
}
local function revertThings(leverPosition)
    for _, wall in ipairs(config.walls) do
        local tile = Tile(wall.position)
        if tile then
            local wallItem = tile:getItemById(wall.id)
            if not wallItem then
                Game.createItem(wall.id, 1, wall.position)
            end
        end
    end
    local tile = Tile(leverPosition)
    if tile then
        local item = tile:getItemById(config.levers.pulled)
        if item then
            item:transform(config.levers.notPulled)
        end
    end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item:getId() == config.levers.notPulled then
        for _, wall in ipairs(config.walls) do
            local tile = Tile(wall.position)
            if tile then
                local wallItem = tile:getItemById(wall.id)
                if wallItem and math.random(1, 100) <= wall.chance then
                    wallItem:remove()
                end
            end
        end
        item:transform(config.levers.pulled)
        addEvent(revertThings, 2 * 60 * 1000, item:getPosition())
    end
    return true
end
 
Back
Top