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

TFS 1.X+ Make item with uid trashholder and only for selected itemId

overdriven

Active Member
Joined
Mar 10, 2020
Messages
70
Solutions
1
Reaction score
42
I know how to make any item in items.xml to work like a trashholder, but this will affect all items of that type.
As far as I can see items.xml doesn't allow uids.

Other problem is that I want to allow trashing only certain item types.

I've tried to intercept it through actions.xml and onMoveItem, but it doesn't have any effect, actions seem to accept only onUse functions.
 
Solution
Yes. Make item with uid 2568 to work like trashable object (i.e. dustbin), but accept only items of type 2259 to be trashed.
So, in other words, if I move an item 2259 onto this object it will be trashed, but other items will be moved on top if normally (or return "sorry, not possible").
Would want to use actionid instead of uniqueid, but should be possible.

try this

movements.xml
XML:
<movevent event="AddItem" tileitem="1" actionid="45001" script="destroyShit.lua"/>

destroyshit.lua
Lua:
local itemsToDestroy = {2259, 1111, 2222} -- ids of items you want to be destroyed

function onAddItem(moveitem, tile, position, cid)
    if table.contains(itemsToDestroy, moveitem:getId()) then
        moveitem:remove()
    end
    return...
I know how to make any item in items.xml to work like a trashholder, but this will affect all items of that type.
As far as I can see items.xml doesn't allow uids.

Other problem is that I want to allow trashing only certain item types.

I've tried to intercept it through actions.xml and onMoveItem, but it doesn't have any effect, actions seem to accept only onUse functions.

I can't make sense of your thought rambling. xD

What is it that you are wanting to do, exactly?

Make a trash can that only accepts specific items?
What item types?
 
Make a trash can that only accepts specific items?
What item types?
Yes. Make item with uid 2568 to work like trashholder object (i.e. dustbin), but accept only items of type 2259 to be trashed.
So, in other words, if I move an item 2259 onto this object it will be trashed, but other items will be moved on top of it normally (or return "sorry, not possible").

Or forget about "trashholder", basically I just want to make some action when a certain item is moved on top of other certain item, like here:

ezgif-4-cdbdf3d3f5.gif
 
Last edited:
Yes. Make item with uid 2568 to work like trashable object (i.e. dustbin), but accept only items of type 2259 to be trashed.
So, in other words, if I move an item 2259 onto this object it will be trashed, but other items will be moved on top if normally (or return "sorry, not possible").
Would want to use actionid instead of uniqueid, but should be possible.

try this

movements.xml
XML:
<movevent event="AddItem" tileitem="1" actionid="45001" script="destroyShit.lua"/>

destroyshit.lua
Lua:
local itemsToDestroy = {2259, 1111, 2222} -- ids of items you want to be destroyed

function onAddItem(moveitem, tile, position, cid)
    if table.contains(itemsToDestroy, moveitem:getId()) then
        moveitem:remove()
    end
    return true
end
 
Solution
Awesome, that will do! I thought movements.xml are only for creature movements, not item movements ;)

Is there any way I can pass player object to this function?
 
Back
Top