• 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 TFS 1.1 - there is any way to clean an area?

sircurse

Curseria RTG - TFS 1.1
Joined
Nov 12, 2007
Messages
107
Reaction score
2
Location
Brazil
Twitch
curseofcourse
Hi,

I m trying to do a script where it will clean a certain area (from, to), I saw that in past versions TFS used to have a doCleanTile function but hard coded, there is any equivalent on the current version?

Curse.
 
Im not 100% sure if there is a function that you actually can do this in.
But if you don't want to do source changes:
Use a for loop with the positions, use a while loop and loop that till there are no items no it (use item:remove() to remove them).

Remember that you are in the support not the request board.
 
I just want to know what is this: local groundItem = Tile(position):getGround()
I mean what are the ground items.

The ground is the tile, ex black tile etc.
Tile is the square itself, so use tile:getItems() in the loops.
 
Code:
iterateArea(
            function(position)
                local item = Tile(position):getItemById(itemid)
                if item then
                    item:remove()
                end
            end,
            Position(x, y, z),
            Position(x, y, z)
        )
 
Code:
iterateArea(
            function(position)
                local item = Tile(position):getItemById(itemid)
                if item then
                    item:remove()
                end
            end,
            Position(x, y, z),
            Position(x, y, z)
        )

Why are you indexing 2 positions but only using one?
Check if the tile exists and I said getItems not getItemsById since you can only get it by one id.
If you are trying to clean up (eg. gold, vials etc) that array will get pretty big.
Another thing is that the itemid is not indexed(if you for some reason just want to remove 1 item)

Not sure what getItems will return (boarder, nature etc) but in that case check if the item is movable and or pickable.
 
Why are you indexing 2 positions but only using one?
Check if the tile exists and I said getItems not getItemsById since you can only get it by one id.
If you are trying to clean up (eg. gold, vials etc) that array will get pretty big.
Another thing is that the itemid is not indexed(if you for some reason just want to remove 1 item)

Not sure what getItems will return (boarder, nature etc) but in that case check if the item is movable and or pickable.
cus iterate area works with 2 positions, from and to, also u can do a loop inside the itarate to check more that 1 id i just an example, u can always do ur own one
 
will u post it?

I don't have one that I use all the time, I create a new one depending on what I need it to do.
Pretty much just 2 loops to index the position userdata and then index the things I need.
Idk how that function works, so idk the diffrence.
 
I don't have one that I use all the time, I create a new one depending on what I need it to do.
Pretty much just 2 loops to index the position userdata and then index the things I need.
Idk how that function works, so idk the diffrence.
i mean the new code to check the area and clean replacin my very own one
 
i mean the new code to check the area and clean replacin my very own one

Now why would I do that? :p
You won't learn anything from that, read what I wrote and then try to get a script from it.
If you have any problems you can post it here or create a new topic.

And if you are talking about a script that does this then I have not done one.
 
Back
Top