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

AutoLoot System for tfs 1.x

all the loot always goes to the main backpack would have to do for example choose the backpack by name or item goes to the backpack that already has the item
 
all the loot always goes to the main backpack would have to do for example choose the backpack by name or item goes to the backpack that already has the item
You are free to edit the code, however you want :)
 
I'm trying to get this to work. Copy/pasted everything in to their respective place but it wont work. I can get all commands etc to work (add,remove,show,clear) but the looting wont work. :(

same issue.
 
2lwamis.png
 
I edit script. Add gold to balance Bank if PACC send +10% more GOLD!!!
Lua:
local function scanContainer(cid, position)
    local player = Player(cid)
    if not player then
        return
    end
    local corpse = Tile(position):getTopDownItem()
    if not corpse or not corpse:isContainer() then
        return
    end
    if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
        for a = corpse:getSize() - 1, 0, -1 do
            local containerItem = corpse:getItem(a)
            if containerItem then
                for b = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
                    if player:getStorageValue(b) == containerItem:getId() then
                        containerItem:moveTo(player)
                    end
                end
        if player:isPremium() then
                if isItemStackable(containerItem:getId()) then

                    if containerItem:getId() == 2148 then
                        containerItem:remove()
                        doPlayerSetBalance(player, (getPlayerBalance(player) + containerItem:getCount()) * 1.1)
                    end
                    if containerItem:getId() == 2152 then
                        containerItem:remove()
                        doPlayerSetBalance(player, (getPlayerBalance(player) + (containerItem:getCount() * 100) * 1.1))
                    end
                    if containerItem:getId() == 2160 then
                        containerItem:remove()
                        doPlayerSetBalance(player, (getPlayerBalance(player) + (containerItem:getCount() * 1000) * 1.1))
                    end
            end
        end
       
        if not player:isPremium() then
                if isItemStackable(containerItem:getId()) then

                    if containerItem:getId() == 2148 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + containerItem:getCount())
                    end
                    if containerItem:getId() == 2152 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 100))
                    end
                    if containerItem:getId() == 2160 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1000))
                    end
            end
        end
           
           
           
           
        end
    end
end
end
function onKill(player, target)
    if not target:isMonster() then
        return true
    end
    addEvent(scanContainer, 100, player:getId(), target:getPosition())
    return true
end
 
SORRY WRONG SCRIPT :D Now is correct! i ADD MEssade LooT!
Lua:
local function scanContainer(cid, position)
    local player = Player(cid)
    if not player then
        return
    end
    local corpse = Tile(position):getTopDownItem()
    if not corpse or not corpse:isContainer() then
        return
    end
    if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
        for a = corpse:getSize() - 1, 0, -1 do
            local containerItem = corpse:getItem(a)
            if containerItem then
                for b = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
                    if player:getStorageValue(b) == containerItem:getId() then
                        containerItem:moveTo(player)
                    end
                end
        if player:isPremium() then
                if isItemStackable(containerItem:getId()) then
                                        local g = containerItem:getCount()
                                        local g2 = containerItem:getCount() * 1.1 / 10
                                        local g3 = containerItem:getCount()
                                        local g4 = (containerItem:getCount() * 100) * 1.1 / 10
                                        local g5 = containerItem:getCount()
                                        local g6 = (containerItem:getCount() * 1000) * 1.1 / 10

                    if containerItem:getId() == 2148 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1.1))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Gold Coins: "..g.."(+"..g2..").")

                    end
                    if containerItem:getId() == 2152 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + ((containerItem:getCount() * 100) * 1.1))
                        player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Platinum Coins: "..g3.."(+"..g4.."Gold Coin).")


                    end
                    if containerItem:getId() == 2160 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + ((containerItem:getCount() * 1000) * 1.1))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Crystal Coins: "..g5.."(+"..g6.."Gold Coin).")


                    end
            end
        end
       
        if not player:isPremium() then
                if isItemStackable(containerItem:getId()) then

                    if containerItem:getId() == 2148 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + containerItem:getCount())
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Gold Coins: "..g.."(+0).")
                    end
                    if containerItem:getId() == 2152 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 100))
                        player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Platinum Coins: "..g3.."(+0).")
                    end
                    if containerItem:getId() == 2160 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1000))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Crystal Coins: "..g5.."(+0).")
                    end
            end
        end
           
           
           
           
        end
    end
end
end
function onKill(player, target)
    if not target:isMonster() then
        return true
    end
    addEvent(scanContainer, 100, player:getId(), target:getPosition())
    return true
end
 
Hey @psychonaut i have sent a few feedback trough discord if you could take a look ;)

I have added a item which allows you to loot other items trough modal window, no commands.

Also I have added a option to loot automatically items which have a price over a established price.

31306779_10156435443160555_7766027669828796416_n.jpg


All items are going to a loot bag:
31275722_10156435443200555_1517232257130037248_n.jpg


My players are loving it. It took so much effort and a few money invest in order to make it perfect.

I leave this idea here cause someone else might need it.

PS: It works on client 10 and 11.
 
SORRY WRONG SCRIPT :D Now is correct! i ADD MEssade LooT!

Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/autoloot.lua:57: attempt to concatenate global 'g' (a nil value)
stack traceback:
        [C]: in function '__concat'
        data/creaturescripts/scripts/autoloot.lua:57: in function <data/c
reaturescripts/scripts/autoloot.lua:1>
 
I have added a item which allows you to loot other items trough modal window, no commands.

Also I have added a option to loot automatically items which have a price over a established price.

31306779_10156435443160555_7766027669828796416_n.jpg


All items are going to a loot bag:
31275722_10156435443200555_1517232257130037248_n.jpg


My players are loving it. It took so much effort and a few money invest in order to make it perfect.

I leave this idea here cause someone else might need it.

PS: It works on client 10 and 11.



if possible you add this script here ??
 
Is it possible to collect items inside bag?? how to do it?
 
Tfs 1.2. Added no errors but it doesn't pick loot from dead monsters
 
SORRY WRONG SCRIPT :D Now is correct! i ADD MEssade LooT!
Lua:
local function scanContainer(cid, position)
    local player = Player(cid)
    if not player then
        return
    end
    local corpse = Tile(position):getTopDownItem()
    if not corpse or not corpse:isContainer() then
        return
    end
    if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
        for a = corpse:getSize() - 1, 0, -1 do
            local containerItem = corpse:getItem(a)
            if containerItem then
                for b = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
                    if player:getStorageValue(b) == containerItem:getId() then
                        containerItem:moveTo(player)
                    end
                end
        if player:isPremium() then
                if isItemStackable(containerItem:getId()) then
                                        local g = containerItem:getCount()
                                        local g2 = containerItem:getCount() * 1.1 / 10
                                        local g3 = containerItem:getCount()
                                        local g4 = (containerItem:getCount() * 100) * 1.1 / 10
                                        local g5 = containerItem:getCount()
                                        local g6 = (containerItem:getCount() * 1000) * 1.1 / 10

                    if containerItem:getId() == 2148 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1.1))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Gold Coins: "..g.."(+"..g2..").")

                    end
                    if containerItem:getId() == 2152 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + ((containerItem:getCount() * 100) * 1.1))
                        player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Platinum Coins: "..g3.."(+"..g4.."Gold Coin).")


                    end
                    if containerItem:getId() == 2160 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + ((containerItem:getCount() * 1000) * 1.1))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Crystal Coins: "..g5.."(+"..g6.."Gold Coin).")


                    end
            end
        end
      
        if not player:isPremium() then
                if isItemStackable(containerItem:getId()) then

                    if containerItem:getId() == 2148 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + containerItem:getCount())
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Gold Coins: "..g.."(+0).")
                    end
                    if containerItem:getId() == 2152 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 100))
                        player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Platinum Coins: "..g3.."(+0).")
                    end
                    if containerItem:getId() == 2160 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1000))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Crystal Coins: "..g5.."(+0).")
                    end
            end
        end
          
          
          
          
        end
    end
end
end
function onKill(player, target)
    if not target:isMonster() then
        return true
    end
    addEvent(scanContainer, 100, player:getId(), target:getPosition())
    return true
end



Colocado para play free account TB.

Code:
local function scanContainer(cid, position)
    local player = Player(cid)
    if not player then
        return
    end
    local corpse = Tile(position):getTopDownItem()
    if not corpse or not corpse:isContainer() then
        return
    end
    if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
        for a = corpse:getSize() - 1, 0, -1 do
            local containerItem = corpse:getItem(a)
            if containerItem then
                for b = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
                    if player:getStorageValue(b) == containerItem:getId() then
                        containerItem:moveTo(player)
                    end
                end
        if player then
                if isItemStackable(containerItem:getId()) then
                                        local g = containerItem:getCount()
                                        local g2 = containerItem:getCount() * 1.1 / 10
                                        local g3 = containerItem:getCount()
                                        local g4 = (containerItem:getCount() * 100) * 1.1 / 10
                                        local g5 = containerItem:getCount()
                                        local g6 = (containerItem:getCount() * 1000) * 1.1 / 10

                    if containerItem:getId() == 2148 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1.1))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Gold Coins: "..g.."(+"..g2..").")

                    end
                    if containerItem:getId() == 2152 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + ((containerItem:getCount() * 100) * 1.1))
                        player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Platinum Coins: "..g3.."(+"..g4.."Gold Coin).")


                    end
                    if containerItem:getId() == 2160 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + ((containerItem:getCount() * 1000) * 1.1))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Crystal Coins: "..g5.."(+"..g6.."Gold Coin).")


                    end
            end
        end
      
        if not player then
                if isItemStackable(containerItem:getId()) then

                    if containerItem:getId() == 2148 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + containerItem:getCount())
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Gold Coins: "..g.."(+0).")
                    end
                    if containerItem:getId() == 2152 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 100))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Platinum Coins: "..g3.."(+0).")
                    end
                    if containerItem:getId() == 2160 then
                        containerItem:remove()
                        doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1000))
                    player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Crystal Coins: "..g5.."(+0).")
                    end
            end
        end
          
          
          
          
        end
    end
end
end
function onKill(player, target)
    if not target:isMonster() then
        return true
    end
    addEvent(scanContainer, 100, player:getId(), target:getPosition())
    return true
end
 
work well, thanks for share such a great system.
one thing tho.


i got this error even tho its work perfectly.

Lua Script Error: [TalkAction Interface]
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/autoloot.lua:eek:nSay
data/talkactions/scripts/autoloot.lua:6: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/talkactions/scripts/autoloot.lua:6: in function <data/talkactions/scripts/autoloot.lua:1>

how do i fix or silance this?
i don't want this to spam my server log console, :3

details before the bug.
all i did was "!autoloot add, gold coin" and killed few monsters to see if its work.

PS: @vine96 ye, this work on tfs 1.2, (protocol 10.98).
 
Back
Top