wizinx
Active Member
Hi everyone, I'm editing the code so that the tasks will count in party, but I can't make it 100% functional, since I want to make it count only by damaging the creature.
At the moment it works if they both hit almost the same damage to the creature.
Could you help me?.
Thank you
At the moment it works if they both hit almost the same damage to the creature.
Could you help me?.
Thank you
Lua:
local function getKillers(creature, party)
local killers = {}
local timeNow = os.mtime()
local inFightTicks = configManager.getNumber(configKeys.PZ_LOCKED)
for uid, cb in pairs(creature:getDamageMap()) do
local attacker = Player(uid)
if (attacker and attacker ~= creature and timeNow - cb.ticks <= inFightTicks) then
local p = attacker
if p and p == party then
killers[#killers +1] = attacker
end
end
end
return killers
end
function onKill(player, target)
local monster = config[target:getName():lower()]
if not monster or target:getMaster() then
return true
end
local killers = getKillers(target, player)
for k, member in pairs(killers) do
local storageValue = member:getStorageValue(monster.storage)
if storageValue >= monster.start then
if storageValue >= monster.count then
member:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already killed " .. monster.count .. " " .. monster.plural .. ". Report back to Tusker.")
else
member:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have killed [" .. storageValue .. "/" .. monster.count .. "] " .. monster.plural .. ".")
end
member:setStorageValue(monster.storage, storageValue + 1)
end
end
return true
end