9
3

aQeynosGuardsmanHumanLeft.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --[[
  2. Script Name : SpawnScripts/QueensColony/aQeynosGuardsmanHumanLeft.lua
  3. Script Author : Cynnar (edited by Rylec)
  4. Script Date : 2018.10.07 10:10:32
  5. Script Purpose : Follower starting in left position
  6. --]]
  7. function spawn(NPC)
  8. AddTimer(NPC, 900, "followguard_A")
  9. local shouttime = math.random (90000,270000)
  10. AddTimer(NPC, shouttime, "shout")
  11. end
  12. function followguard_A(NPC)
  13. local zone = GetZone(NPC)
  14. local guard_A_placement = GetSpawnByLocationID(zone, 430688)
  15. local sli = GetSpawnLocationID(NPC)
  16. local leaderX = GetX(guard_A_placement)
  17. local leaderY = GetY(guard_A_placement)
  18. local leaderZ = GetZ(guard_A_placement)
  19. local speed = 2
  20. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. ", " .. GetY(guard_A_placement) .. ", " .. GetZ(guard_A_placement))
  21. if sli == 133770887 then
  22. if GetDistance(NPC, guard_A_placement) >= 8 then
  23. speed = 5
  24. MoveToLocation(NPC, leaderX - 2, leaderY, leaderZ, speed)
  25. else
  26. speed = 2
  27. MoveToLocation(NPC, leaderX - 2, leaderY, leaderZ, speed)
  28. end
  29. elseif sli == 133770888 then
  30. if GetDistance(NPC, guard_A_placement) >= 8 then
  31. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. "")
  32. -- Say(NPC, "My location is: " .. GetX(NPC) .. "")
  33. speed = 5
  34. MoveToLocation(NPC, leaderX, leaderY, leaderZ - 2, speed)
  35. else
  36. speed = 2
  37. MoveToLocation(NPC, leaderX, leaderY, leaderZ - 2, speed)
  38. end
  39. elseif sli == 133770889 then
  40. if GetDistance(NPC, guard_A_placement) >= 8 then
  41. MoveToLocation(NPC, leaderX + 2, leaderY, leaderZ, speed)
  42. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. "")
  43. -- Say(NPC, "My location is: " .. GetX(NPC) .. "")
  44. speed = 5
  45. else
  46. speed = 2
  47. MoveToLocation(NPC, leaderX + 2, leaderY, leaderZ, speed)
  48. end
  49. end
  50. speed = 2
  51. AddTimer(NPC, 3000, "followguard_A")
  52. end
  53. function hailed(NPC, Spawn)
  54. FaceTarget(NPC, Spawn)
  55. end
  56. function respawn(NPC)
  57. spawn(NPC)
  58. end
  59. function shout(NPC)
  60. math.randomseed(os.time())
  61. local choice = math.random (1,3)
  62. if choice == 1 then
  63. Say(NPC, "I'll bet you an ale that I spot the next intruder first.")
  64. Emote(NPC, "smack his fist into his palm.")
  65. elseif choice == 2 then
  66. Say(NPC, "In honor of the Queen.")
  67. Emote(NPC, "salutes.")
  68. elseif choice == 3 then
  69. Say(NPC, "Keep your eyes peeled boys!")
  70. end
  71. local time = math.random (90000,2700000)
  72. AddTimer(NPC, time, "shout")
  73. end