aQeynosGuardsmanHuman.lua 2.9 KB

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