Hi,
I was trying to do a script wich summons a other creature when life is less than 25 seconds, and doesnt have DoT Damage.
I improved only to the part of less than 25%hp left but i dont know how to proceed with DoT damage calc.
THIS CODE IS BUGGY, IT ONLY SPAWNS FIRST TIME AFTER SERVER RESTART
I was trying to do a script wich summons a other creature when life is less than 25 seconds, and doesnt have DoT Damage.
I improved only to the part of less than 25%hp left but i dont know how to proceed with DoT damage calc.
Code:
local NPC_ID = 123
local valor = 0
local function InvocarGranTiniebla (eventID, delay, pCall, creature, target)
while(valor == 0 ) do
local x, y, z = creature:GetRelativePoint(math.random()*5, math.random()*math.pi*2)
creature:SpawnCreature(870759, x, y, z, 0, 7)
valor = valor + 1
end
end
local function CheckHealth (eventID, delay, pCall, creature, target)
if creature:GetHealthPct() <= 25 then
local target = creature:GetAITarget(0, true)
target:SendAreaTriggerMessage("Menos de 25%HP!")
creature:RegisterEvent(InvocarGranTiniebla, 100, 0)
end
end
local function KetLot_OnCombat (event, creature, target)
local target = creature:GetAITarget(0, true)
creature:AttackStop()
creature:RegisterEvent(CheckHealth, 100, 0)
end
local function KetLot_Died (event, creature, target)
creature:RemoveEvents()
end
local function KetLot_OnLeaveCombat (event, creature, target)
creature:RemoveEvents()
end
local function KetLot_Spawn (event, creature, target)
creature:MoveHome()
creature:SetWalk(true)
end
RegisterCreatureEvent(NPC_ID, 1, KetLot_OnCombat)
RegisterCreatureEvent(NPC_ID, 24, KetLot_OnLeaveCombat)
RegisterCreatureEvent(NPC_ID, 5, KetLot_Spawn)
RegisterCreatureEvent(NPC_ID, 4, KetLot_Died)
Last edited: