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

RevScripts wall remove by using

T

Tibia Demon

Guest
i am trying to make this script remove wall by click wall its self but it remove all walls not the one i am clicking
it work weird too it remove wall if i stay in some positions and dont remove them on other positions idk what i have wrong
Lua:
local walls = {
    [1] = {pos = Position(1009, 1014, 7), wallid = 8475},
    [2] = {pos = Position(1007, 1021, 7), wallid = 8476}
}

local wallaid = 4498
local wallremove = Action()
function wallremove.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    for v, k in pairs(walls) do
        local tile = Tile(k.pos)
        if not tile then
            return true
        end
        local wall = tile:getItemById(k.wallid)
        if wall and wall:getActionId() == wallaid then
            wall:remove()
            fromPosition:sendMagicEffect(CONST_ME_POFF)
        end
    end
    return true
end
wallremove:aid(wallaid)
wallremove:register()
 
Solution
i need only the wall i click to be removed not all
now when i press wall in this position Position(1009, 1014, 7) it remove the wall in the other position Position(1007, 1021, 7) idk why
it should remove the wall i click the on in the position i click
only remove wall when clicked:
Lua:
local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    item:remove()
    toPosition:sendMagicEffect(CONST_ME_POFF)
    return true
end

action:aid(4498)
action:register()
set actionId 4498 to a item and ready.
For all of them to work the same you must add all the walls in the table walls and change fromPosition:sendMagicEffect(CONST_ME_POFF) to k.pos:sendMagicEffect(CONST_ME_POFF)
i need only the wall i click to be removed not all
now when i press wall in this position Position(1009, 1014, 7) it remove the wall in the other position Position(1007, 1021, 7) idk why
it should remove the wall i click the on in the position i click
 
i need only the wall i click to be removed not all
now when i press wall in this position Position(1009, 1014, 7) it remove the wall in the other position Position(1007, 1021, 7) idk why
it should remove the wall i click the on in the position i click
only remove wall when clicked:
Lua:
local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    item:remove()
    toPosition:sendMagicEffect(CONST_ME_POFF)
    return true
end

action:aid(4498)
action:register()
set actionId 4498 to a item and ready.
 
Solution
only remove wall when clicked:
Lua:
local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    item:remove()
    toPosition:sendMagicEffect(CONST_ME_POFF)
    return true
end

action:aid(4498)
action:register()
set actionId 4498 to a item and ready.
thank you! i thought need to check tile and pos for no crash or bug later.
 
Back
Top