KingZalak.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --[[
  2. Script Name : SpawnScripts/EchoesOfTimeEpic/KingZalak.lua
  3. Script Purpose : Govern behavior and encounter for King Zalak in Echoes of Time (5310002)
  4. Script Author : Neveruary
  5. Script Date : 08/09/2021
  6. Script Notes : Need spell ID for Regal Arc.
  7. : This fight operates by summoning adds every so often. They cast spells, and the
  8. : patriarchs will heal him and then explode in an aoe.
  9. --]]
  10. --Declare variables for iterative use later. These are all Location IDs.
  11. patriarchlocs = {365525, 365526, 133772501, 133772502, 133772503, 133772504, 133772505, 133772506, 133772507}
  12. function spawn(NPC)
  13. end
  14. function aggro(NPC, Spawn) -- on aggro, refer to pat spawn loop. also start timer for spellcasts.
  15. SetTempVariable(NPC, "first", "1")
  16. AddTimer(NPC, math.random(21000, 30000), "patriarchLoop")
  17. AddTimer(NPC, math.random(1000), "spellLoop")
  18. end
  19. function patriarchLoop(NPC, Spawn)
  20. if GetTempVariable(NPC, "first") == "1" then
  21. AddTimer(NPC, 1000, "patriarchSpawns")
  22. SetTempVariable(NPC, "first", "0")
  23. else
  24. AddTimer(NPC, math.random(21000,30000), "patriarchSpawns")
  25. end
  26. end
  27. function patriarchSpawns(NPC, Spawn) -- spawns patriarchs on a timer. timer starts on aggro.
  28. Shout(NPC, "Royal Patriarchs come aid your king!")
  29. AddTimer(NPC, 1000, "patriarchLoop")
  30. zone = GetZone(NPC)
  31. for k,v in pairs(patriarchlocs) do
  32. if not IsAlive(GetSpawnByLocationID(zone, v)) then
  33. newPat = SpawnByLocationID(zone, v)
  34. AddTimer(newPat, 1000, "runtozalak")
  35. break
  36. end
  37. end
  38. end
  39. function respawn(NPC)
  40. spawn(NPC)
  41. end