Kith.lua 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. --[[
  2. Script Name : SpawnScripts/BeggarsCourt/Kith.lua
  3. Script Author : Dorbin
  4. Script Date : 2018.07.08 10:07:36
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/CombatModule"
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 7, "InRange", "LeaveRange")
  11. SetTempVariable(NPC,"HissTimer", "0")
  12. AddTimer(NPC,MakeRandomInt(3000,6000),"waypoints")
  13. end
  14. function InRange(NPC,Spawn)
  15. if not IsInCombat(NPC) and GetTempVariable(NPC,"HissTimer")~="1" then
  16. local Choice = MakeRandomInt(0,100)
  17. if GetRace(Spawn)== 13 then
  18. if Choice <=60 then
  19. InRange_Attack(NPC,Spawn)
  20. end
  21. elseif Choice <= 15 then
  22. InRange_Attack(NPC,Spawn)
  23. end
  24. end
  25. end
  26. function InRange_Attack(NPC,Spawn)
  27. local Choice = MakeRandomInt(1,2)
  28. if Choice == 1 then
  29. FaceTarget(NPC,Spawn)
  30. AddTimer(NPC,1000,"HissAttack",1,Spawn)
  31. elseif Choice == 2 then
  32. AddTimer(NPC,500,"Hiss",1,Spawn)
  33. end
  34. SetTempVariable(NPC,"HissTimer", "1")
  35. AddTimer(NPC,65000,"HissReset",1,Spawn)
  36. end
  37. function HissAttack(NPC,Spawn)
  38. PlayFlavor(NPC,"","","attack",0,0)
  39. end
  40. function Hiss(NPC,Spawn)
  41. local Choice = MakeRandomInt(1,2)
  42. if Choice == 1 then
  43. PlaySound(NPC,"sounds/critters/cat/cat_hiss001.wav",GetX(NPC), GetY(NPC), GetZ(NPC))
  44. else
  45. PlaySound(NPC,"sounds/critters/cat/cat_hiss002.wav",GetX(NPC), GetY(NPC), GetZ(NPC))
  46. end
  47. end
  48. function HissReset(NPC,Spawn)
  49. SetTempVariable(NPC,"HissTimer", "0")
  50. end
  51. function waypoints(NPC)
  52. if MakeRandomInt(1,2) == 1 then
  53. MovementLoopAddLocation(NPC, 29.96, 3.5, 4.4, 1, 0)
  54. MovementLoopAddLocation(NPC, 37.9, 3.5, 2.99, 1, MakeRandomInt(8,16))
  55. MovementLoopAddLocation(NPC, 45.43, 3.5, -0.12, 1, 0)
  56. MovementLoopAddLocation(NPC, 46.58, 3.5, -2.74, 1, 0)
  57. MovementLoopAddLocation(NPC, 48.04, 4, -8.21, 1, MakeRandomInt(8,16))
  58. MovementLoopAddLocation(NPC, 43.66, 3.76, -9.6, 1, 0)
  59. MovementLoopAddLocation(NPC, 39.2, 5.15, -11.27, 1, 0)
  60. MovementLoopAddLocation(NPC, 39.2, 5.15, -11.27, 1, 0)
  61. MovementLoopAddLocation(NPC, 37.88, 5.25, -11.96, 1, 0)
  62. MovementLoopAddLocation(NPC, 29.44, 5.25, -15.14, 1, 0)
  63. MovementLoopAddLocation(NPC, 23.76, 5.25, -17.37, 1, MakeRandomInt(8,16))
  64. MovementLoopAddLocation(NPC, 22.52, 5.25, -20.46, 1, 0)
  65. MovementLoopAddLocation(NPC, 21.59, 5.25, -26.12, 1, MakeRandomInt(8,16))
  66. MovementLoopAddLocation(NPC, 17.35, 5, -25.97, 1, 0)
  67. MovementLoopAddLocation(NPC, 10.61, 4.75, -24.79, 1, 0)
  68. MovementLoopAddLocation(NPC, 3.95, 4.75, -29.18, 1, 0)
  69. MovementLoopAddLocation(NPC, 2.8, 5, -32.38, 1, 0)
  70. MovementLoopAddLocation(NPC, 3.51, 6.05, -36.6, 1, 30)
  71. MovementLoopAddLocation(NPC, 1.62, 5, -35.55, 1, 0)
  72. MovementLoopAddLocation(NPC, 1.69, 4.75, -31.27, 1, 0)
  73. MovementLoopAddLocation(NPC, 0.14, 4.25, -27.79, 1, 0)
  74. MovementLoopAddLocation(NPC, -1.15, 3.75, -24.35, 1, 0)
  75. MovementLoopAddLocation(NPC, -2.43, 3.5, -20.94, 1, 0)
  76. MovementLoopAddLocation(NPC, -1.45, 3.5, -17.13, 1, 0)
  77. MovementLoopAddLocation(NPC, 0.6, 3.5, -13.28, 1, MakeRandomInt(8,16))
  78. MovementLoopAddLocation(NPC, -0.35, 3.5, -10.13, 1, 0)
  79. MovementLoopAddLocation(NPC, -2.81, 3.5, -8.76, 1, 0)
  80. MovementLoopAddLocation(NPC, -6.82, 3, -9.05, 1, MakeRandomInt(8,16))
  81. MovementLoopAddLocation(NPC, -9.17, 3, -9.37, 1, 0)
  82. MovementLoopAddLocation(NPC, -8.68, 3, -12.98, 1, 0)
  83. MovementLoopAddLocation(NPC, -8.44, 3, -18, 1, 0)
  84. MovementLoopAddLocation(NPC, -10.69, 3, -17.97, 1, MakeRandomInt(8,16))
  85. MovementLoopAddLocation(NPC, -13.06, 3, -20.7, 1, 0)
  86. MovementLoopAddLocation(NPC, -14.85, 3, -20.62, 1, 0)
  87. MovementLoopAddLocation(NPC, -15.72, 3, -16.58, 1, MakeRandomInt(8,16))
  88. MovementLoopAddLocation(NPC, -15.4, 3, -13.91, 1, 0)
  89. MovementLoopAddLocation(NPC, -14.95, 2.5, -8.4, 1, 0)
  90. MovementLoopAddLocation(NPC, -11.73, 2, -0.16, 1, 0)
  91. MovementLoopAddLocation(NPC, -8.85, 2.02, 4.76, 1, MakeRandomInt(8,16))
  92. MovementLoopAddLocation(NPC, -12.77, 2, 1.04, 1, 0)
  93. MovementLoopAddLocation(NPC, -15.05, 2, 0.7, 4, 2)
  94. MovementLoopAddLocation(NPC, -17.55, 2.04, 1.72, 4, 0)
  95. MovementLoopAddLocation(NPC, -20.93, 1.87, 5.23, 4, 0)
  96. MovementLoopAddLocation(NPC, -26.59, -0.75, 2.94, 4, 0)
  97. MovementLoopAddLocation(NPC, -27.35, -0.75, 4.8, 4, 0)
  98. MovementLoopAddLocation(NPC, -26.43, -0.8, 5.55, 4, 0)
  99. MovementLoopAddLocation(NPC, -18.26, -5.04, 9.36, 4, 0)
  100. MovementLoopAddLocation(NPC, -18.1, -5, 11.52, 4, 0)
  101. MovementLoopAddLocation(NPC, -20.64, -5, 13.69, 4, 2)
  102. MovementLoopAddLocation(NPC, -21.32, -5, 19.96, 1, 30)
  103. MovementLoopAddLocation(NPC, -23.79, -5, 19.76, 1, 0)
  104. MovementLoopAddLocation(NPC, -25.77, -5, 19, 1, 0)
  105. MovementLoopAddLocation(NPC, -29, -5.25, 19.07, 1, 0)
  106. MovementLoopAddLocation(NPC, -26.26, -5.75, 23.49, 1, 0)
  107. MovementLoopAddLocation(NPC, -17.58, -7, 30.99, 1, 0)
  108. MovementLoopAddLocation(NPC, -10.25, -7, 42.6, 1, 0)
  109. MovementLoopAddLocation(NPC, -11.31, -7, 48.66, 1, MakeRandomInt(8,16))
  110. MovementLoopAddLocation(NPC, 4.71, -7, 59.52, 1, MakeRandomInt(8,16))
  111. MovementLoopAddLocation(NPC, 16.21, -7, 50.4, 1, 0)
  112. MovementLoopAddLocation(NPC, 17.53, -6, 43.91, 1, 0)
  113. MovementLoopAddLocation(NPC, 17.33, -6, 39.91, 1, MakeRandomInt(8,16))
  114. MovementLoopAddLocation(NPC, 13.67, -5.5, 32.8, 1, 0)
  115. MovementLoopAddLocation(NPC, 8.68, -5.5, 30.84, 1, 0)
  116. MovementLoopAddLocation(NPC, 4.82, -5.5, 27.91, 1, 0)
  117. MovementLoopAddLocation(NPC, 5.9, -5, 21.06, 1, MakeRandomInt(8,16))
  118. MovementLoopAddLocation(NPC, 15, -5, 26.38, 1, 0)
  119. MovementLoopAddLocation(NPC, 21.19, -5, 26.16, 1, 0)
  120. MovementLoopAddLocation(NPC, 33.62, -5, 28.12, 1, 0)
  121. MovementLoopAddLocation(NPC, 45.73, -5, 30.41, 1, 0)
  122. MovementLoopAddLocation(NPC, 48.05, -5, 36.37, 1, MakeRandomInt(8,16))
  123. MovementLoopAddLocation(NPC, 33.34, -5, 30.22, 1, 0)
  124. MovementLoopAddLocation(NPC, 31.44, -5, 23.24, 4, 2)
  125. MovementLoopAddLocation(NPC, 37.17, -3.56, 23.02, 4, 0)
  126. MovementLoopAddLocation(NPC, 41.93, -1.1, 24.14, 4, 0)
  127. MovementLoopAddLocation(NPC, 48.26, 1.86, 25.26, 4, 0)
  128. MovementLoopAddLocation(NPC, 49.49, 1.91, 24.58, 4, 0)
  129. MovementLoopAddLocation(NPC, 49.05, 2, 21.4, 4, 0)
  130. MovementLoopAddLocation(NPC, 52.68, 2, 18.88, 4, 2)
  131. MovementLoopAddLocation(NPC, 42.93, 2, 15.24, 1, 0)
  132. MovementLoopAddLocation(NPC, 36.16, 3.5, -1.75, 1, MakeRandomInt(8,16))
  133. MovementLoopAddLocation(NPC, 34.14, 5.25, -10.41, 1, 0)
  134. MovementLoopAddLocation(NPC, 32.3, 5.25, -14.52, 1, MakeRandomInt(8,16))
  135. MovementLoopAddLocation(NPC, 20.04, 5.25, -10.78, 1, 30)
  136. MovementLoopAddLocation(NPC, 20.04, 5.25, -10.78, 1, 0)
  137. MovementLoopAddLocation(NPC, 21.63, 5.25, -9.94, 1, 0)
  138. MovementLoopAddLocation(NPC, 23.33, 5.25, -9.37, 1, 0)
  139. MovementLoopAddLocation(NPC, 24.22, 5.01, -7.44, 1, 0)
  140. MovementLoopAddLocation(NPC, 30.13, 3.5, 4.37, 1, MakeRandomInt(8,16))
  141. MovementLoopAddLocation(NPC, 14.46, 3.5, 1.5, 1, MakeRandomInt(8,16))
  142. else
  143. MovementLoopAddLocation(NPC, 14.46, 3.5, 1.5, 1, MakeRandomInt(8,16))
  144. MovementLoopAddLocation(NPC, 30.13, 3.5, 4.37, 1, MakeRandomInt(8,16))
  145. MovementLoopAddLocation(NPC, 24.22, 5.01, -7.44, 1, 0)
  146. MovementLoopAddLocation(NPC, 23.33, 5.25, -9.37, 1, 0)
  147. MovementLoopAddLocation(NPC, 21.63, 5.25, -9.94, 1, 0)
  148. MovementLoopAddLocation(NPC, 20.04, 5.25, -10.78, 1, 0)
  149. MovementLoopAddLocation(NPC, 20.04, 5.25, -10.78, 1, 30)
  150. MovementLoopAddLocation(NPC, 20.04, 5.25, -10.78, 1, 0)
  151. MovementLoopAddLocation(NPC, 32.3, 5.25, -14.52, 1, MakeRandomInt(8,16))
  152. MovementLoopAddLocation(NPC, 34.14, 5.25, -10.41, 1, 0)
  153. MovementLoopAddLocation(NPC, 36.16, 3.5, -1.75, 1, MakeRandomInt(8,16))
  154. MovementLoopAddLocation(NPC, 42.93, 2, 15.24, 1, 0)
  155. MovementLoopAddLocation(NPC, 52.68, 2, 18.88, 4, 2)
  156. MovementLoopAddLocation(NPC, 49.05, 2, 21.4, 4, 0)
  157. MovementLoopAddLocation(NPC, 49.49, 1.91, 24.58, 4, 0)
  158. MovementLoopAddLocation(NPC, 48.26, 1.86, 25.26, 4, 0)
  159. MovementLoopAddLocation(NPC, 41.93, -1.1, 24.14, 4, 0)
  160. MovementLoopAddLocation(NPC, 37.17, -3.56, 23.02, 4, 0)
  161. MovementLoopAddLocation(NPC, 31.44, -5, 23.24, 4, 2)
  162. MovementLoopAddLocation(NPC, 33.34, -5, 30.22, 1, 0)
  163. MovementLoopAddLocation(NPC, 48.05, -5, 36.37, 1, MakeRandomInt(8,16))
  164. MovementLoopAddLocation(NPC, 45.73, -5, 30.41, 1, 0)
  165. MovementLoopAddLocation(NPC, 33.62, -5, 28.12, 1, 0)
  166. MovementLoopAddLocation(NPC, 21.19, -5, 26.16, 1, 0)
  167. MovementLoopAddLocation(NPC, 15, -5, 26.38, 1, 0)
  168. MovementLoopAddLocation(NPC, 5.9, -5, 21.06, 1, MakeRandomInt(8,16))
  169. MovementLoopAddLocation(NPC, 4.82, -5.5, 27.91, 1, 0)
  170. MovementLoopAddLocation(NPC, 8.68, -5.5, 30.84, 1, 0)
  171. MovementLoopAddLocation(NPC, 13.67, -5.5, 32.8, 1, 0)
  172. MovementLoopAddLocation(NPC, 17.33, -6, 39.91, 1, MakeRandomInt(8,16))
  173. MovementLoopAddLocation(NPC, 17.53, -6, 43.91, 1, 0)
  174. MovementLoopAddLocation(NPC, 16.21, -7, 50.4, 1, 0)
  175. MovementLoopAddLocation(NPC, 4.71, -7, 59.52, 1, MakeRandomInt(8,16))
  176. MovementLoopAddLocation(NPC, -11.31, -7, 48.66, 1, MakeRandomInt(8,16))
  177. MovementLoopAddLocation(NPC, -10.25, -7, 42.6, 1, 0)
  178. MovementLoopAddLocation(NPC, -17.58, -7, 30.99, 1, 0)
  179. MovementLoopAddLocation(NPC, -26.26, -5.75, 23.49, 1, 0)
  180. MovementLoopAddLocation(NPC, -29, -5.25, 19.07, 1, 0)
  181. MovementLoopAddLocation(NPC, -25.77, -5, 19, 1, 0)
  182. MovementLoopAddLocation(NPC, -23.79, -5, 19.76, 1, 0)
  183. MovementLoopAddLocation(NPC, -21.32, -5, 19.96, 1, 30)
  184. MovementLoopAddLocation(NPC, -23.79, -5, 19.76, 1, 0)
  185. MovementLoopAddLocation(NPC, -20.64, -5, 13.69, 4, 2)
  186. MovementLoopAddLocation(NPC, -18.1, -5, 11.52, 4, 0)
  187. MovementLoopAddLocation(NPC, -18.26, -5.04, 9.36, 4, 0)
  188. MovementLoopAddLocation(NPC, -26.43, -0.8, 5.55, 4, 0)
  189. MovementLoopAddLocation(NPC, -27.35, -0.75, 4.8, 4, 0)
  190. MovementLoopAddLocation(NPC, -26.59, -0.75, 2.94, 4, 0)
  191. MovementLoopAddLocation(NPC, -20.93, 1.87, 5.23, 4, 0)
  192. MovementLoopAddLocation(NPC, -17.55, 2.04, 1.72, 4, 0)
  193. MovementLoopAddLocation(NPC, -15.05, 2, 0.7, 4, 2)
  194. MovementLoopAddLocation(NPC, -12.77, 2, 1.04, 1, 0)
  195. MovementLoopAddLocation(NPC, -8.85, 2.02, 4.76, 1, MakeRandomInt(8,16))
  196. MovementLoopAddLocation(NPC, -11.73, 2, -0.16, 1, 0)
  197. MovementLoopAddLocation(NPC, -14.95, 2.5, -8.4, 1, 0)
  198. MovementLoopAddLocation(NPC, -15.4, 3, -13.91, 1, 0)
  199. MovementLoopAddLocation(NPC, -15.72, 3, -16.58, 1, MakeRandomInt(8,16))
  200. MovementLoopAddLocation(NPC, -14.85, 3, -20.62, 1, 0)
  201. MovementLoopAddLocation(NPC, -13.06, 3, -20.7, 1, 0)
  202. MovementLoopAddLocation(NPC, -10.69, 3, -17.97, 1, MakeRandomInt(8,16))
  203. MovementLoopAddLocation(NPC, -8.44, 3, -18, 1, 0)
  204. MovementLoopAddLocation(NPC, -8.68, 3, -12.98, 1, 0)
  205. MovementLoopAddLocation(NPC, -9.17, 3, -9.37, 1, 0)
  206. MovementLoopAddLocation(NPC, -6.82, 3, -9.05, 1, MakeRandomInt(8,16))
  207. MovementLoopAddLocation(NPC, -2.81, 3.5, -8.76, 1, 0)
  208. MovementLoopAddLocation(NPC, -0.35, 3.5, -10.13, 1, 0)
  209. MovementLoopAddLocation(NPC, 0.6, 3.5, -13.28, 1, MakeRandomInt(8,16))
  210. MovementLoopAddLocation(NPC, -1.45, 3.5, -17.13, 1, 0)
  211. MovementLoopAddLocation(NPC, -2.43, 3.5, -20.94, 1, 0)
  212. MovementLoopAddLocation(NPC, -1.15, 3.75, -24.35, 1, 0)
  213. MovementLoopAddLocation(NPC, 0.14, 4.25, -27.79, 1, 0)
  214. MovementLoopAddLocation(NPC, 1.69, 4.75, -31.27, 1, 0)
  215. MovementLoopAddLocation(NPC, 1.62, 5, -35.55, 1, 0)
  216. MovementLoopAddLocation(NPC, 3.51, 6.05, -36.6, 1, 30)
  217. MovementLoopAddLocation(NPC, 3.51, 6.05, -36.6, 1, 0)
  218. MovementLoopAddLocation(NPC, 2.8, 5, -32.38, 1, 0)
  219. MovementLoopAddLocation(NPC, 3.95, 4.75, -29.18, 1, 0)
  220. MovementLoopAddLocation(NPC, 10.61, 4.75, -24.79, 1, 0)
  221. MovementLoopAddLocation(NPC, 17.35, 5, -25.97, 1, 0)
  222. MovementLoopAddLocation(NPC, 21.59, 5.25, -26.12, 1, MakeRandomInt(8,16))
  223. MovementLoopAddLocation(NPC, 22.52, 5.25, -20.46, 1, 0)
  224. MovementLoopAddLocation(NPC, 23.76, 5.25, -17.37, 1, MakeRandomInt(8,16))
  225. MovementLoopAddLocation(NPC, 29.44, 5.25, -15.14, 1, 0)
  226. MovementLoopAddLocation(NPC, 37.88, 5.25, -11.96, 1, 0)
  227. MovementLoopAddLocation(NPC, 39.2, 5.15, -11.27, 1, 0)
  228. MovementLoopAddLocation(NPC, 39.2, 5.15, -11.27, 1, 0)
  229. MovementLoopAddLocation(NPC, 43.66, 3.76, -9.6, 1, 0)
  230. MovementLoopAddLocation(NPC, 48.04, 4, -8.21, 1, MakeRandomInt(8,16))
  231. MovementLoopAddLocation(NPC, 46.58, 3.5, -2.74, 1, 0)
  232. MovementLoopAddLocation(NPC, 45.43, 3.5, -0.12, 1, 0)
  233. MovementLoopAddLocation(NPC, 37.9, 3.5, 2.99, 1, MakeRandomInt(8,16))
  234. MovementLoopAddLocation(NPC, 29.96, 3.5, 4.4, 1, 0)
  235. end
  236. end