mirror of
https://github.com/opentibiabr/canary
synced 2026-08-16 06:26:09 -04:00
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.
24 lines
803 B
Lua
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()
|