• 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+ TFS 1.2 - Monster loot - COUNTMAX doesnt work

Xedoxo

Member
Joined
Oct 24, 2010
Messages
111
Reaction score
12
Hi, example:

dragon.xml:
XML:
</attacks>
    <defenses armor="30" defense="30">
        <defense name="healing" interval="2000" chance="15" min="40" max="70">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    
    <immunities>
        <immunity paralyze="1"/>
        <immunity invisible="1"/>
        <immunity fire="1"/>
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="GROOAAARRR" yell="1"/>
        <voice sentence="FCHHHHH" yell="1"/>
    </voices>
    <loot>
        <item id="2148" countmax="70" chance="147500"/><!-- gold coin -->
        <item id="2148" countmax="45" chance="137500"/><!-- gold coin -->
        <item id="2672" countmax="3" chance="65500"/><!-- dragon ham -->
        <item id="2509" chance="15000"/><!-- steel shield -->
        <item id="2455" chance="10000"/><!-- crossbow -->
        <item id="2397" chance="4000"/><!-- longsword -->
        <item id="2457" chance="3000"/><!-- steel helmet -->
        <item id="2647" chance="2000"/><!-- plate legs -->
        <item id="2413" chance="1950"/><!-- broadsword -->
        <item id="2387" chance="960"/><!-- double axe -->
        <item id="2187" chance="1005"/><!-- wand of inferno -->
        <item id="5920" chance="1000"/><!-- green dragon scale -->
        <item id="2434" chance="560"/><!-- dragon hammer -->
        <item id="5877" chance="1005"/><!-- green dragon leather -->
        <item id="2145" chance="380"/><!-- small diamond -->
        <item id="2516" chance="320"/><!-- dragon shield -->
        <item id="2409" chance="420"/><!-- serpent sword -->
        <item id="7430" chance="110"/><!-- dragonbone staff -->
        <item id="2177" chance="120"/><!-- life crystal -->
        <item id="2546" countmax="10" chance="8060"/><!-- burst arrow -->
    </loot>
</monster>

Drop:
Code:
13:13 Loot of a dragon: 2 gold coins
13:13 Loot of a dragon: a crossbow, a steel shield, dragon ham, 2 gold coins
13:13 Loot of a dragon: dragon ham, 2 gold coins
13:13 Loot of a dragon: a burst arrow, a green dragon leather, a dragon hammer, a green dragon scale, a wand of inferno, a double axe, a broadsword, plate legs, a steel helmet, a longsword, a crossbow, a steel shield, dragon ham, 2 gold coins
13:13 Loot of a dragon: a steel shield, dragon ham, 2 gold coins
13:13 Loot of a dragon: 2 gold coins
13:13 Loot of a dragon: 2 gold coins
13:13 Loot of a dragon: a crossbow, a steel shield, dragon ham, 2 gold coins
13:13 Loot of a dragon: dragon ham, 2 gold coins
13:13 Loot of a dragon: 2 gold coins
13:13 Loot of a dragon: a burst arrow, a crossbow, a steel shield, dragon ham, 2 gold coins
13:13 Loot of a dragon: a burst arrow, a crossbow, a steel shield, dragon ham, 2 gold coins
13:13 Loot of a dragon: dragon ham, 2 gold coins
13:13 Loot of a dragon: 2 gold coins
13:13 Loot of a dragon: dragon ham, 2 gold coins

Loot x1. How to fix it?
Post automatically merged:

Also here monster.lua
Code:
function Monster:onDropLoot(corpse)
    if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
        return
    end

    local player = Player(corpse:getCorpseOwner())
    local mType = self:getType()
    if not player or player:getStamina() > 840 then
        local monsterLoot = mType:getLoot()
        for i = 1, #monsterLoot do
            local item = corpse:createLootItem(monsterLoot[i])
            if not item then
                print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
            end
        end

        if player then
            local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
            local party = player:getParty()
            if party then
                party:broadcastPartyLoot(text)
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR, text)
                player:sendChannelMessage("", text, TALKTYPE_CHANNEL_O, 9)
            end
        end
    else
        local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
        local party = player:getParty()
        if party then
            party:broadcastPartyLoot(text)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, text)
        end
    end
end

Sometimes i have errors in console:
Code:
DropLoot:', 'Could not add loot item to corpse.')
 
Last edited:
It's pretty hard, actually its near impossible to follow the changes youve made and offer a potential solution or fix but let me try(if I dont follow up a couple of days it's because im quite busy recently).
1. Was countmax there in the monster files from the beginning? Or you added it?
2. If you added it, Did you add it only in the monster files or also added needed source changes?
3. If countmax was there before, was this error happening from the beginning or after you changed some files?
4. If you changed some files or added some scripts and then error started to occur, could you share what you changed/added?
 
Try to lower your drop chance under 100.000 since it is max value, maybe it will fix the problem with gold, but now I see that dagon ham is not working as well.
Which distro do you use?
 
Try to lower your drop chance under 100.000 since it is max value, maybe it will fix the problem with gold, but now I see that dagon ham is not working as well.
Which distro do you use?
Anything over 100,000 should be capped in the sources. However, for sanity sake, yes these should be set to 100,000 or less anyway...

@Xedoxo Can you post your data/lib/core/container.lua
 
Back
Top