9
3

adrakerfly1586858.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --[[
  2. Script Name : SpawnScripts/everfrost_frostfell_new01/adrakerfly1586858.lua
  3. Script Purpose : Waypoint Path for adrakerfly1586858.lua
  4. Script Author : Rylec
  5. Script Date : 12-12-2019 07:17:18
  6. Script Notes : Script based on Verus Caldus (West Freeport patrolling guard)
  7. --]]
  8. function spawn(NPC)
  9. AddTimer(NPC, 900, "FollowUnicorn")
  10. end
  11. function hailed(NPC, Spawn)
  12. FaceTarget(NPC, Spawn)
  13. end
  14. function respawn(NPC)
  15. end
  16. function FollowUnicorn(NPC)
  17. local zone = GetZone(NPC)
  18. local unicorn_location = GetSpawnByLocationID(zone, 1586859)
  19. local leaderX = GetX(unicorn_location)
  20. local leaderY = GetY(unicorn_location)
  21. local leaderZ = GetZ(unicorn_location)
  22. local speed = 2
  23. local randdistance = math.random(1,15)
  24. local randX = math.random(1,3)
  25. local randY = math.random(1,3)
  26. local randZ = math.random(1,3)
  27. -- Say(NPC, "Random number: " .. randdistance .. "")
  28. if GetDistance(NPC, unicorn_location) >= randdistance then
  29. speed = 5
  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, 3500, "FollowUnicorn")
  37. end