PDA

View Full Version : TrinityCore WotLK Summon Ohter Crerature On...



jonmii
09-11-2016, 11:24 AM
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.





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)





THIS CODE IS BUGGY, IT ONLY SPAWNS FIRST TIME AFTER SERVER RESTART

jonmii
09-14-2016, 07:27 PM
Hi ED, someone still alive?

slp13at420
09-15-2016, 02:17 AM
wouldn't DoT fall under `Aura` category?



local Aura = creature:GetAura(x);


http://eluna.emudevs.com/Unit/GetAura.html


if so then you could loop thru a table of all the spells that use DoT auras, then you can use



local duration_left = Aura:GetDuration();


http://eluna.emudevs.com/Aura/GetDuration.html

http://eluna.emudevs.com/index.html

jonmii
09-15-2016, 08:21 AM
So using that i have to store all spellsids manually on code.
My intention was to get any DoT duration, globally.

Thanks anyway

slp13at420
09-16-2016, 03:43 AM
just the ids of spells with Dot I think .. at first ponder yea that is the only way to . I haven't seen an Eluna method like `Creature:GetAuras();` that would return a table of all current auras a player/char/npc has.