aguardianstatue.lua 857 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. SetLuaBrain(NPC)
  10. SetBrainTick(NPC, 500)
  11. Think(NPC)
  12. end
  13. function Think(NPC)
  14. local mostHated = GetMostHated(NPC)
  15. if mostHated ~= nil then
  16. Say(NPC, "Has most hated")
  17. aggro(NPC, mostHated)
  18. end
  19. end
  20. function aggro(NPC, Spawn)
  21. if GetDistance(NPC, Spawn) <= 3 then
  22. if GetTempVariable(NPC, "CASTING") ~= "True" then
  23. SetTempVariable(NPC, "CASTING", "True")
  24. CastSpell(Spawn, 230170, 1, NPC)
  25. AddTimer(NPC, 7000, "FinishedCasting")
  26. end
  27. end
  28. end
  29. function FinishedCasting(NPC)
  30. SetTempVariable(NPC, "CASTING", "False")
  31. end
  32. function respawn(NPC)
  33. spawn(NPC)
  34. end