amorakdevourer1587718.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. SpawnSet(NPC, "difficulty", "2")
  10. AddTimer(NPC, 2000, "FollowMorak")
  11. end
  12. function hailed(NPC, Spawn)
  13. FaceTarget(NPC, Spawn)
  14. end
  15. function respawn(NPC)
  16. spawn(NPC)
  17. end
  18. function FollowMorak(NPC)
  19. local zone = GetZone(NPC)
  20. local morak_location = GetSpawnByLocationID(zone, 1587717)
  21. local leaderX = GetX(morak_location)
  22. local leaderY = GetY(morak_location)
  23. local leaderZ = GetZ(morak_location)
  24. local speed = 2
  25. local randdistance = math.random(1,5)
  26. local randX = math.random(1,5)
  27. local randY = math.random(1,5)
  28. local randZ = math.random(1,5)
  29. if GetDistance(NPC, morak_location) >= randdistance then
  30. MoveToLocation(NPC, leaderX - randX, leaderY + randY, leaderZ - randZ, speed)
  31. else
  32. speed = 2
  33. MoveToLocation(NPC, leaderX + 1, leaderY + 2, leaderZ - 1, speed)
  34. end
  35. speed = 2
  36. AddTimer(NPC, math.random(3000,10000), "FollowMorak")
  37. end