9
3

royalpatriarch.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. --[[
  2. Script Name : SpawnScripts/EchoesOfTimeEpic/royalpatriarch.lua
  3. Script Purpose : royal patriarch in Echoes of Time: Epic
  4. Script Author : alfa24t
  5. Script Date : 03/09/2022
  6. Script Notes : spawnID 5310004
  7. --]]
  8. require "SpawnScripts/Generic/NPCModule"
  9. function spawn(NPC)
  10. AddTimer(NPC, 1500, "gotoKingZalak")
  11. --NPCModule(NPC, Spawn)
  12. end
  13. function gotoKingZalak(NPC) -- Loopback function for King Zalak current location.
  14. local zone = GetZone(NPC)
  15. local spawnKingZalak = GetSpawn(NPC, 5310002)
  16. Shout(NPC, "I hear and I obey great king!")
  17. SetFollowTarget(NPC, spawnKingZalak, 5)
  18. ToggleFollow(NPC)
  19. AddTimer(NPC, 2500, "checkgotoKingZalak")
  20. end
  21. function checkgotoKingZalak(NPC) -- Loopback function for King Zalak current location.
  22. local zone = GetZone(NPC)
  23. local spawnKingZalak = GetSpawn(NPC, 5310002)
  24. if GetDistance(NPC, spawnKingZalak) > 4 then
  25. AddTimer(NPC, 2500, "checkgotoKingZalak")
  26. else
  27. AddTimer(NPC, 10, "heal")
  28. end
  29. end
  30. function heal(NPC, Spawn)
  31. local zalak = GetSpawn(NPC, 5310002)
  32. if GetDistance(NPC, zalak) < 4 then
  33. ModifyHP(zalak, 2000)-- Heal value not good, need to parse fight on live
  34. AddTimer(NPC, 10, "explode")
  35. else
  36. AddTimer(NPC, 2500, "heal")
  37. end
  38. end
  39. function explode(NPC, Spawn)
  40. npctxt = {"My life is for you King Zalak!", "My life ends in a blaze of glory for you Oh King!"}
  41. Shout(NPC, npctxt[math.random(#npctxt)])
  42. -- Should be an AOE of FOCUS about 70k reparted on raid members in range
  43. CastSpell(NPC, 5474, 1, NPC)
  44. end
  45. function respawn(NPC)
  46. spawn(NPC)
  47. end
  48. function attacked(NPC, Spawn)
  49. ToggleFollow(NPC)
  50. end