• 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 Loot real tibia

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
931
Solutions
7
Reaction score
128
Location
Brazil
YouTube
caruniawikibr
I was watching some tibia old 7.6 videos and noticed a small detail, it seems silly, but it's a detail. The hydra, for example, dropped Ham and meat normally or inside a bag. How would this be possible to do in tfs? because if I put bag, I would have to have the loot inside and outside but that would double the loot.
Does anyone have an idea on how to do it without duplicating it?
note: meat and ham are an example, but this could happen with rare items too.

 
Code:
<item id="1987" chance="100000"><!-- bag -->

            <inside>

                <item id="2536" chance="100"/><!-- 0.1% medusa shield -->

                <item id="2197" chance="800"/><!-- 0.8% stone skin amulet -->

                <item id="2214" chance="1200"/><!-- 1.2% ring of healing -->

            </inside>

        </item>
 
1712257784036.png

I have to put it inside the bag, but for example, "ham" it had the chance of falling outside or inside the bag...
That's what I'm thinking about how it was set up for this to happen
 
here example of hydra


Lua:
<loot>
        <item id="2671" chance="60000" countmax="3"/><!-- 3 60% ham -->
        <item id="2666" chance="90000" countmax="4"/><!-- 4 90% meat -->
        <item id="2148" chance="60000" countmax="100"/><!-- 100 60% gold coin -->
        <item id="2148" chance="40000" countmax="50"/><!-- 50 40% gold coin -->
        <item id="2148" chance="80000" countmax="100"/><!-- 100 80% gold coin -->
        <item id="2146" chance="5000"/><!-- 5% small sapphire -->
        <item id="4850" chance="900"/><!-- 0.9% hydra egg -->
        <item id="2177" chance="600"/><!-- 0.6% life crystal -->
        <item id="2476" chance="1000"/><!-- 1% knight armor -->
        <item id="2475" chance="1000"/><!-- 1% warrior helmet -->
        <item id="2498" chance="200"/><!-- 0.2% royal helmet -->
        <item id="2195" chance="100"/><!-- 0.1% boots of haste -->
        <item id="1987" chance="100000"><!-- bag -->
            <inside>
                <item id="2536" chance="100"/><!-- 0.1% medusa shield -->
                <item id="2197" chance="800"/><!-- 0.8% stone skin amulet -->
                <item id="2214" chance="1200"/><!-- 1.2% ring of healing -->
            </inside>
        </item>
    </loot>
 
here example of hydra


Lua:
<loot>
        <item id="2671" chance="60000" countmax="3"/><!-- 3 60% ham -->
        <item id="2666" chance="90000" countmax="4"/><!-- 4 90% meat -->
        <item id="2148" chance="60000" countmax="100"/><!-- 100 60% gold coin -->
        <item id="2148" chance="40000" countmax="50"/><!-- 50 40% gold coin -->
        <item id="2148" chance="80000" countmax="100"/><!-- 100 80% gold coin -->
        <item id="2146" chance="5000"/><!-- 5% small sapphire -->
        <item id="4850" chance="900"/><!-- 0.9% hydra egg -->
        <item id="2177" chance="600"/><!-- 0.6% life crystal -->
        <item id="2476" chance="1000"/><!-- 1% knight armor -->
        <item id="2475" chance="1000"/><!-- 1% warrior helmet -->
        <item id="2498" chance="200"/><!-- 0.2% royal helmet -->
        <item id="2195" chance="100"/><!-- 0.1% boots of haste -->
        <item id="1987" chance="100000"><!-- bag -->
            <inside>
                <item id="2536" chance="100"/><!-- 0.1% medusa shield -->
                <item id="2197" chance="800"/><!-- 0.8% stone skin amulet -->
                <item id="2214" chance="1200"/><!-- 1.2% ring of healing -->
            </inside>
        </item>
    </loot>
In this case, do they have a chance of falling inside or outside the bag?
 
So what I'm saying is that in the video the "ham" if you watch it you will notice that it can fall inside or outside, but it never doubles the loot. In other words, the ham can fall both inside the bag and outside....
Post automatically merged:

1712261246197.png
1712261300153.png
 
In real tibia (atleast leaked 7.7) items are placed in order of the loot items defined in the .mon files. There are exceptions that always go into bag such as shields, weapons, items with certain flags (magical rings) etc.


Hydra loot priority:
Code:
Inventory     = {(3079, 1, 1),  // boots of haste
                 (3031, 100, 800),  // gold coin
                 (3031, 100, 600), // gold coin
                 (3031, 50, 400), // gold coin
                 (3582, 3, 600), // ham
                 (4839, 1, 9), // hydra egg
                 (3370, 1, 10), // knight armor
                 (3061, 1, 6), // life crystal
                 (3577, 4, 900), // meat
                 (3436, 1, 1), // medusa shield
                 (3098, 1, 12), // ring of healing
                 (3392, 1, 2),  // royal helmet
                 (3029, 1, 50), //small sapphire
                 (3081, 1, 8), // stone skin amulet
                 (3369, 1, 10) // warrior helmet
                 }
Here you can see gold has top priority so it ends up in both hands and arrow slot.
Then bag is created cause the hydra has no more slots in its virtual EQ. Thats where it places the Ham first and afterwards the meat.

hydra loot4.PNG
 
Last edited:
Monsters can have the gold coins or ham/meat in "hands" or the arrow slot. If there's no space, a bag is added, and items that don't fit the virtual equipment go there.
 
In real tibia (atleast leaked 7.7) items are placed in order of the loot items defined in the .mon files. There are exceptions that always go into bag such as shields, weapons, items with certain flags (magical rings) etc.


Hydra loot priority:
Code:
Inventory     = {(3079, 1, 1),  // boots of haste
                 (3031, 100, 800),  // gold coin
                 (3031, 100, 600), // gold coin
                 (3031, 50, 400), // gold coin
                 (3582, 3, 600), // ham
                 (4839, 1, 9), // hydra egg
                 (3370, 1, 10), // knight armor
                 (3061, 1, 6), // life crystal
                 (3577, 4, 900), // meat
                 (3436, 1, 1), // medusa shield
                 (3098, 1, 12), // ring of healing
                 (3392, 1, 2),  // royal helmet
                 (3029, 1, 50), //small sapphire
                 (3081, 1, 8), // stone skin amulet
                 (3369, 1, 10) // warrior helmet
                 }
Here you can see gold has top priority so it ends up in both hands and arrow slot.
Then bag is created cause the hydra has no more slots in its virtual EQ. Thats where it places the Ham first and afterwards the meat.

View attachment 83486

That explains a lot, never thought about this. :eek:
I always wondered, how the loot mechanic works :)
 
That explains a lot, never thought about this. :eek:
I always wondered, how the loot mechanic works :)
I've explained it in details here: [UK][7.4] Tibiantis Online (https://otland.net/threads/uk-7-4-tibiantis-online.269340/page-3#post-2599043)

Quoting the relevant part:
Loot!

Montster's loot is generated at the moment of spawn, in monster's constructor. What you may find interesting is that monsters have a virtual equipment with slots, just like players. When items are generated they're put in corresponding slots and may have an effect on the monster, e.g. by rising its armor. In old Tibia it was quite noticable when hunting warlocks with traps (for invisibility removal trick). Trap item has constant damage of 30, but affected by armor. Armorless warlock usually would take damage, while warlock with blue robe or golden armor would block it most of the time. That way one could deduce whether it was going to drop any armor piece. However, it only worked when certain armor piece was placed in its right slot. If e.g. black knight carries both knight and plate armors, only one of those will work, because the other one would be placed in hand or arrow slot (due to armor slot being already used). You can tell which item was on which slot by checking the order in monster's body - it's exactly the same as for dead players, and go as following: arrow slot, ring, boots, legs, right hand, left hand, armor, container, amulet, helmet.

ON2echk.png


Some items though are always placed in a bag, which is only generated when needed (not counting bags and other contaiers that are added to the loot list - those always drop empty and take hands/arrow slot). Those items are weapons, shields and everything that expires or wears out. So weapons/shields will NOT rise monster's attack/def abilities, because they're carried in a bag, not inventory. Bag is also generated for items that can normally be placed in inventory, but all possible slots are taken. E.g. if demon drops 4 stacks of gold and no other items - 3 of them would be in eq, using both hands and arrow slot, and the 4th stack would go to the bag (no more slots to put gold pile in). To sum it up, some items can drop both in a body or a bag, while others only in a bag.
Items can be put in a bag up to its capacity (8 items), if more are generated - they will be skipped due to lack of slots, and simply not added to the loot.

All the pictures, except for the one with my nick, come from various old .rec files recorded on youtube.

That's pretty much it, I hope that gives some clarification for those who were confused. Players are of course free to make their proposals on tweaking the game, but it should always be done with a knowledge of how things actually work, so it won't be based on wrong asumptions. :)

It's also worth to note that even though the loot chance in cip files varies from 1 to 1000, 1 does NOT correspond to 1/1000 as most people think. It actually corresponds to 2/1000, which is because they used <= instead of < in the code (probably by oversight), like so:
Code:
if(random(0,999) <= chance) {
   //loot
}
Which means that those values in @wizinx post are not accurate to real tibia. E.g. boots of haste should have 0.2% rather than 0.1%, royal helmet should have 0.3%, not 0.2% etc.
 
Last edited:
I've explained it in details here: [UK][7.4] Tibiantis Online (https://otland.net/threads/uk-7-4-tibiantis-online.269340/page-3#post-2599043)

Quoting the relevant part:


It's also worth to note that even though the loot chance in cip files varies from 1 to 1000, 1 does NOT correspond to 1/1000 as most people think. It actually corresponds to 2/1000, which is because they used <= instead of < in the code (probably by oversight), like so:
Code:
if(random(0,999) <= chance) {
   //loot
}
Which means that those values in @wizinx post are not accurate to real tibia. E.g. boots of haste should have 0.2% rather than 0.1%, royal helmet should have 0.3%, not 0.2% etc.
Thank you aswell for this detailed explanation :)
 
It would be interesting to create a system where I choose a probability of which item falls into the bag or out of it.
example:ham, royal helmet, and medusa shield, 40% chance of falling into or out of a bag
 
Back
Top