AutoLoot System for tfs 1.x

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by Printer, Oct 25, 2015.

  1. leandroluck

    leandroluck Member

    Joined:
    Dec 24, 2010
    Messages:
    97
    Likes Received:
    1
    Best Answers:
    0
    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
     
  2. Nekiro

    Nekiro worst coder Support Team

    Joined:
    Sep 7, 2015
    Messages:
    1,659
    Likes Received:
    509
    Best Answers:
    64
    You are free to edit the code, however you want :)
     
  3. leandroluck

    leandroluck Member

    Joined:
    Dec 24, 2010
    Messages:
    97
    Likes Received:
    1
    Best Answers:
    0
    I'm trying, it's not working.
    I asked why it is that someone has already done this or the creator of the topic has done some up :C
     
  4. athenso

    athenso Average Coder Premium User

    Joined:
    May 31, 2011
    Messages:
    121
    Likes Received:
    10
    Best Answers:
    1
    same issue.
     
  5. KearaOT

    KearaOT KearaOT Custom Mid/High Premium User

    Joined:
    Feb 4, 2018
    Messages:
    63
    Likes Received:
    12
    Best Answers:
    0
    good release
     
  6. leandroluck

    leandroluck Member

    Joined:
    Dec 24, 2010
    Messages:
    97
    Likes Received:
    1
    Best Answers:
    0
  7. vine96

    vine96 New Member

    Joined:
    Nov 17, 2012
    Messages:
    23
    Likes Received:
    1
    Best Answers:
    0
    work in tfs 1.2?
     
  8. wafuboe

    wafuboe Member

    Joined:
    Dec 24, 2010
    Messages:
    722
    Likes Received:
    9
    Best Answers:
    1
    works for 1.3?
     
  9. kito2

    kito2 https://mtibia.online

    Joined:
    Mar 9, 2009
    Messages:
    3,570
    Likes Received:
    172
    Best Answers:
    1
    Hey @psychonaut i have sent a few feedback trough discord if you could take a look ;)
     
  10. flaviiojr

    flaviiojr Member

    Joined:
    Jan 20, 2017
    Messages:
    199
    Likes Received:
    20
    Best Answers:
    7
    post here man, other person can help too, if possible
     
  11. gicu0770

    gicu0770 New Member

    Joined:
    Feb 26, 2011
    Messages:
    27
    Likes Received:
    4
    Best Answers:
    0
    I edit script. Add gold to balance Bank if PACC send +10% more GOLD!!!
    Code (Lua):
    1. local function scanContainer(cid, position)
    2.     local player = Player(cid)
    3.     if not player then
    4.         return
    5.     end
    6.     local corpse = Tile(position):getTopDownItem()
    7.     if not corpse or not corpse:isContainer() then
    8.         return
    9.     end
    10.     if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
    11.         for a = corpse:getSize() - 1, 0, -1 do
    12.             local containerItem = corpse:getItem(a)
    13.             if containerItem then
    14.                 for b = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
    15.                     if player:getStorageValue(b) == containerItem:getId() then
    16.                         containerItem:moveTo(player)
    17.                     end
    18.                 end
    19.         if player:isPremium() then
    20.                 if isItemStackable(containerItem:getId()) then
    21.  
    22.                     if containerItem:getId() == 2148 then
    23.                         containerItem:remove()
    24.                         doPlayerSetBalance(player, (getPlayerBalance(player) + containerItem:getCount()) * 1.1)
    25.                     end
    26.                     if containerItem:getId() == 2152 then
    27.                         containerItem:remove()
    28.                         doPlayerSetBalance(player, (getPlayerBalance(player) + (containerItem:getCount() * 100) * 1.1))
    29.                     end
    30.                     if containerItem:getId() == 2160 then
    31.                         containerItem:remove()
    32.                         doPlayerSetBalance(player, (getPlayerBalance(player) + (containerItem:getCount() * 1000) * 1.1))
    33.                     end
    34.             end
    35.         end
    36.        
    37.         if not player:isPremium() then
    38.                 if isItemStackable(containerItem:getId()) then
    39.  
    40.                     if containerItem:getId() == 2148 then
    41.                         containerItem:remove()
    42.                         doPlayerSetBalance(player, getPlayerBalance(player) + containerItem:getCount())
    43.                     end
    44.                     if containerItem:getId() == 2152 then
    45.                         containerItem:remove()
    46.                         doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 100))
    47.                     end
    48.                     if containerItem:getId() == 2160 then
    49.                         containerItem:remove()
    50.                         doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1000))
    51.                     end
    52.             end
    53.         end
    54.            
    55.            
    56.            
    57.            
    58.         end
    59.     end
    60. end
    61. end
    62. function onKill(player, target)
    63.     if not target:isMonster() then
    64.         return true
    65.     end
    66.     addEvent(scanContainer, 100, player:getId(), target:getPosition())
    67.     return true
    68. end
     
  12. gicu0770

    gicu0770 New Member

    Joined:
    Feb 26, 2011
    Messages:
    27
    Likes Received:
    4
    Best Answers:
    0
    SORRY WRONG SCRIPT :D Now is correct! i ADD MEssade LooT!
    Code (Lua):
    1. local function scanContainer(cid, position)
    2.     local player = Player(cid)
    3.     if not player then
    4.         return
    5.     end
    6.     local corpse = Tile(position):getTopDownItem()
    7.     if not corpse or not corpse:isContainer() then
    8.         return
    9.     end
    10.     if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
    11.         for a = corpse:getSize() - 1, 0, -1 do
    12.             local containerItem = corpse:getItem(a)
    13.             if containerItem then
    14.                 for b = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
    15.                     if player:getStorageValue(b) == containerItem:getId() then
    16.                         containerItem:moveTo(player)
    17.                     end
    18.                 end
    19.         if player:isPremium() then
    20.                 if isItemStackable(containerItem:getId()) then
    21.                                         local g = containerItem:getCount()
    22.                                         local g2 = containerItem:getCount() * 1.1 / 10
    23.                                         local g3 = containerItem:getCount()
    24.                                         local g4 = (containerItem:getCount() * 100) * 1.1 / 10
    25.                                         local g5 = containerItem:getCount()
    26.                                         local g6 = (containerItem:getCount() * 1000) * 1.1 / 10
    27.  
    28.                     if containerItem:getId() == 2148 then
    29.                         containerItem:remove()
    30.                         doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1.1))
    31.                     player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Gold Coins: "..g.."(+"..g2..").")
    32.  
    33.                     end
    34.                     if containerItem:getId() == 2152 then
    35.                         containerItem:remove()
    36.                         doPlayerSetBalance(player, getPlayerBalance(player) + ((containerItem:getCount() * 100) * 1.1))
    37.                         player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Platinum Coins: "..g3.."(+"..g4.."Gold Coin).")
    38.  
    39.  
    40.                     end
    41.                     if containerItem:getId() == 2160 then
    42.                         containerItem:remove()
    43.                         doPlayerSetBalance(player, getPlayerBalance(player) + ((containerItem:getCount() * 1000) * 1.1))
    44.                     player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Crystal Coins: "..g5.."(+"..g6.."Gold Coin).")
    45.  
    46.  
    47.                     end
    48.             end
    49.         end
    50.        
    51.         if not player:isPremium() then
    52.                 if isItemStackable(containerItem:getId()) then
    53.  
    54.                     if containerItem:getId() == 2148 then
    55.                         containerItem:remove()
    56.                         doPlayerSetBalance(player, getPlayerBalance(player) + containerItem:getCount())
    57.                     player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Gold Coins: "..g.."(+0).")
    58.                     end
    59.                     if containerItem:getId() == 2152 then
    60.                         containerItem:remove()
    61.                         doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 100))
    62.                         player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Platinum Coins: "..g3.."(+0).")
    63.                     end
    64.                     if containerItem:getId() == 2160 then
    65.                         containerItem:remove()
    66.                         doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 1000))
    67.                     player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Crystal Coins: "..g5.."(+0).")
    68.                     end
    69.             end
    70.         end
    71.            
    72.            
    73.            
    74.            
    75.         end
    76.     end
    77. end
    78. end
    79. function onKill(player, target)
    80.     if not target:isMonster() then
    81.         return true
    82.     end
    83.     addEvent(scanContainer, 100, player:getId(), target:getPosition())
    84.     return true
    85. end
     
    Caduceus likes this.
  13. kito2

    kito2 https://mtibia.online

    Joined:
    Mar 9, 2009
    Messages:
    3,570
    Likes Received:
    172
    Best Answers:
    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.

    [​IMG]

    All items are going to a loot bag:
    [​IMG]

    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.
     
    leandroluck and imkingran like this.
  14. Caduceus

    Caduceus Decapitated Soul

    Joined:
    May 10, 2010
    Messages:
    304
    Likes Received:
    16
    Best Answers:
    0
    Code (Text):
    1. Lua Script Error: [Main Interface]
    2. in a timer event called from:
    3. (Unknown scriptfile)
    4. data/creaturescripts/scripts/autoloot.lua:57: attempt to concatenate global 'g' (a nil value)
    5. stack traceback:
    6.         [C]: in function '__concat'
    7.         data/creaturescripts/scripts/autoloot.lua:57: in function <data/c
    8. reaturescripts/scripts/autoloot.lua:1>
    9.  
    10.  
     

Share This Page

Loading...