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

CreatureEvent Party Loot Share

the "single item" loot just gave it to any random player in the party.. i was using 3 people heh
 
Ye.it just give random item if the item isn't stackable or money.Like fire axe

And Thanks For Testing Again.Btw i haven't seen you on otland before

yeaa i just got back recently, i was out for a good 2-3 years.. its gotten smaller here but theres still alotta familiar faces! and otfans is down haha couple things changed but yea, im back so ill try my best to help out anytime i can since im not a pro scripter yet lolol and make my little noob requests here and there :p

nice loot share though, good stuff for heavy team hunt servers
 
yeaa i just got back recently, i was out for a good 2-3 years.. its gotten smaller here but theres still alotta familiar faces! and otfans is down haha couple things changed but yea, im back so ill try my best to help out anytime i can since im not a pro scripter yet lolol and make my little noob requests here and there :p

nice loot share though, good stuff for heavy team hunt servers
Haha Welcome Back :) btw i have made this system for my server to force people to use party.really there are much more in my server but i don't release.pm me if you want to see more :p
 
Greets again!

Added it to my server (the one you made for TFS 1.0) and this is what I got in my logg right now:
Code:
Lua Script Error: [Test Interface]
data/creaturescripts/scripts/PartyLoot.lua
data/creaturescripts/scripts/PartyLoot.lua:4: attempt to index local 'player' (a
 nil value)
stack traceback:
  [C]: in function '__index'
  data/creaturescripts/scripts/PartyLoot.lua:4: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/PartyLoot.lua

Kind Regards,
Eldin.
 
Code:
math.randomseed(os.time())
local maxdis = 40
function autoloot(cid, target, pos)
local player = Player(cid)
local party = player:getParty()
  if not isPlayer(cid) then
  return
  end
  local function scanContainer(cid, uid)
  local added = 0
  local members = getPartyMembers(cid)
  for k = (getContainerSize(uid) - 1), 0, -1 do
  local tmp = getContainerItem(uid, k)
  local stack = 0
  local winner = party:getMembers()
  if (isInArray({2148,2152, 2160}, tmp.itemid)) then
  local money = (tmp.itemid == 2160) and (tmp.type*10000) or (tmp.itemid == 2152) and (tmp.type*100) or tmp.type
  added = added + money
  for a = 1,#members do
  doPlayerAddMoney(members[a], math.floor((money/party:getMemberCount())))
  doPlayerSendTextMessage(members[a], MESSAGE_STATUS_CONSOLE_BLUE, '[Loot System] ' .. math.floor(((added/table.maxn(members)))) .. ' Gold Coin Has Been Added to Your Backpack')
  end
  elseif isItemStackable(tmp.itemid) then
  stack = tmp.type
  for i = 1,#members do
  doPlayerAddItem(members[i], tmp.itemid,math.floor(stack/party:getMemberCount())+1)
  if doPlayerSendTextMessage(members[i], MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] " .. math.floor(((stack/table.maxn(members))))+1 .. "x " .. getItemNameById(tmp.itemid) .. " Has Been Added to Your Backpack") then
  end
  end
  elseif isContainer(tmp.uid) then
  scanContainer(cid, tmp.uid)
  else
  if tmp.type == 0 and not (isInArray({2148, 2152, 2160}, tmp.itemid)) then
  doPlayerAddItem(winner[math.random(1,#winner)], tmp.itemid,tmp.type)
  doPlayerSendTextMessage(winner[math.random(1,#winner)], MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type+1 .. "x " .. getItemNameById(tmp.itemid) .. ".")
  else
  doPlayerAddItem(winner[math.random(1,#winner)], tmp.itemid,tmp.type)
  doPlayerSendTextMessage(winner[math.random(1,#winner)], MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type .. "x " .. getItemNameById(tmp.itemid) .. ".")
  end
  end
  doRemoveItem(tmp.uid)
  end
  return true
  end
  local items = {}
  for i = getTileInfo(pos).items, 1, -1 do
  pos.stackpos = i
  items[i] = getThingFromPos(pos)
  end
  if (#items == 0) then
  return
  end
  local corpse = -1
  for _, item in pairs(items) do
  if not isCreature(item.uid) then
  local name = getItemName(item.itemid):lower()
  if name:find(target:lower()) then
  if isCorpse(item.uid) then
  corpse = item.uid
  break
  end
  end
  end
  end
  scanContainer(cid, corpse)
end

function onKill(cid, target, lastHit)
  local members = getPartyMembers(cid)
  local party = Player(cid):getParty()
  if isMonster(target) and party and getPlayerStorageValue(members[2], 23305) == 1 then
  addEvent(autoloot, 100, cid, getCreatureName(target), getCreaturePosition(target))
  end
  return true
end
 
You crushed dem bugs. ;)
Will try it more closely asap and write any ideas/thoughts that I have.
Thank You!

Kind Regards,
Eldin.
 
Just a Little joke, you fixed it and the bugs are gone.
Haven't tested it ingame yet tho. :)

Kind Regards,
Eldin
.
 
0.3.6:Tested And Working


you lying to your customers :D

It is still addin 10Gp when you are not in party ;)


Code:
math.randomseed(os.time())
local maxdis = 40
function autoloot(cid, target, pos)
    if not isPlayer(cid) then
        return
    end
    local function scanContainer(cid, uid)
        local added = 0
        local members = getPartyMembers(cid)
        for k = (getContainerSize(uid) - 1), 0, -1 do
            local tmp = getContainerItem(uid, k)
            local stack = 0
            local winner = getPartyMembers(getPartyLeader(cid))[math.random(1, table.maxn(getPartyMembers(getPartyLeader(cid))))]
            if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(winner)) <= maxdis then
                if (isInArray({2148,2152, 2160}, tmp.itemid)) then
                        local money = (tmp.itemid == 2160) and (tmp.type*10000) or (tmp.itemid == 2152) and (tmp.type*100) or tmp.type
                        added = added + money
                        for a = 1,#members do
                            doPlayerAddMoney(members[a], math.floor((money/table.maxn(members))))
                            doPlayerSendTextMessage(members[a], MESSAGE_STATUS_CONSOLE_BLUE, '[Loot System] ' .. math.floor(((added/table.maxn(members)))) .. ' Gold Coin Has Been Added to Your Backpack')
                        end
                elseif isItemStackable(tmp.itemid) then
                    stack = tmp.type
                        for i = 1,#members do
                            doPlayerAddItem(members[i], tmp.itemid,math.floor(stack/table.maxn(members))+1)
                            if doPlayerSendTextMessage(members[i], MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] " .. math.floor(((stack/table.maxn(members))))+1 .. "x " .. getItemNameById(tmp.itemid) .. " Has Been Added to Your Backpack") then
                            end
                        end
                elseif isContainer(tmp.uid) then
                scanContainer(cid, tmp.uid)
                else
                    if tmp.type == 0 and not (isInArray({2148, 2152, 2160}, tmp.itemid)) then
                    doPlayerAddItem(winner, tmp.itemid,tmp.type)
                    doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type+1 .. "x " .. getItemNameById(tmp.itemid) .. ".")
                    else
                    doPlayerAddItem(winner, tmp.itemid,tmp.type)
                    doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type .. "x " .. getItemNameById(tmp.itemid) .. ".")
                    end
                end
            end
            doRemoveItem(tmp.uid)
        end
        return true
    end
    local items = {}
    for i = getTileInfo(pos).items, 1, -1 do
        pos.stackpos = i
        items[i] = getThingFromPos(pos)
    end
    if (#items == 0) then
        return
    end
    local corpse = -1
    for _, item in pairs(items) do
        if not isCreature(item.uid) then
            local name = getItemName(item.uid):lower()
            if name:find(target:lower()) then
                corpse = item.uid
                break
            end
        end
    end
        scanContainer(cid, corpse)
end
function onKill(cid, target, lastHit)
        local members = getPartyMembers(cid)
        if isMonster(target) and (isInParty(cid)) and getPlayerStorageValue(members[2], 23305) == 1 then
            addEvent(autoloot, 100, cid, getCreatureName(target), getCreaturePosition(target))
        end
    return true
end
 
0.3.6:Tested And Working


you lying to your customers :D

It is still addin 10Gp when you are not in party ;)


Code:
math.randomseed(os.time())
local maxdis = 40
function autoloot(cid, target, pos)
    if not isPlayer(cid) then
        return
    end
    local function scanContainer(cid, uid)
        local added = 0
        local members = getPartyMembers(cid)
        for k = (getContainerSize(uid) - 1), 0, -1 do
            local tmp = getContainerItem(uid, k)
            local stack = 0
            local winner = getPartyMembers(getPartyLeader(cid))[math.random(1, table.maxn(getPartyMembers(getPartyLeader(cid))))]
            if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(winner)) <= maxdis then
                if (isInArray({2148,2152, 2160}, tmp.itemid)) then
                        local money = (tmp.itemid == 2160) and (tmp.type*10000) or (tmp.itemid == 2152) and (tmp.type*100) or tmp.type
                        added = added + money
                        for a = 1,#members do
                            doPlayerAddMoney(members[a], math.floor((money/table.maxn(members))))
                            doPlayerSendTextMessage(members[a], MESSAGE_STATUS_CONSOLE_BLUE, '[Loot System] ' .. math.floor(((added/table.maxn(members)))) .. ' Gold Coin Has Been Added to Your Backpack')
                        end
                elseif isItemStackable(tmp.itemid) then
                    stack = tmp.type
                        for i = 1,#members do
                            doPlayerAddItem(members[i], tmp.itemid,math.floor(stack/table.maxn(members))+1)
                            if doPlayerSendTextMessage(members[i], MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] " .. math.floor(((stack/table.maxn(members))))+1 .. "x " .. getItemNameById(tmp.itemid) .. " Has Been Added to Your Backpack") then
                            end
                        end
                elseif isContainer(tmp.uid) then
                scanContainer(cid, tmp.uid)
                else
                    if tmp.type == 0 and not (isInArray({2148, 2152, 2160}, tmp.itemid)) then
                    doPlayerAddItem(winner, tmp.itemid,tmp.type)
                    doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type+1 .. "x " .. getItemNameById(tmp.itemid) .. ".")
                    else
                    doPlayerAddItem(winner, tmp.itemid,tmp.type)
                    doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type .. "x " .. getItemNameById(tmp.itemid) .. ".")
                    end
                end
            end
            doRemoveItem(tmp.uid)
        end
        return true
    end
    local items = {}
    for i = getTileInfo(pos).items, 1, -1 do
        pos.stackpos = i
        items[i] = getThingFromPos(pos)
    end
    if (#items == 0) then
        return
    end
    local corpse = -1
    for _, item in pairs(items) do
        if not isCreature(item.uid) then
            local name = getItemName(item.uid):lower()
            if name:find(target:lower()) then
                corpse = item.uid
                break
            end
        end
    end
        scanContainer(cid, corpse)
end
function onKill(cid, target, lastHit)
        local members = getPartyMembers(cid)
        if isMonster(target) and (isInParty(cid)) and getPlayerStorageValue(members[2], 23305) == 1 then
            addEvent(autoloot, 100, cid, getCreatureName(target), getCreaturePosition(target))
        end
    return true
end
I Am Lying to You.Not to my Customers.noob add the talkaction part not the creaturescript
 
Okay now the system works for me :)

my question now is


When 5 players attack a boss and 3 are in party and the 2 which are not attacking make more dmg will the 3 don't get it?
 
Okay now the system works for me :)

my question now is


When 5 players attack a boss and 3 are in party and the 2 which are not attacking make more dmg will the 3 don't get it?
I Have Made a Little Edit to the script.Just The Corpse Owner will get the loot.if he is in party it will be shared
 
Okay can you maybe fix if not enough cap don't drop on ground it should say you need more cap or space
 
I'm running 0.3.6, and I keep getting the error "[19/03/2014 22:12:14] data/creaturescripts/scripts/killcreature.lua:62: unexpected symbol near '['

Line 62 is: end [/LEFT]

If I erase that line, I get the same error for line 64...

Line 64 is:
scanContainer(cid, corpse)​
 
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/lootshare.lua:onSay
data/talkactions/scripts/lootshare.lua:6: attempt to call method 'getLeader' (a
nil value)
stack traceback:
        [C]: in function 'getLeader'
        data/talkactions/scripts/lootshare.lua:6: in function <data/talkactions/
scripts/lootshare.lua:3>

I'm using TFS 1.0 and I'm getting this error. Anybody have the solution? I couldn't solve it yet myself but will keep working on it as well.

This is the talkaction script i'm using:

Code:
local stor = 23305

function onSay(cid, words, param, channel)
local party = getPartyMembers(cid)
  if Player(cid):getParty() then
  if party:getLeader() == cid then
  setPlayerStorageValue(party:getLeader(), stor, (getPlayerStorageValue(party:getLeader(), stor) == -1) and 1 or -1)
  doPlayerSendTextMessage(party:getLeader(), MESSAGE_STATUS_CONSOLE_BLUE, 'Party Item Share has been ' .. (getPlayerStorageValue(party:getLeader(), stor) == -1 and 'disabled' or 'enabled') .. '.')
  else
  doPlayerSendCancel(cid, "You Aren't The Leader of Party")
  doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  end
  else
  doPlayerSendCancel(cid, "You Aren't In Party")
  doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  end
  return true
end
 
Back
Top