• 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+ Events

Blez

eh..
Joined
Dec 21, 2010
Messages
3,045
Reaction score
738
Location
Hell, Caymen Islands
Monsters are not seeming to drop any loot, no matter what i change the loot rate to.
Code:
function Monster:onDropLoot(corpse)
    if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
        return
        end
    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_LOOT, 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_LOOT, text)
        end
    end
end
 
Solution
The issue was duplicated className check in events.cpp. It loaded only onSpawn event because it was first in the line and it never fall to the last check with onDropLoot. The solution was to just remove the first check. He added it by accident probably.
in case you're using a god character edit XML/groups.xml
XML:
<flag notgenerateloot="1" />
to:
XML:
<flag notgenerateloot="0" />
 
in case you're using a god character edit XML/groups.xml
XML:
<flag notgenerateloot="1" />
to:
XML:
<flag notgenerateloot="0" />
Players dont receive loot, my god/gms do not attack monsters.
Post automatically merged:

and just in case, are you using the OnSpawn modification by delusion?
I checked the sources and yeah i do its being used.
it was a fresh install of tfs 1.3
 
Last edited:
you need to apply this fix
Code:
    } else if (className == "Monster") {
            if (methodName == "onDropLoot") {
                info.monsterOnDropLoot = event;
            } else if (methodName == "onSpawn") {
                info.monsterOnSpawn = event;
            } else {
                std::cout << "[Warning - Events::load] Unknown monster method: " << methodName << std::endl;
            }
        } else {
            std::cout << "[Warning - Events::load] Unknown class: " << className << std::endl;
        }
    }
    return true;
}
In events.cpp and still nothing. Wanna add me to discord? Elo#2576
 
The issue was duplicated className check in events.cpp. It loaded only onSpawn event because it was first in the line and it never fall to the last check with onDropLoot. The solution was to just remove the first check. He added it by accident probably.
 
Solution
Back
Top