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

[Warning] DropLoot issue.

Joined
Mar 14, 2020
Messages
139
Solutions
3
Reaction score
11
Sometimes this appears in my console, any clue to solve that? I guess this ins't normal, some of my players already told me that some daily bosses ins't dropping nothing (reward chest).
1614818500277.png
 
Did you find out why it does this? I have the same issue using Nekiro's downgraded 8.6 TFS 1.3

this message is sent when the engine can't create the loot on the monster corpse, this can be because of several reasons, like:

  • invalid monster corpse
  • invalid loot item id/name
etc

you guys might want to add some checks/warnings like these to know about any irregularity in your loot block
 
Thanks for your reply @Evil Puncker!
I got this error when killing Vampires so I just replaced the monster file and then got rid of it, but it wouldn't suprise me if theres more monsters with the same issue.

So I thought to implent the check/warning into the monster.cpp for future reference, but theres no such lines in my monster.cpp unfournately.

But in events\scripts\monster.lua I found this



monster.lua
Lua:
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)
            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


Can I somehow call the item ID into that print, you think? So I can see what item that causes the warning?
 
Last edited:
Oh crap, thats right.

So I found this:

Line 1262
Lua:
bool Monsters::loadLootItem(const pugi::xml_node& node, LootBlock& lootBlock)
{
    pugi::xml_attribute attr;
    if ((attr = node.attribute("id"))) {
        lootBlock.id = pugi::cast<int32_t>(attr.value());
    } else if ((attr = node.attribute("name"))) {
        auto name = attr.as_string();
        auto ids = Item::items.nameToItems.equal_range(asLowerCaseString(name));

        if (ids.first == Item::items.nameToItems.cend()) {
            std::cout << "[Warning - Monsters::loadMonster] Unknown loot item \"" << name << "\". " << std::endl;
            return false;
        }

        uint32_t id = ids.first->second;

        if (std::next(ids.first) != ids.second) {
            std::cout << "[Warning - Monsters::loadMonster] Non-unique loot item \"" << name << "\". " << std::endl;
            return false;
        }

        lootBlock.id = id;
    }

    if (lootBlock.id == 0) {
        return false;
    }


and I replaced it with:
Code:
bool Monsters::loadLootItem(const pugi::xml_node& node, LootBlock& lootBlock)
{
    pugi::xml_attribute attr;
    if ((attr = node.attribute("id"))) {
        int32_t id = pugi::cast<int32_t>(attr.value());
        const ItemType& it = Item::items.getItemType(id);

        if (it.name.empty()) {
            std::cout << "[Warning - Monsters::loadMonster] Unknown loot item id \"" << id << "\". " << std::endl;
            return false;
        }

        lootBlock.id = id;

    } else if ((attr = node.attribute("name"))) {
        auto name = attr.as_string();
        auto ids = Item::items.nameToItems.equal_range(asLowerCaseString(name));

        if (ids.first == Item::items.nameToItems.cend()) {
            std::cout << "[Warning - Monsters::loadMonster] Unknown loot item \"" << name << "\". " << std::endl;
            return false;
        }

        uint32_t id = ids.first->second;

        if (std::next(ids.first) != ids.second) {
            std::cout << "[Warning - Monsters::loadMonster] Non-unique loot item \"" << name << "\". " << std::endl;
            return false;
        }

        lootBlock.id = id;
    }

    if (lootBlock.id == 0) {
        return false;
    }

And did a re-compile and tried but to no sucess unfortunately

EDIT:
Ok, the first code here that @arcies gave me seems to work for me, after killing 200-300 vampires the Warning message dsnt seem to pop up anymore.

Credits @arcies

events/monster.lua
Try it and let me know.

1. Comment the current content and replace it with new one. Now you will have the post-trip location shown. Check if it works properly.

monster.lua

Lua:
if not item then
                --print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
                print(corpse:getContentDescription() .. " - ERROR - Position: " .. string.format("(%0.5d, %0.5d, %0.2d)", corpse:getPosition().x, corpse:getPosition().y, corpse:getPosition().z))
            end
        end
2. Next step, try to upload a new line showing the location and name of the item
Lua:
print(item:getDescription() .. " - ERROR - Position: " .. string.format("(%0.5d, %0.5d, %0.2d)", corpse:getPosition().x, corpse:getPosition().y, corpse:getPosition().z))

Or this line:
Lua:
print(item:getName() .. " - ERROR - Position: " .. string.format("(%0.5d, %0.5d, %0.2d)", corpse:getPosition().x, corpse:getPosition().y, corpse:getPosition().z))
 
Last edited:
No, but I suspect it was this line
Code:
<item id="2229" chance="1000" /><!-- skull -->
which should be instead
Code:
<item name="skull" chance="1000" /><!-- skull -->

Broken Vampire.xml file, causing the error:
Lua:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Vampire" nameDescription="a vampire" race="blood" experience="305" speed="220">
    <health now="475" max="475" />
    <look type="68" corpse="6006" />
    <targetchange interval="4000" chance="10" />
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="1" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="1" />
        <flag targetdistance="1" />
        <flag staticattack="90" />
        <flag runonhealth="30" />
        <flag canwalkonenergy="0" />
        <flag canwalkonfire="0" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-150" />
        <attack name="lifedrain" interval="2000" chance="20" target="1" range="1" min="-50" max="-200">
            <attribute key="areaEffect" value="smallclouds" />
        </attack>
        <attack name="speed" interval="2000" chance="15" range="1" target="1" speedchange="-400" duration="60000">
            <attribute key="areaEffect" value="redshimmer" />
        </attack>
    </attacks>
    <defenses armor="30" defense="30">
        <defense name="outfit" interval="4000" chance="10" monster="bat" duration="5000">
            <attribute key="areaEffect" value="groundshaker" />
        </defense>
        <defense name="speed" interval="2000" chance="15" speedchange="300" duration="3000">
            <attribute key="areaEffect" value="redshimmer" />
        </defense>
        <defense name="healing" interval="2000" chance="15" min="15" max="25" />
    </defenses>
    <elements>
        <element physicalPercent="35" />
        <element firePercent="-10" />
        <element holyPercent="-25" />
    </elements>
    <immunities>
        <immunity lifedrain="1" />
        <immunity paralyze="1" />
        <immunity invisible="1" />
        <immunity earth="1" />
        <immunity death="1" />
        <immunity drown="1" />
        <immunity drunk="1" />
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="BLOOD!" yell="1" />
        <voice sentence="Let me kiss your neck" />
        <voice sentence="I smell warm blood!" />
        <voice sentence="I call you, my bats! Come!" />
    </voices>
    <loot>
        <item name="emerald bangle" chance="230" />
        <item name="black pearl" chance="1800" />
        <item name="gold coin" countmax="60" chance="90230" />
        <item name="bronze amulet" chance="220" />
        <item id="2229" chance="1000" /><!-- skull -->
        <item name="spike sword" chance="1000" />
        <item name="ice rapier" chance="420" />
        <item name="katana" chance="1560" />
        <item name="strange helmet" chance="420" />
        <item name="vampire shield" chance="230" />
        <item name="grave flower" chance="1910" />
        <item name="strong health potion" chance="1500" />
        <item name="vampire teeth" chance="7600" />
        <item name="blood preservation" chance="5100" />
        <item name="blood preservation" chance="5100" />
    </loot>
</monster>


Working vampire.xml not causing the error to show up:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Vampire" nameDescription="a vampire" race="blood" experience="305" speed="220">
    <health now="475" max="475" />
    <look type="68" corpse="6006" />
    <targetchange interval="4000" chance="10" />
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="1" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="1" />
        <flag targetdistance="1" />
        <flag staticattack="90" />
        <flag runonhealth="30" />
        <flag canwalkonenergy="0" />
        <flag canwalkonfire="0" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-150" />
        <attack name="lifedrain" interval="2000" chance="20" target="1" range="1" min="-50" max="-200">
            <attribute key="areaEffect" value="smallclouds" />
        </attack>
        <attack name="speed" interval="2000" chance="15" range="1" target="1" speedchange="-400" duration="60000">
            <attribute key="areaEffect" value="redshimmer" />
        </attack>
    </attacks>
    <defenses armor="30" defense="30">
        <defense name="outfit" interval="4000" chance="10" monster="bat" duration="5000">
            <attribute key="areaEffect" value="groundshaker" />
        </defense>
        <defense name="speed" interval="2000" chance="15" speedchange="300" duration="3000">
            <attribute key="areaEffect" value="redshimmer" />
        </defense>
        <defense name="healing" interval="2000" chance="15" min="15" max="25" />
    </defenses>
    <elements>
        <element physicalPercent="35" />
        <element firePercent="-10" />
        <element holyPercent="-25" />
    </elements>
    <immunities>
        <immunity lifedrain="1" />
        <immunity paralyze="1" />
        <immunity invisible="1" />
        <immunity earth="1" />
        <immunity death="1" />
        <immunity drown="1" />
        <immunity drunk="1" />
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="BLOOD!" yell="1" />
        <voice sentence="Let me kiss your neck" />
        <voice sentence="I smell warm blood!" />
        <voice sentence="I call you, my bats! Come!" />
    </voices>
    <loot>
        <item name="emerald bangle" chance="230" />
        <item name="black pearl" chance="1800" />
        <item name="gold coin" countmax="60" chance="90230" />
        <item name="bronze amulet" chance="220" />
        <item name="spike sword" chance="1000" />
        <item name="ice rapier" chance="420" />
        <item name="katana" chance="1560" />
        <item name="strange helmet" chance="420" />
        <item name="vampire shield" chance="230" />
        <item name="grave flower" chance="1910" />
        <item name="strong health potion" chance="1500" />
        <item name="vampire teeth" chance="7600" />
        <item name="blood preservation" chance="5100" />
    </loot>
</monster>
 
No, but I suspect it was this line
Code:
<item id="2229" chance="1000" /><!-- skull -->
which should be instead
Code:
<item name="skull" chance="1000" /><!-- skull -->

Broken Vampire.xml file, causing the error:
Lua:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Vampire" nameDescription="a vampire" race="blood" experience="305" speed="220">
    <health now="475" max="475" />
    <look type="68" corpse="6006" />
    <targetchange interval="4000" chance="10" />
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="1" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="1" />
        <flag targetdistance="1" />
        <flag staticattack="90" />
        <flag runonhealth="30" />
        <flag canwalkonenergy="0" />
        <flag canwalkonfire="0" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-150" />
        <attack name="lifedrain" interval="2000" chance="20" target="1" range="1" min="-50" max="-200">
            <attribute key="areaEffect" value="smallclouds" />
        </attack>
        <attack name="speed" interval="2000" chance="15" range="1" target="1" speedchange="-400" duration="60000">
            <attribute key="areaEffect" value="redshimmer" />
        </attack>
    </attacks>
    <defenses armor="30" defense="30">
        <defense name="outfit" interval="4000" chance="10" monster="bat" duration="5000">
            <attribute key="areaEffect" value="groundshaker" />
        </defense>
        <defense name="speed" interval="2000" chance="15" speedchange="300" duration="3000">
            <attribute key="areaEffect" value="redshimmer" />
        </defense>
        <defense name="healing" interval="2000" chance="15" min="15" max="25" />
    </defenses>
    <elements>
        <element physicalPercent="35" />
        <element firePercent="-10" />
        <element holyPercent="-25" />
    </elements>
    <immunities>
        <immunity lifedrain="1" />
        <immunity paralyze="1" />
        <immunity invisible="1" />
        <immunity earth="1" />
        <immunity death="1" />
        <immunity drown="1" />
        <immunity drunk="1" />
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="BLOOD!" yell="1" />
        <voice sentence="Let me kiss your neck" />
        <voice sentence="I smell warm blood!" />
        <voice sentence="I call you, my bats! Come!" />
    </voices>
    <loot>
        <item name="emerald bangle" chance="230" />
        <item name="black pearl" chance="1800" />
        <item name="gold coin" countmax="60" chance="90230" />
        <item name="bronze amulet" chance="220" />
        <item id="2229" chance="1000" /><!-- skull -->
        <item name="spike sword" chance="1000" />
        <item name="ice rapier" chance="420" />
        <item name="katana" chance="1560" />
        <item name="strange helmet" chance="420" />
        <item name="vampire shield" chance="230" />
        <item name="grave flower" chance="1910" />
        <item name="strong health potion" chance="1500" />
        <item name="vampire teeth" chance="7600" />
        <item name="blood preservation" chance="5100" />
        <item name="blood preservation" chance="5100" />
    </loot>
</monster>


Working vampire.xml not causing the error to show up:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Vampire" nameDescription="a vampire" race="blood" experience="305" speed="220">
    <health now="475" max="475" />
    <look type="68" corpse="6006" />
    <targetchange interval="4000" chance="10" />
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="1" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="1" />
        <flag targetdistance="1" />
        <flag staticattack="90" />
        <flag runonhealth="30" />
        <flag canwalkonenergy="0" />
        <flag canwalkonfire="0" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-150" />
        <attack name="lifedrain" interval="2000" chance="20" target="1" range="1" min="-50" max="-200">
            <attribute key="areaEffect" value="smallclouds" />
        </attack>
        <attack name="speed" interval="2000" chance="15" range="1" target="1" speedchange="-400" duration="60000">
            <attribute key="areaEffect" value="redshimmer" />
        </attack>
    </attacks>
    <defenses armor="30" defense="30">
        <defense name="outfit" interval="4000" chance="10" monster="bat" duration="5000">
            <attribute key="areaEffect" value="groundshaker" />
        </defense>
        <defense name="speed" interval="2000" chance="15" speedchange="300" duration="3000">
            <attribute key="areaEffect" value="redshimmer" />
        </defense>
        <defense name="healing" interval="2000" chance="15" min="15" max="25" />
    </defenses>
    <elements>
        <element physicalPercent="35" />
        <element firePercent="-10" />
        <element holyPercent="-25" />
    </elements>
    <immunities>
        <immunity lifedrain="1" />
        <immunity paralyze="1" />
        <immunity invisible="1" />
        <immunity earth="1" />
        <immunity death="1" />
        <immunity drown="1" />
        <immunity drunk="1" />
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="BLOOD!" yell="1" />
        <voice sentence="Let me kiss your neck" />
        <voice sentence="I smell warm blood!" />
        <voice sentence="I call you, my bats! Come!" />
    </voices>
    <loot>
        <item name="emerald bangle" chance="230" />
        <item name="black pearl" chance="1800" />
        <item name="gold coin" countmax="60" chance="90230" />
        <item name="bronze amulet" chance="220" />
        <item name="spike sword" chance="1000" />
        <item name="ice rapier" chance="420" />
        <item name="katana" chance="1560" />
        <item name="strange helmet" chance="420" />
        <item name="vampire shield" chance="230" />
        <item name="grave flower" chance="1910" />
        <item name="strong health potion" chance="1500" />
        <item name="vampire teeth" chance="7600" />
        <item name="blood preservation" chance="5100" />
    </loot>
</monster>

It could be the comment <!-- skull --> in the item loot causing the error, you should remove those lines from all your monsters files.
 
It could be the comment <!-- skull --> in the item loot causing the error, you should remove those lines from all your monsters files.
Interesting, but sometimes the loot drops, sometimes not. So i don't think is this.



this message is sent when the engine can't create the loot on the monster corpse, this can be because of several reasons, like:

  • invalid monster corpse
  • invalid loot item id/name
etc

you guys might want to add some checks/warnings like these to know about any irregularity in your loot block

This can be applied to the case that sometimes the drop is normal and sometimes the monsters don't drop anything?
 
No, but I suspect it was this line
Code:
<item id="2229" chance="1000" /><!-- skull -->
which should be instead
Code:
<item name="skull" chance="1000" /><!-- skull -->

Broken Vampire.xml file, causing the error:
Lua:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Vampire" nameDescription="a vampire" race="blood" experience="305" speed="220">
    <health now="475" max="475" />
    <look type="68" corpse="6006" />
    <targetchange interval="4000" chance="10" />
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="1" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="1" />
        <flag targetdistance="1" />
        <flag staticattack="90" />
        <flag runonhealth="30" />
        <flag canwalkonenergy="0" />
        <flag canwalkonfire="0" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-150" />
        <attack name="lifedrain" interval="2000" chance="20" target="1" range="1" min="-50" max="-200">
            <attribute key="areaEffect" value="smallclouds" />
        </attack>
        <attack name="speed" interval="2000" chance="15" range="1" target="1" speedchange="-400" duration="60000">
            <attribute key="areaEffect" value="redshimmer" />
        </attack>
    </attacks>
    <defenses armor="30" defense="30">
        <defense name="outfit" interval="4000" chance="10" monster="bat" duration="5000">
            <attribute key="areaEffect" value="groundshaker" />
        </defense>
        <defense name="speed" interval="2000" chance="15" speedchange="300" duration="3000">
            <attribute key="areaEffect" value="redshimmer" />
        </defense>
        <defense name="healing" interval="2000" chance="15" min="15" max="25" />
    </defenses>
    <elements>
        <element physicalPercent="35" />
        <element firePercent="-10" />
        <element holyPercent="-25" />
    </elements>
    <immunities>
        <immunity lifedrain="1" />
        <immunity paralyze="1" />
        <immunity invisible="1" />
        <immunity earth="1" />
        <immunity death="1" />
        <immunity drown="1" />
        <immunity drunk="1" />
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="BLOOD!" yell="1" />
        <voice sentence="Let me kiss your neck" />
        <voice sentence="I smell warm blood!" />
        <voice sentence="I call you, my bats! Come!" />
    </voices>
    <loot>
        <item name="emerald bangle" chance="230" />
        <item name="black pearl" chance="1800" />
        <item name="gold coin" countmax="60" chance="90230" />
        <item name="bronze amulet" chance="220" />
        <item id="2229" chance="1000" /><!-- skull -->
        <item name="spike sword" chance="1000" />
        <item name="ice rapier" chance="420" />
        <item name="katana" chance="1560" />
        <item name="strange helmet" chance="420" />
        <item name="vampire shield" chance="230" />
        <item name="grave flower" chance="1910" />
        <item name="strong health potion" chance="1500" />
        <item name="vampire teeth" chance="7600" />
        <item name="blood preservation" chance="5100" />
        <item name="blood preservation" chance="5100" />
    </loot>
</monster>


Working vampire.xml not causing the error to show up:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Vampire" nameDescription="a vampire" race="blood" experience="305" speed="220">
    <health now="475" max="475" />
    <look type="68" corpse="6006" />
    <targetchange interval="4000" chance="10" />
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="1" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="1" />
        <flag targetdistance="1" />
        <flag staticattack="90" />
        <flag runonhealth="30" />
        <flag canwalkonenergy="0" />
        <flag canwalkonfire="0" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-150" />
        <attack name="lifedrain" interval="2000" chance="20" target="1" range="1" min="-50" max="-200">
            <attribute key="areaEffect" value="smallclouds" />
        </attack>
        <attack name="speed" interval="2000" chance="15" range="1" target="1" speedchange="-400" duration="60000">
            <attribute key="areaEffect" value="redshimmer" />
        </attack>
    </attacks>
    <defenses armor="30" defense="30">
        <defense name="outfit" interval="4000" chance="10" monster="bat" duration="5000">
            <attribute key="areaEffect" value="groundshaker" />
        </defense>
        <defense name="speed" interval="2000" chance="15" speedchange="300" duration="3000">
            <attribute key="areaEffect" value="redshimmer" />
        </defense>
        <defense name="healing" interval="2000" chance="15" min="15" max="25" />
    </defenses>
    <elements>
        <element physicalPercent="35" />
        <element firePercent="-10" />
        <element holyPercent="-25" />
    </elements>
    <immunities>
        <immunity lifedrain="1" />
        <immunity paralyze="1" />
        <immunity invisible="1" />
        <immunity earth="1" />
        <immunity death="1" />
        <immunity drown="1" />
        <immunity drunk="1" />
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="BLOOD!" yell="1" />
        <voice sentence="Let me kiss your neck" />
        <voice sentence="I smell warm blood!" />
        <voice sentence="I call you, my bats! Come!" />
    </voices>
    <loot>
        <item name="emerald bangle" chance="230" />
        <item name="black pearl" chance="1800" />
        <item name="gold coin" countmax="60" chance="90230" />
        <item name="bronze amulet" chance="220" />
        <item name="spike sword" chance="1000" />
        <item name="ice rapier" chance="420" />
        <item name="katana" chance="1560" />
        <item name="strange helmet" chance="420" />
        <item name="vampire shield" chance="230" />
        <item name="grave flower" chance="1910" />
        <item name="strong health potion" chance="1500" />
        <item name="vampire teeth" chance="7600" />
        <item name="blood preservation" chance="5100" />
    </loot>
</monster>

one have 2 blood preservation and the other one don't 🤔

This can be applied to the case that sometimes the drop is normal and sometimes the monsters don't drop anything?

maybe related to the chance of the loot... btw need to take a look at the reward chest script since it doesn't seem to be a bug with tfs code but with it
 
Ok,


Got update for you, now I get the error when killing serpent spawns and I cant really figure out why
Lua:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Serpent Spawn" nameDescription="a serpent spawn" race="venom" experience="3050" speed="250">
    <health now="3000" max="3000" />
    <look type="220" corpse="6061" />
    <targetchange interval="4000" chance="10" />
    <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="1" />
        <flag staticattack="80" />
        <flag runonhealth="275" />
        <flag canwalkonenergy="0" />
        <flag canwalkonfire="0" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-252" />
        <attack name="earth" interval="2000" chance="20" range="7" min="-80" max="-300">
            <attribute key="shootEffect" value="poison" />
        </attack>
        <attack name="outfit" interval="2000" chance="1" range="7" item="3976" duration="3000">
            <attribute key="areaEffect" value="blueshimmer" />
        </attack>
        <attack name="speed" interval="2000" chance="25" range="7" target="1" radius="4" speedchange="-850" duration="12000">
            <attribute key="shootEffect" value="poison" />
            <attribute key="areaEffect" value="greenbubble" />
        </attack>
        <attack name="lifedrain" interval="2000" chance="10" length="8" spread="0" min="-200" max="-500">
            <attribute key="areaEffect" value="rednote" />
        </attack>
        <attack name="earth" interval="2000" chance="10" length="8" spread="3" min="-200" max="-500">
            <attribute key="areaEffect" value="poison" />
        </attack>
    </attacks>
    <defenses armor="35" defense="35">
        <defense name="healing" interval="2000" chance="15" min="250" max="500">
            <attribute key="areaEffect" value="blueshimmer" />
        </defense>
        <defense name="speed" interval="2000" chance="15" speedchange="340" duration="5000">
            <attribute key="areaEffect" value="redshimmer" />
        </defense>
    </defenses>
    <elements>
        <element icePercent="20" />
        <element firePercent="-10" />
        <element energyPercent="-10" />
    </elements>
    <immunities>
        <immunity earth="1" />
        <immunity paralyze="1" />
        <immunity invisible="1" />
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="Sssssouls for the one" />
        <voice sentence="HISSSS" yell="1" />
        <voice sentence="Tsssse one will risssse again" />
        <voice sentence="I bring your deathhh, mortalssss" />
    </voices>
    <loot>
        <item name="golden mug" chance="2870" />
        <item name="small sapphire" chance="12000" />
        <item name="gold coin" countmax="100" chance="32300" />
        <item name="gold coin" countmax="100" chance="32300" />
        <item name="energy ring" chance="590" />
        <item name="life ring" chance="6250" />
        <item name="life crystal" chance="800" />
        <item name="snakebite rod" chance="930" />
        <item name="warrior helmet" chance="560" />
        <item name="strange helmet" chance="670" />
        <item name="crown armor" chance="510" />
        <item name="royal helmet" chance="140" />
        <item name="tower shield" chance="920" />
        <item name="power bolt" chance="6200" />
        <item name="green mushroom" chance="18200" />
        <item name="charmer's tiara" chance="180" />
        <item name="mercenary sword" chance="2070" />
        <item name="noble axe" chance="750" />
        <item name="great mana potion" chance="2000" />
        <item name="swamplair armor" chance="90" />
        <item name="spellbook of mind control" chance="90" />
        <item name="winged tail" chance="960" />
    </loot>
</monster>


with arcies script
Capture.PNG

Lua:
print(corpse:getContentDescription() .. " - ERROR - Position: " .. string.format("(%0.5d, %0.5d, %0.2d)", corpse:getPosition().x, corpse:getPosition().y, corpse:getPosition().z))
 
Last edited:
@Cloow
Try to replace the start of the script. The two suggestions you received above.
With:
Lua:
corpse: getContentDescription ()
On:
Code:
item: getDescription ()
or:
Lua:
item: getName ()
This should help you determine which item the problem is with. Increase your loot chance to cause the bug faster
Post automatically merged:

One more thing that comes to mind is the "Nothing" you got on the console. This means you do not have the "corpse" monster entered
 
Thank you everyone for putting your effort into this issue, I just came from reading this thread and just want you guys to know I really appreciate your help and that I hopefully can do something in return in the future, I just came back to this glorious community from a break I took 6 years ago or so lol.


Anyhow, back to the issue.
@arcies I tried replacing the script with both these functions but unfortunately gives me error codes.

Lua:
print(item:getDescription() .. " - ERROR - Position: " .. string.format("(%0.5d, %0.5d, %0.2d)", corpse:getPosition().x, corpse:getPosition().y, corpse:getPosition().z))
capture1.PNG
//on startup

Lua:
print(item:getName() .. " - ERROR - Position: " .. string.format("(%0.5d, %0.5d, %0.2d)", corpse:getPosition().x, corpse:getPosition().y, corpse:getPosition().z))
Capture2.PNG
//when killing serpent spawn



I can't see anything wrong with the corpse

items.xml
Lua:
<item id="6061" article="a" name="dead serpent spawn">
   <attribute key="containerSize" value="15" />
   <attribute key="decayTo" value="4323" />
   <attribute key="duration" value="10" />
   <attribute key="corpseType" value="blood" />
   <attribute key="fluidSource" value="blood" />
</item>
<item id="4323" article="a" name="dead serpent spawn">
   <attribute key="containerSize" value="15" />
   <attribute key="decayTo" value="4324" />
   <attribute key="duration" value="900" />
   <attribute key="corpseType" value="blood" />
   <attribute key="fluidSource" value="blood" />
</item>
<item id="4324" article="a" name="dead serpent spawn">
   <attribute key="containerSize" value="15" />
   <attribute key="decayTo" value="4325" />
   <attribute key="duration" value="600" />
   <attribute key="corpseType" value="blood" />
</item>
<item id="4325" article="a" name="dead serpent spawn">
   <attribute key="decayTo" value="0" />
   <attribute key="duration" value="600" />
   <attribute key="corpseType" value="blood" />
</item>
Capture5.PNG
 

Attachments

Last edited:
Ok then go back to the previous message that worked.

Be sure if the corpse ID of the monster has an attribute added, for example:
<attribute key = "corpseType" value = "blood" />

in items.xml
 
Okey, with help from @arcies we finally found what item that was causing the error, golden mug.. and weirdly enough nothing seems wrong with it, I spawned it in with admin command and everything works as intended.. So I have no idea what's the deal with just golden mug in loot list. But I guess i'll just remove it from loot list for now.

I've tried changing the name and removing the "pickupable" attribute from it in items.xml but nothing changes
items.xml
Lua:
    <item id="2033" article="a" name="golden mug">
        <attribute key="weight" value="470" />
        <attribute key="pickupable" value="1" />
    </item>

EDIT: Ok theres is smth wrong with golden mug, I didn't notice it at first but I can't actually pick it up. I can push it and fill it with water etc but not drag it into my backpack.

I occur the same problem for items that are the same as golden mug, for example bowl. I think the attribute
Lua:
<attribute key="pickupable" value="1" />
is broken and thats a source edit right?

container.cpp line 246
Lua:
    if (!item->isPickupable()) {
        return RETURNVALUE_CANNOTPICKUP;
    }

This line seems weird, I dont know C but shouldnt it be like !item~=isPickupable?

items.gif
 
Last edited:
Back
Top