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

Solved How does "chance" work on a loot table?

ecounlimited

New Member
Joined
Aug 7, 2013
Messages
53
Reaction score
3
Here's the loot table for an Ancient Scarab on TFS Crying Damson (8.6):
Code:
<loot>
     <item id="2150" countmax="4" chance="1200"/><!-- small amethyst -->
     <item id="2148" countmax="90" chance="100000"/><!-- gold coin -->
     <item id="2162" chance="2500"/><!-- magic lightwand -->
     <item id="2463" chance="2222"/><!-- plate armor -->
     <item id="2149" countmax="3" chance="600"/><!-- small emerald -->
     <item id="1987" chance="100000"><!-- bag -->
       <inside>
         <item id="2148" countmax="22" chance="99900"/><!-- gold coin -->
         <item id="2135" chance="1428"/><!-- scarab amulet -->
         <item id="2159" countmax="4" chance="555"/><!-- scarab coin -->
         <item id="2142" chance="800"/><!-- ancient amulet -->
         <item id="2440" chance="200"/><!-- daramanian waraxe -->
         <item id="2540" countmax="1" chance="500"/><!-- scarab shield -->
       </inside>
     </item>
   </loot>

Now, I want to add a Terra Hood to its loot list.

Code:
<item id="7903" chance="XXX"/><!-- terra hood -->

So a plate armor drops frequently from an Ancient Scarab... but a scarab shield does not. A daramanian waraxe drops more often than a scarab shield though. So how does the chance work since their chances are 2222, 200, and 500 respectively. If I wanted a terra hood to be more rare than a daramanian waraxe, but less rare than a scarab shield, what number would I put?

--Edit--
After reading into it more, it seems like this loot table doesn't actually follow real Tibia's, and that the higher the number, the more likely it is for that item to drop. I can't figure out what the numbers mean exactly though. Is 500 .5%? 1000 = 1%? 100000 is obviously 100%.
 
Last edited:
100000 = 100%
50000 = 50%
1000 = 1%
100 = 0.1%
etc

Ofc loorate also have influence on this.
About the scarab shield, the chance of looting a scarab shield is higher then looting a daramanian waraxe, but it's still a chance, so it's possible to loot an item with less chance more, same as it is possible to get 10x 1 with a dice even though the chance is small.
 
100000 = 100%
50000 = 50%
1000 = 1%
100 = 0.1%
etc

Ofc loorate also have influence on this.
About the scarab shield, the chance of looting a scarab shield is higher then looting a daramanian waraxe, but it's still a chance, so it's possible to loot an item with less chance more, same as it is possible to get 10x 1 with a dice even though the chance is small.
Very true, thanks! Never understood why chance can't just be "percent = 8.9" or something, but I'm getting it now.
 
dropping chance = rate_loot * chance [%/1000]
so with loot rate 4 and chance 200 you have 0,8% to loot daramanian waraxe

from what I noticed seed is same everytime you restart your server which means if you kill certain creature first after restarting the server it will always drop same thing (probably can be changed in sources to os time, dunno if it was fixed already)
due to players randomness it isn't something terrible unless you have one player on your server who hunts same monsters

same with math.random
if you use math.randomseed(5) before generating 10x10 square with 3 tiles in table(eg. {100, 918, 231}), chosen by math.random you will always receive same pattern on seed 5

example:
Code:
pos = {x = 1000, y = 1000, z = 7}
tiles = {100, 918, 231}
math.randomseed(5)
for x = 0, 9 do
for y = 0, 9 do
doCreateItem(tiles[math.random(1, #tiles)],1, {x = pos.x + x, y = pos.y + y, z = pos.z})
end
end
 
What happen then if I set chance=100000 and i have loot rate x3?

it's weird because im editing a monster that i want an item 100% chance to loot it but it doesnt work.

Same with ferumbras: <item id="5903" chance="100000"/><!-- ferumbras' hat -->

but i've killed 9 ferumbras and it should always give a bag: <item id="1987" chance="100000"><!-- bag --> with the ferumbras hat inside, but it doesn't. Why this doesnt work properly?
 
What happen then if I set chance=100000 and i have loot rate x3?

it's weird because im editing a monster that i want an item 100% chance to loot it but it doesnt work.

Same with ferumbras: <item id="5903" chance="100000"/><!-- ferumbras' hat -->

but i've killed 9 ferumbras and it should always give a bag: <item id="1987" chance="100000"><!-- bag --> with the ferumbras hat inside, but it doesn't. Why this doesnt work properly?
Can you show us the entire loot portion for that monster? Or the entire monster?
 
Can you show us the entire loot portion for that monster? Or the entire monster?

Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Ferumbras" nameDescription="Ferumbras" race="venom" experience="12000" speed="320" manacost="0">
    <health now="35000" max="35000"/>
    <look type="229" corpse="6078"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="2"/>
        <flag staticattack="90"/>
        <flag runonhealth="2500"/>
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="-100" max="-350"/>
        <attack name="manadrain" interval="2000" chance="20" range="7" min="-300" max="-700">
            <attribute key="areaEffect" value="redshimmer"/>
        </attack>
        <attack name="poison" interval="3000" chance="20" radius="6" target="0" min="-250" max="-550">
            <attribute key="areaEffect" value="poison"/>
        </attack>
        <attack name="energy" interval="2000" chance="18" radius="6" target="0" min="-200" max="-400">
            <attribute key="areaEffect" value="energy"/>
        </attack>
        <attack name="manadrain" interval="2000" chance="16" radius="6" target="0" min="-225" max="-375">
            <attribute key="areaEffect" value="redshimmer"/>
        </attack>
        <attack name="lifedrain" interval="2000" chance="21" radius="6" target="0" min="-200" max="-450">
            <attribute key="areaEffect" value="poff"/>
        </attack>
        <attack name="effect" interval="3000" chance="20" radius="5" target="0" min="-200" max="-600">
            <attribute key="areaEffect" value="blackspark"/>
        </attack>
        <attack name="firecondition" interval="3000" chance="20" range="7" radius="7" target="1" min="-200" max="-800">
            <attribute key="shootEffect" value="fire"/>
            <attribute key="areaEffect" value="firearea"/>
        </attack>
        <attack name="lifedrain" interval="2000" chance="25" length="8" spread="0" min="-50" max="-250">
            <attribute key="areaEffect" value="greenspark"/>
        </attack>
    </attacks>
    <defenses armor="100" defense="120">
        <defense name="healing" interval="2000" chance="10" min="900" max="1500">
            <attribute key="areaEffect" value="greenshimmer"/>
        </defense>
        <defense name="speed" interval="3000" chance="30" speedchange="360" duration="7000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="invisible" interval="4000" chance="20" duration="5000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    <elements>
        <element firePercent="90"/>
    </elements>
    <immunities>
        <immunity lifedrain="1"/>
        <immunity paralyze="1"/>
        <immunity outfit="1"/>
        <immunity drunk="1"/>
        <immunity invisible="1"/>
    </immunities>
    <summons maxSummons="3">
        <summon name="Demon" interval="3000" chance="12" max="3"/>
    </summons>
    <voices interval="5000" chance="20">
        <voice sentence="NOONE WILL STOP ME THIS TIME!" yell="1"/>
        <voice sentence="THE POWER IS MINE!" yell="1"/>
    </voices>
    <loot>
        <item id="2148" countmax="100" chance="100000"/><!-- gold coin -->
        <item id="2148" countmax="25" chance="100000"/><!-- gold coin -->
        <item id="2393" chance="16060"/><!-- giant sword -->
        <item id="2514" chance="12050"/><!-- mastermind shield -->
        <item id="2472" chance="7000"/><!-- magic plate armor -->
        <item id="2466" chance="10000"/><!-- golden armor -->
        <item id="8903" chance="20000"/><!-- spellbook of lost souls -->
        <item id="7403" chance="20000"/><!-- berserker -->
        <item id="7427" chance="20000"/><!-- Chaos Mace -->
        <item id="8930" chance="20000"/><!-- Emerald Sword -->
        <item id="8904" chance="20000"/><!-- spellscroll of prophecies -->
        <item id="2195" chance="20000"/><!--  Boots of Haste -->
        <item id="7382" chance="20000"/><!-- demonrage sword -->
        <item id="7418" chance="20000"/><!-- Nightmare Blade -->
        <item id="8868" chance="20000"/><!-- velvet mantle -->
        <item id="7407" chance="20000"/><!-- Haunted Blade -->
        <item id="7423" chance="20000"/><!-- Skullcrusher -->
        <item id="7435" chance="20000"/><!-- Impaler -->
        <item id="2470" chance="10000"/><!-- Golden Legs -->
        <item id="1987" chance="100000"><!-- bag -->
       
            <inside>
                <item id="2678" countmax="3" chance="20000"/><!-- coconut -->
                <item id="2148" countmax="100" chance="100000"/><!-- gold coin -->
                <item id="2151" countmax="4" chance="12000"/><!-- talon -->
                <item id="5903" chance="100000"/><!-- ferumbras' hat -->
                <item id="2149" countmax="3" chance="15000"/><!-- small emerald -->
                <item id="2171" chance="30000"/><!-- platinum amulet -->
                <item id="2415" chance="6000"/><!-- great axe -->
            </inside>
        </item>
    </loot>
</monster>
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Ferumbras" nameDescription="Ferumbras" race="venom" experience="12000" speed="320" manacost="0">
    <health now="35000" max="35000"/>
    <look type="229" corpse="6078"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="2"/>
        <flag staticattack="90"/>
        <flag runonhealth="2500"/>
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="-100" max="-350"/>
        <attack name="manadrain" interval="2000" chance="20" range="7" min="-300" max="-700">
            <attribute key="areaEffect" value="redshimmer"/>
        </attack>
        <attack name="poison" interval="3000" chance="20" radius="6" target="0" min="-250" max="-550">
            <attribute key="areaEffect" value="poison"/>
        </attack>
        <attack name="energy" interval="2000" chance="18" radius="6" target="0" min="-200" max="-400">
            <attribute key="areaEffect" value="energy"/>
        </attack>
        <attack name="manadrain" interval="2000" chance="16" radius="6" target="0" min="-225" max="-375">
            <attribute key="areaEffect" value="redshimmer"/>
        </attack>
        <attack name="lifedrain" interval="2000" chance="21" radius="6" target="0" min="-200" max="-450">
            <attribute key="areaEffect" value="poff"/>
        </attack>
        <attack name="effect" interval="3000" chance="20" radius="5" target="0" min="-200" max="-600">
            <attribute key="areaEffect" value="blackspark"/>
        </attack>
        <attack name="firecondition" interval="3000" chance="20" range="7" radius="7" target="1" min="-200" max="-800">
            <attribute key="shootEffect" value="fire"/>
            <attribute key="areaEffect" value="firearea"/>
        </attack>
        <attack name="lifedrain" interval="2000" chance="25" length="8" spread="0" min="-50" max="-250">
            <attribute key="areaEffect" value="greenspark"/>
        </attack>
    </attacks>
    <defenses armor="100" defense="120">
        <defense name="healing" interval="2000" chance="10" min="900" max="1500">
            <attribute key="areaEffect" value="greenshimmer"/>
        </defense>
        <defense name="speed" interval="3000" chance="30" speedchange="360" duration="7000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="invisible" interval="4000" chance="20" duration="5000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    <elements>
        <element firePercent="90"/>
    </elements>
    <immunities>
        <immunity lifedrain="1"/>
        <immunity paralyze="1"/>
        <immunity outfit="1"/>
        <immunity drunk="1"/>
        <immunity invisible="1"/>
    </immunities>
    <summons maxSummons="3">
        <summon name="Demon" interval="3000" chance="12" max="3"/>
    </summons>
    <voices interval="5000" chance="20">
        <voice sentence="NOONE WILL STOP ME THIS TIME!" yell="1"/>
        <voice sentence="THE POWER IS MINE!" yell="1"/>
    </voices>
    <loot>
        <item id="2148" countmax="100" chance="100000"/><!-- gold coin -->
        <item id="2148" countmax="25" chance="100000"/><!-- gold coin -->
        <item id="2393" chance="16060"/><!-- giant sword -->
        <item id="2514" chance="12050"/><!-- mastermind shield -->
        <item id="2472" chance="7000"/><!-- magic plate armor -->
        <item id="2466" chance="10000"/><!-- golden armor -->
        <item id="8903" chance="20000"/><!-- spellbook of lost souls -->
        <item id="7403" chance="20000"/><!-- berserker -->
        <item id="7427" chance="20000"/><!-- Chaos Mace -->
        <item id="8930" chance="20000"/><!-- Emerald Sword -->
        <item id="8904" chance="20000"/><!-- spellscroll of prophecies -->
        <item id="2195" chance="20000"/><!--  Boots of Haste -->
        <item id="7382" chance="20000"/><!-- demonrage sword -->
        <item id="7418" chance="20000"/><!-- Nightmare Blade -->
        <item id="8868" chance="20000"/><!-- velvet mantle -->
        <item id="7407" chance="20000"/><!-- Haunted Blade -->
        <item id="7423" chance="20000"/><!-- Skullcrusher -->
        <item id="7435" chance="20000"/><!-- Impaler -->
        <item id="2470" chance="10000"/><!-- Golden Legs -->
        <item id="1987" chance="100000"><!-- bag -->
      
            <inside>
                <item id="2678" countmax="3" chance="20000"/><!-- coconut -->
                <item id="2148" countmax="100" chance="100000"/><!-- gold coin -->
                <item id="2151" countmax="4" chance="12000"/><!-- talon -->
                <item id="5903" chance="100000"/><!-- ferumbras' hat -->
                <item id="2149" countmax="3" chance="15000"/><!-- small emerald -->
                <item id="2171" chance="30000"/><!-- platinum amulet -->
                <item id="2415" chance="6000"/><!-- great axe -->
            </inside>
        </item>
    </loot>
</monster>
what tfs are you using?
 
Back
Top