9
3

FerithAnar.lua 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. --[[
  2. Script Name : SpawnScripts/Oakmyst/FerithAnar.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.01.15 08:01:25
  5. Script Purpose : Roaming for Ferith'Anar
  6. Note : Needs attention for switching between movement loops.
  7. --]]
  8. function spawn(NPC)
  9. waypoints(NPC)
  10. end
  11. function hailed(NPC, Spawn)
  12. FaceTarget(NPC, Spawn)
  13. end
  14. --an attempt at combining all three spawn locations
  15. function waypoints(NPC)
  16. if GetSpawnLocationID (NPC) == 422488 then
  17. waypoints1(NPC)
  18. elseif GetSpawnLocationID (NPC) == 422489 then
  19. waypoints2(NPC)
  20. elseif GetSpawnLocationID (NPC) == 422493 then
  21. waypoints3(NPC)
  22. end
  23. end
  24. -- Movement Loop sequences
  25. function waypoints1 (NPC)
  26. MovementLoopAddLocation(NPC, 798.83, 12.31, -265.92, 2, math.random(5, 10))
  27. MovementLoopAddLocation(NPC, 780.68, 13.35, -256, 2, 0)
  28. MovementLoopAddLocation(NPC, 767.57, 13.35, -242.98, 2, 0)
  29. MovementLoopAddLocation(NPC, 780.69, 13.69, -240.02, 2, 0)
  30. MovementLoopAddLocation(NPC, 785.51, 13.83, -233.94, 2, math.random(5, 10))
  31. MovementLoopAddLocation(NPC, 782.41, 12.74, -230.35, 2, 0)
  32. MovementLoopAddLocation(NPC, 782.96, 7.28, -223.98, 2, 0)
  33. MovementLoopAddLocation(NPC, 792.07, 7.09, -219.84, 2, math.random(5, 10))
  34. MovementLoopAddLocation(NPC, 810.64, 6.16, -222.51, 2, 0)
  35. MovementLoopAddLocation(NPC, 816.33, 5.79, -208.36, 2, 0)
  36. MovementLoopAddLocation(NPC, 826.31, 5.59, -204.66, 2, 0)
  37. MovementLoopAddLocation(NPC, 838.93, 8.16, -217.26, 2, math.random(5, 10))
  38. MovementLoopAddLocation(NPC, 852.59, 9.52, -228.04, 2, 0)
  39. MovementLoopAddLocation(NPC, 834.27, 3.83, -231.05, 2, 0)
  40. MovementLoopAddLocation(NPC, 845.08, 2.85, -239.5, 2, math.random(5, 10))
  41. MovementLoopAddLocation(NPC, 853.92, 2.51, -245.29, 2, 0)
  42. MovementLoopAddLocation(NPC, 844.65, 3.18, -265.4, 2, math.random(5, 10))
  43. MovementLoopAddLocation(NPC, 828.76, 5.19, -266.22, 2, 0)
  44. MovementLoopAddLocation(NPC, 815.82, 8.04, -279.82, 2, 0)
  45. MovementLoopAddLocation(NPC, 803.68, 11.49, -271.34, 2, math.random(5, 10), "Pathway1")
  46. end
  47. function waypoints2 (NPC)
  48. MovementLoopAddLocation(NPC, 815.2, 5.5, -216.43, 2, math.random(5, 10))
  49. MovementLoopAddLocation(NPC, 797.71, 7.03, -216.74, 2, 0)
  50. MovementLoopAddLocation(NPC, 786.46, 7.1, -222.21, 2, 0)
  51. MovementLoopAddLocation(NPC, 792.64, 7.1, -226.55, 2, 0)
  52. MovementLoopAddLocation(NPC, 805.57, 14.37, -231.79, 2, math.random(5, 10))
  53. MovementLoopAddLocation(NPC, 802.54, 14.47, -233.72, 2, 0)
  54. MovementLoopAddLocation(NPC, 795.06, 18.79, -237.68, 2, 0)
  55. MovementLoopAddLocation(NPC, 807.97, 13.78, -232.59, 2, math.random(5, 10))
  56. MovementLoopAddLocation(NPC, 817.14, 5.22, -224.89, 2, 0)
  57. MovementLoopAddLocation(NPC, 817.1, 5.72, -210.38, 2, 0)
  58. MovementLoopAddLocation(NPC, 824.87, 4.83, -197.5, 2, math.random(5, 10))
  59. MovementLoopAddLocation(NPC, 831.04, 4.56, -194, 2, 0)
  60. MovementLoopAddLocation(NPC, 846.98, 8.88, -222.33, 2, 0)
  61. MovementLoopAddLocation(NPC, 878.25, 12.11, -219.89, 2, 0)
  62. MovementLoopAddLocation(NPC, 875.55, 11.81, -217.42, 2, math.random(5, 10))
  63. MovementLoopAddLocation(NPC, 852.82, 9.55, -228.08, 2, 0)
  64. MovementLoopAddLocation(NPC, 836.28, 3.64, -232.82, 2, 0)
  65. MovementLoopAddLocation(NPC, 844.36, 2.79, -240.17, 2, 0)
  66. MovementLoopAddLocation(NPC, 862.78, 1.72, -244.91, 2, math.random(5, 10))
  67. MovementLoopAddLocation(NPC, 858.83, 2.05, -244.82, 2, 0)
  68. MovementLoopAddLocation(NPC, 841.93, 3.11, -257.88, 2, 0)
  69. MovementLoopAddLocation(NPC, 836.95, 4.32, -241.68, 2, math.random(5, 10))
  70. MovementLoopAddLocation(NPC, 828.29, 12.61, -243.23, 2, math.random(5, 10))
  71. MovementLoopAddLocation(NPC, 820.03, 13.53, -237.38, 2, 0)
  72. MovementLoopAddLocation(NPC, 808.95, 6.35, -221.05, 2, math.random(5, 10),"Pathway2")
  73. end
  74. function waypoints3 (NPC)
  75. MovementLoopAddLocation(NPC, 901.38, 1.95, -275.18, 2, math.random(5, 10))
  76. MovementLoopAddLocation(NPC, 893.49, 1.12, -266.46, 2, 0)
  77. MovementLoopAddLocation(NPC, 886.73, 0.63, -255.32, 2, 0)
  78. MovementLoopAddLocation(NPC, 881.28, 0.24, -247.69, 2, 0)
  79. MovementLoopAddLocation(NPC, 860.08, 1.95, -244.64, 2, math.random(5, 10))
  80. MovementLoopAddLocation(NPC, 854.8, 2.4, -244.8, 2, 0)
  81. MovementLoopAddLocation(NPC, 852.13, 2.65, -250.7, 2, math.random(5, 10))
  82. MovementLoopAddLocation(NPC, 850.71, 2.77, -259.23, 2, 0)
  83. MovementLoopAddLocation(NPC, 857.74, 11.76, -272.58, 2, 0)
  84. MovementLoopAddLocation(NPC, 854.23, 12.99, -280.31, 2, 0)
  85. MovementLoopAddLocation(NPC, 838.11, 13.22, -285.98, 2, math.random(5, 10))
  86. MovementLoopAddLocation(NPC, 849.23, 13.48, -289.53, 2, 0)
  87. MovementLoopAddLocation(NPC, 847.94, 13.31, -297.82, 2, math.random(5, 10))
  88. MovementLoopAddLocation(NPC, 858.83, 13.05, -288.69, 2, 0)
  89. MovementLoopAddLocation(NPC, 879.44, 10.48, -281.42, 2, math.random(5, 10))
  90. MovementLoopAddLocation(NPC, 876.51, 11.24, -290.14, 2, 0)
  91. MovementLoopAddLocation(NPC, 885.3, 10.5, -295.68, 2, math.random(5, 10))
  92. MovementLoopAddLocation(NPC, 891.65, 8.62, -292.25, 2, 0)
  93. MovementLoopAddLocation(NPC, 900.08, 2.28, -293.41, 2, 0)
  94. MovementLoopAddLocation(NPC, 896.93, 1.66, -269.96, 2, "Pathway3")
  95. end
  96. function respawn(NPC)
  97. spawn(NPC)
  98. end
  99. -- Triggering Loop sequence rotation after initial time through movement waypoints
  100. -- Does not work currently - Movement loops only repeat first pattern.
  101. function Pathway3 (NPC)
  102. local choice = MakeRandomInt(1, 2)
  103. -- if choice == 1 then
  104. --waypoints3(NPC)
  105. if choice == 2 then
  106. MoveToLocation(NPC, 879.66, 0.31, -245.20,2)
  107. MoveToLocation(NPC, 867.08, 1.34, -245.34,2)
  108. MoveToLocation(NPC, 867.08, 1.34, -245.34,2)
  109. waypoints2(NPC)
  110. else
  111. MoveToLocation(NPC, 852.36, 2.65, -244.06,2)
  112. MoveToLocation(NPC, 823.06, 6.45, -267.52,2)
  113. MoveToLocation(NPC, 818.50, 7.36, -278.27,2)
  114. MoveToLocation(NPC, 818.50, 7.36, -278.27,2)
  115. waypoints1(NPC)
  116. end
  117. end
  118. function Pathway2 (NPC)
  119. local choice = MakeRandomInt(1, 2)
  120. -- if choice == 1 then
  121. -- waypoints2 (NPC)
  122. if choice == 2 then
  123. MoveToLocation(NPC, 835.77, 3.68, -235.72,2)
  124. MoveToLocation(NPC, 839.33, 3.49, -257.94,2)
  125. MoveToLocation(NPC, 839.33, 3.49, -257.94,2)
  126. waypoints1(NPC)
  127. else
  128. MoveToLocation(NPC,856.26, 2.23, -242.68,2)
  129. MoveToLocation(NPC,883.08, 0.24, -249.14,2)
  130. MoveToLocation(NPC,883.08, 0.24, -249.14,2)
  131. waypoints3(NPC)
  132. end
  133. end
  134. function Pathway1 (NPC)
  135. local choice = MakeRandomInt(1, 2)
  136. -- if choice == 1 then
  137. -- waypoints1(NPC)
  138. if choice == 2 then
  139. MoveToLocation(NPC, 822.16, 6.54, -282.55,2)
  140. MoveToLocation(NPC, 844.21, 4.49, -318.7,2)
  141. MoveToLocation(NPC, 861.05, 2.11, -322.19,2)
  142. MoveToLocation(NPC, 872.81, 1.36, -320.97,0)
  143. MoveToLocation(NPC, 898.02, 2.14, -318.28,2)
  144. MoveToLocation(NPC, 911.11, 2.28, -304.26,2)
  145. MoveToLocation(NPC, 911.11, 2.28, -304.26,2)
  146. waypoints3(NPC)
  147. else
  148. MoveToLocation(NPC, 783.2, 13.35, -250.47,2)
  149. MoveToLocation(NPC, 794.22, 18.68, -237.53,2)
  150. MoveToLocation(NPC, 805.6, 14.40, -232.05,2)
  151. MoveToLocation(NPC, 805.6, 14.40, -232.05,2)
  152. waypoints2(NPC)
  153. end
  154. end