charlyhustle
Member
- Joined
- Dec 9, 2011
- Messages
- 47
- Reaction score
- 6
Hi guys,
I wrote a script for my server (TFS 1.3) where if you kill a boss it will summon another boss.
When multiple players kill the monster theres a chance that the event will be triggered twice. I assume it's because of lasthit/mostdamage mechanic maybe? Here's my script:
I used monsterType:maxHealth() == 4400 because both bosses have the same name.
I read that my problem could be prevented when using onDeath instead of onKill but I have no idea how I can change my script.
Any help is greatly appreciated!
Thanks in advance!
I wrote a script for my server (TFS 1.3) where if you kill a boss it will summon another boss.
When multiple players kill the monster theres a chance that the event will be triggered twice. I assume it's because of lasthit/mostdamage mechanic maybe? Here's my script:
Lua:
local timer = 1 * 5 * 1000
function onKill(player, target)
local targetMonster = target:isMonster()
local monsterType = target:getType()
if not targetMonster then
return true
end
local targetName = target:getName():lower()
if targetName == 'lunarius' and monsterType:maxHealth() == 4400 then
addEvent(Game.createMonster, timer, "Lunarius", Position(846, 1219, 11))
end
return true
end
I used monsterType:maxHealth() == 4400 because both bosses have the same name.
I read that my problem could be prevented when using onDeath instead of onKill but I have no idea how I can change my script.
Any help is greatly appreciated!
Thanks in advance!