amorakdevourer1587718.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --[[
  2. Script Name : SpawnScripts/QueensColony/amorakdevourer1587718.lua
  3. Script Purpose : Follow script for amorakdevourer1587718.lua
  4. Script Author : Rylec
  5. Script Date : 06-01-2020 10:08:43
  6. Script Notes : Follow script
  7. --]]
  8. function spawn(NPC)
  9. local level = GetLevel(NPC)
  10. if level == 4 then
  11. SpawnSet(NPC, "size", "28.8")
  12. end
  13. SpawnSet(NPC, "difficulty", "2")
  14. AddTimer(NPC, 2000, "FollowMorak")
  15. end
  16. function hailed(NPC, Spawn)
  17. FaceTarget(NPC, Spawn)
  18. end
  19. function respawn(NPC)
  20. spawn(NPC)
  21. end
  22. function FollowMorak(NPC)
  23. local zone = GetZone(NPC)
  24. local morak_location = GetSpawnByLocationID(zone, 1587717)
  25. local leaderX = GetX(morak_location)
  26. local leaderY = GetY(morak_location)
  27. local leaderZ = GetZ(morak_location)
  28. local speed = 2
  29. local randdistance = math.random(1,5)
  30. local randX = math.random(1,5)
  31. local randY = math.random(1,5)
  32. local randZ = math.random(1,5)
  33. if GetDistance(NPC, morak_location) >= randdistance then
  34. MoveToLocation(NPC, leaderX - randX, leaderY + randY, leaderZ - randZ, speed)
  35. else
  36. speed = 2
  37. MoveToLocation(NPC, leaderX + 1, leaderY + 2, leaderZ - 1, speed)
  38. end
  39. speed = 2
  40. AddTimer(NPC, math.random(3000,10000), "FollowMorak")
  41. end