Schlangemann
New Member
TFS 1.4
Hi!
I am trying to make a boss give storage id to all party members who have damaged it when it dies.
I am using a variation of Slavi's code from this post Lua - onKill players on party sharing xp to get task counted (https://otland.net/threads/onkill-players-on-party-sharing-xp-to-get-task-counted.233557/) as it seemed to fit what i need.
I can kill the boss without party and it gives the storage ID to the player, so that works as intended.
But when the boss gets killed in a party it gives the storage ID twice to the player dealing the highest damage, but not to the other party members.
Been searching for a solution for this on this forum but cannot find one. if there already is a solution to this problem i would love a link to that forum page and if so i apologize in advance that i did not find it.
Any help is greatly appreciated!
In data/creaturescripts/creaturescripts.xml i have this code
in creaturescripts/scripts/theundeadmage.lua i have this code
Hi!
I am trying to make a boss give storage id to all party members who have damaged it when it dies.
I am using a variation of Slavi's code from this post Lua - onKill players on party sharing xp to get task counted (https://otland.net/threads/onkill-players-on-party-sharing-xp-to-get-task-counted.233557/) as it seemed to fit what i need.
I can kill the boss without party and it gives the storage ID to the player, so that works as intended.
But when the boss gets killed in a party it gives the storage ID twice to the player dealing the highest damage, but not to the other party members.
Been searching for a solution for this on this forum but cannot find one. if there already is a solution to this problem i would love a link to that forum page and if so i apologize in advance that i did not find it.
Any help is greatly appreciated!
In data/creaturescripts/creaturescripts.xml i have this code
XML:
<event type="death" name="TheUndeadMage" script="theundeadmage.lua" />
in creaturescripts/scripts/theundeadmage.lua i have this code
Lua:
function onDeath(creature, target, player)
local bossStorage = 43100
local players
local party = player:getParty()
if party ~= nil then
players = party:getMembers() -- all members of the party
players[#players + 1] = party:getLeader() -- don't forget the leader
else
players = { player } -- no party? then just the player
end
for _, member in ipairs(players) do
player:setStorageValue(bossStorage, os.time() + 36000)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You slayed The Undead Mage and lifted the curse of the tomb.")
end
end