achaoticelemental.lua 1005 B

123456789101112131415161718192021222324252627282930313233
  1. --[[
  2. Script Name : SpawnScripts/ShatteredStillnessEpic/achaoticelemental.lua
  3. Script Author : Neveruary
  4. Script Date : 2021.10.04 01:10:11
  5. Script Purpose : Governs behavior of chaotic elemental adds in Shattered Stillness: Epic.
  6. Script Notes : Swirling Cloud of Blood and Stunning Shards need implementation.
  7. --]]
  8. spells = {30159} -- Swirling Cloud of Blood, Stunning Shards}
  9. function spawn(NPC)
  10. AddTimer(NPC, 1000, "spellLoop")
  11. end
  12. function spellLoop(NPC, Spawn) -- Loopback function for spellcasts.
  13. AddTimer(NPC, math.random(1500,2500), "spellChoice")
  14. end
  15. function spellChoice(NPC, Spawn) -- select a spell from table.
  16. local hated = GetMostHated(NPC)
  17. if hated ~= nil then
  18. FaceTarget(NPC, hated)
  19. CastSpell(hated, spells[math.random(#spells)], 3, NPC)
  20. end
  21. AddTimer(NPC, math.random(1500, 2500), "spellLoop")
  22. end
  23. function hailed(NPC, Spawn)
  24. end
  25. function respawn(NPC)
  26. spawn(NPC)
  27. end