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

Open Corpose For Autoloot

igorlabanca

New Member
Joined
Aug 15, 2010
Messages
36
Reaction score
3
I have this autoloot script, but it is pulling the loot straight to bp, without opening the corpose. How do I get the loot only when opening the corpose?
Help pls :s


Creaturescript
Lua:
local function scanContainer(cid, container)
    local player = Player(cid)
    if not player then
        return false
    end

    local containerItensCount = container:getItemHoldingCount()
    if containerItensCount <= 0 then
        return true
    end
    for i = 1, containerItensCount do
        local containerItem = container:getItem(i - 1)
        if containerItem then
            if containerItem:isContainer() then
                scanContainer(cid, containerItem)
            else
                for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
                    if player:getStorageValue(i) == containerItem:getId() then
                        containerItem:moveTo(player)
                    end
                end
            end
        end
    end
    return true
end

local function autoLoot(pos, cid)
    local c = Tile(pos):getTopDownItem()
    if c ~= nil then
        if c:isContainer() then
            if c:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then --GOD ACCOUNT DON'T GOT CORPSEOWNER VALUE WHEN KILL A MONSTER
                scanContainer(cid, c)
            end
        end   
    end
end

function onKill(player, target)
    if not target:isMonster() then
        return true
    end
    
    addEvent(autoLoot, 2, target:getPosition(), player:getId())
    return true
end


Would it be for a right action? but how do I put this script in the action on the monster's corpose.


Thanks
 
This autoloot implementation move items to player on corpse opening. You might wanna check it out ;)
 
Back
Top