After a long time breaking my head, I managed to make the party shared by players within a party. But I have some problems with the final version of the code.
If any player has 2 players in a party, one player gives a hit, and the other gives the "last" hit, one task counts twice for each.
The would be ideal:
A task will only be told to party members if exp sharing is active - Evitaria service, of a low level, receiving help in really strong shows.
Limit to 4 players. That is, over 4 players at the party (preferably if for each vocation) a task does not count.
Would anyone know how to guide me in this?
Or at least help with the duplicate problem?
Thanks.
Task.lua (creaturescript).
If any player has 2 players in a party, one player gives a hit, and the other gives the "last" hit, one task counts twice for each.
The would be ideal:
A task will only be told to party members if exp sharing is active - Evitaria service, of a low level, receiving help in really strong shows.
Limit to 4 players. That is, over 4 players at the party (preferably if for each vocation) a task does not count.
Would anyone know how to guide me in this?
Or at least help with the duplicate problem?
Thanks.
Task.lua (creaturescript).
Lua:
function onKill(creature, target)
local monster = config[target:getName():lower()]
if not monster or target:getMaster() then
return true
end
local damageMap = target:getDamageMap()
for attackerId, damage in pairs(damageMap) do
local player = Player(attackerId)
if player then
------------------------------------------------
local task = player:getParty()
if task then
local monstersKilled = player:getStorageValue(monster.storage)
if monstersKilled >= monster.start then
if damageMap.total > player:getDamageMap().total then
return false
end
player:setStorageValue(monster.storage, monstersKilled + 1)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have killed [" .. monstersKilled .. "/" .. monster.count .. "] " .. monster.plural .. ".")
end
end
end
------------------------------------------------
end
return true
end