[TFS 1.2] advanced drop loot system

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by strutZ, Jun 9, 2016.

  1. strutZ

    strutZ Australian OT Member {AKA Beastn} Premium User

    Joined:
    Nov 16, 2014
    Messages:
    1,177
    Hello again Otland!
    I have made an easy to use on on death system! With it you can make players lose a percentage of their money from their bank when killed by a player, add more items to prevent money loss/item loss plus more!

    Information on the system
    It has an easy config section for you to customize it how you would like it! You just need to fill out the config table found in the action script (pictured below)
    Code:
    --- Config ---
    local config = {
       noMoneyLoss = false, -- Set this to true if you dont want players to lose money by being killed by a player
       noItemLoss = false, -- Set this to true if you dont want players to lose any items.
       noVocLoss = true, -- If this is set to true, and the player has no vocation dont lose any items
       realAOL = true, -- Set this to true if you want AOL to be ignored if player has skull (Make it work like Real Tibia)
       bankLossPercent = 10, -- This is the percent of the players totoal bank balance they will lose
       
    -- You can add extra items here that can prevent item loss
       itemProtection = {
         -- Amulet of loss   
         [1] = {
           item = {
             id = 2173, -- The ID of any the item
             slot = CONST_SLOT_NECKLACE, -- Slot that the item must be in
           },
         },     
       },
       
    -- You can add extra items here that can prevent item Money loss
       moneyProtection = {
         -- Amulet of loss   
         [1] = {
           item = {
             id = 2173, -- The ID of any the item
             slot = CONST_SLOT_NECKLACE, -- Slot that the item must be in
           },
         },     
       },
    }
    -- End Config
    
    Installation

    1)
    Replace your droploot.lua (Typicaly found at /data/creaturescripts/scripts/others/droploot.lua) with this:
    http://pastebin.com/pKcXgvv4


    Thats it!
    Enjoy =)

    P.S This hasn't been thoroughly tested so if you encounter any bugs please comment them here.

    Regards,
    strutZ
     
    tetra20 likes this.
  2. Doitforthegains

    Doitforthegains Active Member

    Joined:
    Aug 30, 2014
    Messages:
    189
    This looks really nice, will be testing it when I get home. A question though, would it be possible to add the money lost on death to the corpse to the killer can loot it?
     
  3. strutZ

    strutZ Australian OT Member {AKA Beastn} Premium User

    Joined:
    Nov 16, 2014
    Messages:
    1,177
    of course
     
  4. Doitforthegains

    Doitforthegains Active Member

    Joined:
    Aug 30, 2014
    Messages:
    189
    Hmm.. I keep getting an error
    Code:
    drop.lua:104 'end' expected (to close 'if' at line 101) near 'return'
    
    I tried messing with it and comparing it with the default droploot.lua but I can't get it to work :( the if statement looks right to me...but I'm a noob sooo haha
     
  5. tetra20

    tetra20 DD

    Joined:
    Jan 17, 2009
    Messages:
    1,274
    Code:
    break;
    To
    Code:
    break
    this is lua not C++
     
  6. strutZ

    strutZ Australian OT Member {AKA Beastn} Premium User

    Joined:
    Nov 16, 2014
    Messages:
    1,177
    Whoops sorry i dont think i released this finished... i dont know where i got up to.. i kind of stopped working on it lol here is what i currently have

    LIB
    http://pastebin.com/udC9qSnH

    Test it gimme errors and i'll fix
     
  7. Doitforthegains

    Doitforthegains Active Member

    Joined:
    Aug 30, 2014
    Messages:
    189
    Alright I copied the new pastebin and reload creaturescripts..got the same error as before. Tried removing the semicolon after break like @tetra said, same error.
    So then I just removed the breaks completely and reloaded, no errors. Tested it with 10gp balance and it worked, everytime I was killed by a player I'd lose 10% of my balance regardless of aol/blessings. No gold was taken if I was killed by a mob either. The only problem is that it broke aol xD aol doesn't protect my items and doesn't disappear on death.
     
  8. strutZ

    strutZ Australian OT Member {AKA Beastn} Premium User

    Joined:
    Nov 16, 2014
    Messages:
    1,177
    Alright i'll look into this script again just for you hahah
     
    Doitforthegains likes this.
  9. Doitforthegains

    Doitforthegains Active Member

    Joined:
    Aug 30, 2014
    Messages:
    189
  10. cesar10

    cesar10 Active Member

    Joined:
    Aug 4, 2009
    Messages:
    417
    Now make it so you cant have money on depot kappa
     
  11. strutZ

    strutZ Australian OT Member {AKA Beastn} Premium User

    Joined:
    Nov 16, 2014
    Messages:
    1,177
    Well in my server there is no physical money... its just a number that goes into your bank... when you kill monsters money auto goes to bank.. if you got to a shop you use bank balance and if you want to give money to a player you transfer.
     
  12. cesar10

    cesar10 Active Member

    Joined:
    Aug 4, 2009
    Messages:
    417
    *Welcomes me to the future*
    Is this a special feature of your server or is it normal? I've been away from OT since the 8.60 lol

    Sorry for offTopic
     
  13. strutZ

    strutZ Australian OT Member {AKA Beastn} Premium User

    Joined:
    Nov 16, 2014
    Messages:
    1,177
    special feature =)
     
    cesar10 likes this.
  14. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,517
    no updates? same error :)
     
  15. strutZ

    strutZ Australian OT Member {AKA Beastn} Premium User

    Joined:
    Nov 16, 2014
    Messages:
    1,177
    soon little one ;)
     
  16. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,517
    when?
     
  17. Tinkz

    Tinkz Java Developer

    Joined:
    Feb 14, 2012
    Messages:
    29
    @strutZ Could you perhaps put something in the code that only allows people to drop gold from bank only if they are "x" levell.
     

Share This Page