canary/data/scripts/creaturescripts/monster.lua
Paulo Henrique Lisboa 0d9d3a1cf2
[Feature/Enhancement] - New objects; Lever, Spawn and Spectators to assistant with boss/quest scripts and others (#360)
The new objects will help us with boss scripts, quests, and spectator checks, reducing the complexity and size of a lot of code. Added an example of how the mechanics work in the lever of threatened dreams quest.
2022-07-19 01:34:22 -03:00

24 lines
803 B
Lua

local monsterDeath = CreatureEvent("monsterDeath")
function monsterDeath.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
if creature:isMonster() then
local self = creature:getStorageValue(MonsterStorage.Spawn.monster_spawn_object)
self:executeFunctionMonster("onDeath", creature)
self:deleteMonster(creature)
return true
end
return true
end
local monsterDeathBoss = CreatureEvent("monsterDeathBoss")
function monsterDeathBoss.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
if creature:isMonster() then
local self = creature:getStorageValue(MonsterStorage.Spawn.monster_spawn_object)
self:removeSpawn()
self:removeMonsters()
return true
end
return true
end
monsterDeathBoss:register()
monsterDeath:register()