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

Lua Remove items from tiles?

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,759
Solutions
127
Reaction score
2,279
Hello, i have problem i dont know how to remove item from tiles.

Here is my config:
Code:
local config = {
    {position = Position(32493, 32503, 8), itemId = 2625},
    {position = Position(32494, 32503, 8), itemId = 2626},
    {position = Position(32496, 32503, 8), itemId = 2627},
    {position = Position(32497, 32503, 8), itemId = 2628}
}

How do i remove all items on all tiles in one time?

something like
tileitem:remove()
 
Code:
function OpenWallBattle()
    local B = {
        {1049, {x = 31424, y = 32550, z = 6, stackpos = 1}}, -- pos walls
        {1049, {x = 31424, y = 32551, z = 6, stackpos = 1}}, -- pos walls
        {1049, {x = 31424, y = 32552, z = 6, stackpos = 1}},
        {1049, {x = 31424, y = 32553, z = 6, stackpos = 1}},
        {1049, {x = 31424, y = 32554, z = 6, stackpos = 1}},
        {1049, {x = 31424, y = 32555, z = 6, stackpos = 1}},
        {1049, {x = 31424, y = 32556, z = 6, stackpos = 1}},
        {1049, {x = 31424, y = 32557, z = 6, stackpos = 1}}
    }

    for i = 1, #B do
        if getTileItemById(B[i][2], B[i][1]).uid == 0 then
            doCreateItem(B[i][1], 1, B[i][2])
        else
            doRemoveItem(getThingfromPos(B[i][2]).uid,1)
        end
    end
end
 
Hello, i have problem i dont know how to remove item from tiles.

Here is my config:
Code:
local config = {
    {position = Position(32493, 32503, 8), itemId = 2625},
    {position = Position(32494, 32503, 8), itemId = 2626},
    {position = Position(32496, 32503, 8), itemId = 2627},
    {position = Position(32497, 32503, 8), itemId = 2628}
}

How do i remove all items on all tiles in one time?

something like
tileitem:remove()

If you just want to remove them without checking you can do it like this:

Code:
for _, tab in ipairs(config) do
    local item = Tile(tab.position):getItemById(tab.itemId)
    if item then
        item:remove()
    end
end
 
If you just want to remove them without checking you can do it like this:

Code:
for _, tab in ipairs(config) do
    local item = Tile(tab.position):getItemById(tab.itemId)
    if item then
        item:remove()
    end
end
Thanks! WORKS
 
Back
Top