aMilitiapatroller_A_Follower.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --[[
  2. Script Name : SpawnScripts/OutpostOverlord/aMilitiapatroller_A_Follower.lua
  3. Script Author : Cynnar
  4. Script Date : 2018.10.07 10:10:32
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. AddTimer(NPC, 900, "followguard_A")
  10. end
  11. function followguard_A(NPC)
  12. local zone = GetZone(NPC)
  13. local guard_A_placement = GetSpawnByLocationID(zone, 399224)
  14. local sli = GetSpawnLocationID(NPC)
  15. local leaderX = GetX(guard_A_placement)
  16. local leaderY = GetY(guard_A_placement)
  17. local leaderZ = GetZ(guard_A_placement)
  18. local speed = 2
  19. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. ", " .. GetY(guard_A_placement) .. ", " .. GetZ(guard_A_placement))
  20. if sli == 399195 then
  21. if GetDistance(NPC, guard_A_placement) >= 8 then
  22. speed = 5
  23. MoveToLocation(NPC, leaderX - 2, leaderY, leaderZ, speed)
  24. else
  25. speed = 2
  26. MoveToLocation(NPC, leaderX - 2, leaderY, leaderZ, speed)
  27. end
  28. elseif sli == 399239 then
  29. if GetDistance(NPC, guard_A_placement) >= 8 then
  30. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. "")
  31. -- Say(NPC, "My location is: " .. GetX(NPC) .. "")
  32. speed = 5
  33. MoveToLocation(NPC, leaderX, leaderY, leaderZ - 2, speed)
  34. else
  35. speed = 2
  36. MoveToLocation(NPC, leaderX, leaderY, leaderZ - 2, speed)
  37. end
  38. elseif sli == 399179 then
  39. if GetDistance(NPC, guard_A_placement) >= 8 then
  40. MoveToLocation(NPC, leaderX + 2, leaderY, leaderZ, speed)
  41. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. "")
  42. -- Say(NPC, "My location is: " .. GetX(NPC) .. "")
  43. speed = 5
  44. else
  45. speed = 2
  46. MoveToLocation(NPC, leaderX + 2, leaderY, leaderZ, speed)
  47. end
  48. end
  49. speed = 2
  50. AddTimer(NPC, 3000, "followguard_A")
  51. end
  52. function hailed(NPC, Spawn)
  53. FaceTarget(NPC, Spawn)
  54. end
  55. function respawn(NPC)
  56. end