Lua How this loot bonus script works?

sucibob

Member
Joined
Mar 28, 2017
Messages
76
Best answers
0
Reaction score
1
I found this script who give a loot bonus when u kill some monster:

Lua:
function onDeath(cid, corpse, deathList)

    local master = getCreatureMaster(cid)
    if (master and master ~= cid) then
        return true
    end

    print("monster killed prey system")

    for i = 1, #deathList do
        -- loot bonus
        local lootList = getMonsterLootList(getCreatureName(cid))
        for i, _ in pairs(lootList) do
            if lootList[i].count > 1 then
                local numb = math.random(1, lootList[i].count)
                doAddContainerItem(corpse.uid, lootList[i].id, numb)
            elseif math.random(1,100000) <= lootList[i].chance then
                doAddContainerItem(corpse.uid, lootList[i].id, 1)
            end
        end
    end


    return true
end
But how the bonus actually works?

I would like to understand how it work to increase or decries the bonus, or even play with it
 
Last edited by a moderator:
Top