9
3

royalguardian.lua 1.1 KB

123456789101112131415161718192021222324252627282930
  1. --[[
  2. Script Name : SpawnScripts/EchoesOfTimeEpic/KingZalak.lua
  3. Script Purpose : Govern behavior and encounter for royal guardian in Echoes of Time
  4. Script Author : Neveruary
  5. Script Date : 08/09/2021
  6. Script Notes :
  7. --]]
  8. spells = {2550035} -- 30142, 30121}
  9. function spawn(NPC)
  10. end
  11. function aggro(NPC, Spawn)
  12. AddTimer(NPC, 100, "spellLoop")
  13. end
  14. function spellLoop(NPC, Spawn) -- referred from aggro. Loopback function for spellcasts.
  15. AddTimer(NPC, math.random(1500, 2500), "spellChoice", Spawn) -- add timer to refer to spellchoice.
  16. end
  17. function spellChoice(NPC, Spawn) -- select a spell from table. Zalak is a shadowknight, so only casts on highest hate target.
  18. local hated = GetMostHated(NPC) -- get pointer for whoever has threat.
  19. if hated ~= nil then -- if pointer isn't blank, proceed.
  20. FaceTarget(NPC, hated) -- face the NPC toward threat target if they aren't already.
  21. CastSpell(hated, spells[math.random(#spells)], 3, NPC) -- get random spell from table, cast on target.
  22. end
  23. AddTimer(NPC, math.random(1500, 2500), "spellLoop") -- refer to loopback
  24. end