aguardianstatue.lua 896 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --[[
  2. Script Name : SpawnScripts/WailingCaves/aguardianstatue.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.14 04:07:40
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetInvulnerable(NPC)
  10. SetLuaBrain(NPC)
  11. SetBrainTick(NPC, 500)
  12. Think(NPC)
  13. end
  14. function Think(NPC)
  15. local mostHated = GetMostHated(NPC)
  16. if mostHated ~= nil then
  17. --[[ Say(NPC, "Has most hated") --]]
  18. aggro(NPC, mostHated)
  19. end
  20. end
  21. function aggro(NPC, Spawn)
  22. if GetDistance(NPC, Spawn, 1) <= 3 then
  23. if GetTempVariable(NPC, "CASTING") ~= "True" then
  24. SetTempVariable(NPC, "CASTING", "True")
  25. CastSpell(Spawn, 230170, 1, NPC)
  26. AddTimer(NPC, 7000, "FinishedCasting")
  27. end
  28. end
  29. end
  30. function FinishedCasting(NPC)
  31. SetTempVariable(NPC, "CASTING", "False")
  32. end
  33. function respawn(NPC)
  34. spawn(NPC)
  35. end