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

Bad argument at droploot.lua

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,528
Solutions
27
Reaction score
871
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Sup guys! Maybe this is really simple and i'm just missing it. Why is this caused? I'm dying with a level 8 with automatic blessings (due the low level) and this is triggered. Using TFS 1.5 downgrades 8.6.

1712891190138.png


Here's my droploot.lua script:
Lua:
function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end
 
    local protectedPlayer = false
    local level = player:getLevel()
    for k, v in pairs(GLOBAL_protectedPlayerRanges) do
        if level <= k[2] and level >= k[1] then
            if not v.dropLoot then
                protectedPlayer = true
            end
            break
        end
    end

    if not protectedPlayer then
        local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
        local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
        if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not isRedOrBlack then
            local isPlayer = false
            if killer then
                if killer:isPlayer() then
                    isPlayer = true
                else
                    local master = killer:getMaster()
                    if master and master:isPlayer() then
                        isPlayer = true
                    end
                end
            end
 
            if not isPlayer or not player:hasBlessing(6) then
                player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
            end
        else
            for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
                local item = player:getSlotItem(i)
                local lossPercent = player:getLossPercent()
                if item then
                    if isRedOrBlack or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
                        if (isRedOrBlack or lossPercent ~= 0) and not item:moveTo(corpse) then
                            item:remove()
                        end
                    end
                end
            end
        end
    end

    if not player:getSlotItem(CONST_SLOT_BACKPACK) then
        player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
    end
    return true
end

Thanks in advance!
 
Back
Top