9
3

aQeynosGuardsmanFollower.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. --[[
  2. Script Name : SpawnScripts/QueensColony/aQeynosGuardsmanFollower.lua
  3. Script Author : Cynnar (edited by Rylec)
  4. Script Date : 2018.10.07 10:10:32
  5. Script Purpose : Patrol follower. Script will set model type to allow all relevant races
  6. --]]
  7. function spawn(NPC)
  8. setmodel(NPC)
  9. AddTimer(NPC, 900, "followguard_A")
  10. end
  11. function hailed(NPC, Spawn)
  12. FaceTarget(NPC, Spawn)
  13. end
  14. function respawn(NPC)
  15. spawn(NPC)
  16. end
  17. function setmodel(NPC)
  18. local RandomModel = math.random (1,4)
  19. local shouttime = math.random (90000,270000)
  20. if RandomModel == 1 then
  21. SpawnSet(NPC, "model_type", "82")
  22. AddTimer(NPC, shouttime, "kerra")
  23. elseif RandomModel == 2 then
  24. SpawnSet(NPC, "model_type", "110")
  25. AddTimer(NPC, shouttime, "dwarf")
  26. elseif RandomModel == 3 then
  27. SpawnSet(NPC, "model_type", "112")
  28. AddTimer(NPC, shouttime, "barbarian")
  29. elseif RandomModel == 4 then
  30. SpawnSet(NPC, "model_type", "134")
  31. AddTimer(NPC, shouttime, "human")
  32. end
  33. end
  34. function followguard_A(NPC)
  35. local zone = GetZone(NPC)
  36. local guard_A_placement = GetSpawnByLocationID(zone, 430688)
  37. local sli = GetSpawnLocationID(NPC)
  38. local leaderX = GetX(guard_A_placement)
  39. local leaderY = GetY(guard_A_placement)
  40. local leaderZ = GetZ(guard_A_placement)
  41. local speed = 2
  42. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. ", " .. GetY(guard_A_placement) .. ", " .. GetZ(guard_A_placement))
  43. if sli == 133770887 then
  44. if GetDistance(NPC, guard_A_placement) >= 8 then
  45. speed = 5
  46. MoveToLocation(NPC, leaderX - 2, leaderY, leaderZ, speed)
  47. else
  48. speed = 2
  49. MoveToLocation(NPC, leaderX - 2, leaderY, leaderZ, speed)
  50. end
  51. elseif sli == 133770888 then
  52. if GetDistance(NPC, guard_A_placement) >= 8 then
  53. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. "")
  54. -- Say(NPC, "My location is: " .. GetX(NPC) .. "")
  55. speed = 5
  56. MoveToLocation(NPC, leaderX, leaderY, leaderZ - 2, speed)
  57. else
  58. speed = 2
  59. MoveToLocation(NPC, leaderX, leaderY, leaderZ - 2, speed)
  60. end
  61. elseif sli == 133770889 then
  62. if GetDistance(NPC, guard_A_placement) >= 8 then
  63. MoveToLocation(NPC, leaderX + 2, leaderY, leaderZ, speed)
  64. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. "")
  65. -- Say(NPC, "My location is: " .. GetX(NPC) .. "")
  66. speed = 5
  67. else
  68. speed = 2
  69. MoveToLocation(NPC, leaderX + 2, leaderY, leaderZ, speed)
  70. end
  71. end
  72. speed = 2
  73. AddTimer(NPC, 3000, "followguard_A")
  74. end
  75. function kerra(NPC)
  76. math.randomseed(os.time())
  77. local choice = math.random (1,3)
  78. if choice == 1 then
  79. Say(NPC, "Wraaaaa!")
  80. elseif choice == 2 then
  81. Say(NPC, "For Qeynos!")
  82. elseif choice == 3 then
  83. Say(NPC, "Look at Luclin! Shar Vahl...")
  84. Emote(NPC, "groans.")
  85. end
  86. local time = math.random (90000,2700000)
  87. AddTimer(NPC, time, "kerra")
  88. end
  89. function dwarf(NPC)
  90. math.randomseed(os.time())
  91. local choice = math.random (1,3)
  92. if choice == 1 then
  93. Say(NPC, "When I am off duty that rock is mine!")
  94. Emote(NPC, "points at a shiny stone.")
  95. elseif choice == 2 then
  96. Say(NPC, "For the strength of Kaladim!")
  97. elseif choice == 3 then
  98. Say(NPC, "Onward boys and keep in line!")
  99. end
  100. local time = math.random (90000,2700000)
  101. AddTimer(NPC, time, "dwarf")
  102. end
  103. function barbarian(NPC)
  104. math.randomseed(os.time())
  105. local choice = math.random (1,3)
  106. if choice == 1 then
  107. Say(NPC, "For the love of Halas, I could use a stout!")
  108. elseif choice == 2 then
  109. Say(NPC, "All clear here!")
  110. elseif choice == 3 then
  111. Say(NPC, "I long to return to Qeynos.")
  112. end
  113. local time = math.random (90000,2700000)
  114. AddTimer(NPC, time, "barbarian")
  115. end
  116. function human(NPC)
  117. math.randomseed(os.time())
  118. local choice = math.random (1,3)
  119. if choice == 1 then
  120. Say(NPC, "I'll bet you an ale that I spot the next intruder first.")
  121. Emote(NPC, "smack his fist into his palm.")
  122. elseif choice == 2 then
  123. Say(NPC, "In honor of the Queen.")
  124. Emote(NPC, "salutes.")
  125. elseif choice == 3 then
  126. Say(NPC, "Keep your eyes peeled boys!")
  127. end
  128. local time = math.random (90000,2700000)
  129. AddTimer(NPC, time, "human")
  130. end