• 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.2] How can I make specific items not drop on death?

Eldora

Banned User
Joined
Oct 19, 2009
Messages
604
Reaction score
26
How can I make specific item IDs not drop when a player dies, but the rest should still work as usual?

Maybe droploot.lua or playerdeath.lua?

For example:
Item ID: 1, 2 and 3 should NOT drop if player die with it on them?
 
in droploot
but what item, what slot?

example:
item id = 7552 in CONST_SLOT_AMMO

Lua:
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
            local item = player:getSlotItem(i)
            local backpack = player:getSlotItem(CONST_SLOT_AMMO)
    if backpack.itemid == 7552 then
        item = player:getSlotItem(i - 1)
    end

Line: TFS-1.5-Downgrades/droploot.lua at 8.60 · nekiro/TFS-1.5-Downgrades (https://github.com/nekiro/TFS-1.5-Downgrades/blob/8.60/data/creaturescripts/scripts/droploot.lua#L25)

I want the following item ids to not drop on death, no matter what slot they are in:
11719 , 11723 and 11720

How can I add that?
Post automatically merged:

@Error 502 I want it to not drop no matter what slot it is in.
Items ID: 11719 , 11723 and 11720
 
Last edited:
I want the following item ids to not drop on death, no matter what slot they are in:
11719 , 11723 and 11720

How can I add that?
Post automatically merged:

@Error 502 I want it to not drop no matter what slot it is in.
Items ID: 11719 , 11723 and 11720



I don't think it works like that xd
what you could do is
make a bag that does not droop
and add the items
11719 , 11723 and 11720

login
Lua:
    if player:getLastLoginSaved() == 0 then
local backpack1 =player:addItem(7552, 1, true,  1, CONST_SLOT_AMMO) --ID BAG stack in slot ammo PD: look for a CONST_SLOT that doesn't work for you
 

        backpack1:addItem(11719,1)      --ID ITEM 1  inside the bag
        backpack1:addItem(11723,1)      --ID ITEM 2 inside the bag
        backpack1:addItem(11720,1)      --ID ITEM 3 inside the bag
end
droploot.lua
Lua:
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do

            local item = player:getSlotItem(i)

            local backpack = player:getSlotItem(CONST_SLOT_AMMO)

    if backpack.itemid == 7552 then --all item inside the bag id 7552 no drop (item 1,2,3)

        item = player:getSlotItem(i - 1)

    end

Items.xml
XML:
       <item id="7552" article="a" name="NO DROOP backpack">
        <attribute key="weight" value="1" />
        <attribute key="containerSize" value="3" />
        <attribute key="slotType" value="backpack" />
    </item>
 
@Eldora
droploot.lua is pretty simple. It replicates RL Tibia. Executes 'check if it can drop given item 10-11 times = for each "slot" of player':

What you ask for is probably some dumb OTS system 'prevent [premium] item drop', so players can use item X [paid item] on any item and that item becomes undroppable. A lot of CPU wasted + some weird behavior, as undroppable item blocks some containers (their parents) from dropping

I do not recommend this kind of item. If you want some 'undroppable' item, make it as @Error 502 mentioned. Just create extra 'premium' BP that does not drop.
 
Back
Top