9
3

adog.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. --[[
  2. Script Name : SpawnScripts/Nettleville/adog.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.06.20 12:06:12
  5. Script Purpose :
  6. :
  7. --]]
  8. local AttackTimer = false --TIMER FOR ATTACK RESPONSE (ATTACKS KERRAN)
  9. local FollowTimer = false --TIMER FOR FOLLOW SCRIPT
  10. function spawn(NPC)
  11. waypoints(NPC)
  12. SetPlayerProximityFunction(NPC, 4, "InRange", "LeaveRange")
  13. end
  14. function hailed(NPC, Spawn)
  15. FaceTarget(NPC, Spawn)
  16. if GetRace(Spawn)==11 then --KERRAN RESPONSE
  17. local choice = math.random(1, 2)
  18. if choice == 1 then
  19. PlayFlavor(NPC, "", "", "attack", 0, 0,Spawn)
  20. SendMessage(Spawn, "The dog lunges at your tail threateningly.")
  21. elseif choice == 2 then
  22. SendMessage(Spawn, "The dog growls at you menecingly.")
  23. end
  24. else --NORMAL RESPONSE
  25. --[[ local choice = math.random(1, 2)
  26. if choice == 1 then
  27. SendMessage(Spawn, "The dog cautiously eyes you.")
  28. elseif choice == 2 then
  29. SendMessage(Spawn, "The dog sniffs you curiously.")
  30. end]]--
  31. end
  32. end
  33. function InRange(NPC, Spawn) --FOLLOW TARGET SCRIPT IS TOO SLOW. DOG WALKS, BUT SPEED IS NOT ADJUSTABLE.
  34. if GetRace(Spawn)==11 or GetFactionAmount(Spawn,11)<-10000 then --KERRAN RESPONSE
  35. if AttackTimer == false then
  36. if FollowTimer == false then
  37. FollowTimer = true
  38. -- SetFollowTarget(NPC,Spawn)
  39. -- if not IsFollowing(NPC) then
  40. -- ToggleFollow(NPC)
  41. -- end
  42. -- SetTarget(NPC,Spawn)
  43. FaceTarget(NPC, Spawn)
  44. PlayFlavor(NPC, "", "", "attack", 0, 0)
  45. local choice = math.random(1, 2)
  46. if choice == 1 then
  47. SendMessage(Spawn, "A dog snarls and eyes you closely.")
  48. elseif choice == 2 then
  49. SendMessage(Spawn, "A dog leers at you with a quivering jowl.")
  50. end
  51. AddTimer(NPC,10000,"ResetFollow")
  52. AddTimer(NPC,45000,"ResetFollowTimer")
  53. end
  54. end
  55. end
  56. end
  57. function ResetFollow(NPC)
  58. if IsFollowing(NPC) then
  59. SetTarget(NPC,nil)
  60. ToggleFollow(NPC)
  61. AttackTimer = false
  62. end
  63. end
  64. function ResetFollowTimer(NPC)
  65. FollowTimer = false
  66. SetTarget(NPC,nil)
  67. end
  68. function respawn(NPC)
  69. spawn(NPC)
  70. end
  71. function Sleep(NPC)
  72. local choice = math.random(1,2)
  73. if choice == 1 then
  74. SpawnSet(NPC, "action_state", 540)
  75. AddTimer(NPC, 22000, "Wake")
  76. AttackTimer = true
  77. elseif choice ==2 then
  78. end
  79. end
  80. function Wake(NPC)
  81. SpawnSet(NPC, "action_state", 0)
  82. AttackTimer = false
  83. end
  84. function casted_on(NPC, Spawn, SpellName) -- PRIMARY COMMAND RESPONSE (RACIAL BASED)
  85. if SpellName == 'Nuzzle' then
  86. SetFollowTarget(NPC,Spawn)
  87. FaceTarget(NPC, Spawn)
  88. if not IsFollowing(NPC) then
  89. ToggleFollow(NPC)
  90. end
  91. AddTimer(NPC,10000,"ResetFollow")
  92. if GetRace(Spawn)==11 then --KERRAN RESPONSE
  93. local choice = math.random(1, 2)
  94. if choice == 1 then
  95. SendMessage(Spawn, "The dog emits a low growl.")
  96. elseif choice == 2 then
  97. SendMessage(Spawn, "The dog's ears go back and eyes you cautiously.")
  98. end
  99. else
  100. local choice = math.random(1, 2) --NORMAL RESPONSE
  101. if choice == 1 then
  102. SendMessage(Spawn, "The dog looks at you with affection.")
  103. elseif choice == 2 then
  104. SendMessage(Spawn, "The dog's tail begins to wag.")
  105. end
  106. end
  107. end
  108. end
  109. function waypoints(NPC)
  110. MovementLoopAddLocation(NPC, 605.94, -20.74, 357.26, 2, 0)
  111. MovementLoopAddLocation(NPC, 606.52, -21.31, 360.45, 2, 0)
  112. MovementLoopAddLocation(NPC, 607.91, -24.63, 367.79, 2, 0)
  113. MovementLoopAddLocation(NPC, 612.54, -26.38, 372.50, 2, 0)
  114. MovementLoopAddLocation(NPC, 614.17, -26.33, 372.69, 2, 0)
  115. MovementLoopAddLocation(NPC, 619.91, -25.77, 370.95, 2, 0)
  116. MovementLoopAddLocation(NPC, 621.44, -25.42, 367.87, 2, 1)
  117. MovementLoopAddLocation(NPC, 621.44, -25.42, 367.87, 2, math.random(25,36),"Sleep")
  118. MovementLoopAddLocation(NPC, 624.25, -25.51, 374.8, 2, 0)
  119. MovementLoopAddLocation(NPC, 630.78, -25.25, 380.53, 2, 0)
  120. MovementLoopAddLocation(NPC, 639.77, -24.74, 382.84, 2, 1)
  121. MovementLoopAddLocation(NPC, 639.77, -24.74, 382.84, 2, math.random(25,36),"Sleep")
  122. MovementLoopAddLocation(NPC, 640.92, -24.77, 380.81, 2, 0)
  123. MovementLoopAddLocation(NPC, 642.08, -24.75, 371.5, 2, 0)
  124. MovementLoopAddLocation(NPC, 647.74, -24.7, 367.81, 2, 0)
  125. MovementLoopAddLocation(NPC, 651.46, -24.71, 366.1, 2, 0)
  126. MovementLoopAddLocation(NPC, 657.19, -24.79, 362.92, 2, 0)
  127. MovementLoopAddLocation(NPC, 663.73, -24.84, 358.39, 2, 0)
  128. MovementLoopAddLocation(NPC, 678.36, -24.75, 357, 2, 0)
  129. MovementLoopAddLocation(NPC, 681.89, -24.76, 357.05, 2, 1)
  130. MovementLoopAddLocation(NPC, 681.89, -24.76, 357.05, 2, math.random(25,36),"Sleep")
  131. MovementLoopAddLocation(NPC, 678.69, -24.61, 352.53, 2, 0)
  132. MovementLoopAddLocation(NPC, 669.81, -24.5, 347.61, 2, 0)
  133. MovementLoopAddLocation(NPC, 668.99, -24.22, 345.02, 2, 0)
  134. MovementLoopAddLocation(NPC, 663.65, -22.66, 339.13, 2, 0)
  135. MovementLoopAddLocation(NPC, 656.94, -22.31, 332.78, 2, 0)
  136. MovementLoopAddLocation(NPC, 663.68, -20.44, 326.73, 2, 0)
  137. MovementLoopAddLocation(NPC, 665.64, -20.44, 325.66, 2, 0)
  138. MovementLoopAddLocation(NPC, 665.13, -20.44, 323.43, 2, 0)
  139. MovementLoopAddLocation(NPC, 665.13, -20.44, 323.43, 2, 1)
  140. MovementLoopAddLocation(NPC, 665.13, -20.44, 323.43, 2, math.random(25,36),"Sleep")
  141. MovementLoopAddLocation(NPC, 666.4, -20.44, 322.39, 2, 0)
  142. MovementLoopAddLocation(NPC, 661.69, -20.44, 309.3, 2, 0)
  143. MovementLoopAddLocation(NPC, 663.77, -20.1, 292.47, 2, 0)
  144. MovementLoopAddLocation(NPC, 657.36, -20.2, 270.71, 2, 1)
  145. MovementLoopAddLocation(NPC, 657.36, -20.2, 270.71, 2, math.random(25,36),"Sleep")
  146. MovementLoopAddLocation(NPC, 664.27, -20.06, 290.14, 2, 0)
  147. MovementLoopAddLocation(NPC, 664.7, -20.1, 294.86, 2, 0)
  148. MovementLoopAddLocation(NPC, 659.25, -20.42, 296.79, 2, 0)
  149. MovementLoopAddLocation(NPC, 652.22, -20.4, 298.91, 2, 0)
  150. MovementLoopAddLocation(NPC, 644.8, -20.45, 302.12, 2, 0)
  151. MovementLoopAddLocation(NPC, 630.77, -20.59, 309.26, 2, 0)
  152. MovementLoopAddLocation(NPC, 617.3, -20.25, 310.24, 2, 1)
  153. MovementLoopAddLocation(NPC, 617.3, -20.25, 310.24, 2, math.random(25,36),"Sleep")
  154. MovementLoopAddLocation(NPC, 618.64, -20.42, 312.59, 2, 0)
  155. MovementLoopAddLocation(NPC, 618.81, -20.51, 316.1, 2, 0)
  156. MovementLoopAddLocation(NPC, 612.1, -20.69, 325.4, 2, 0)
  157. MovementLoopAddLocation(NPC, 608.25, -20.67, 330.6, 2, 0)
  158. MovementLoopAddLocation(NPC, 604.21, -20.74, 346.8, 2, 0)
  159. MovementLoopAddLocation(NPC, 601.92, -20.74, 347.28, 2, 0)
  160. MovementLoopAddLocation(NPC, 597.32, -20.45, 345.81, 2, 0)
  161. MovementLoopAddLocation(NPC, 587.63, -20.27, 345.31, 2, 0)
  162. MovementLoopAddLocation(NPC, 572.81, -20.38, 343.64, 2, 1)
  163. MovementLoopAddLocation(NPC, 572.81, -20.38, 343.64, 2, math.random(25,36),"Sleep")
  164. MovementLoopAddLocation(NPC, 578.76, -20.33, 344.87, 2, 0)
  165. MovementLoopAddLocation(NPC, 583.78, -20.22, 346.01, 2, 0)
  166. MovementLoopAddLocation(NPC, 586.56, -20.26, 345.69, 2, 0)
  167. MovementLoopAddLocation(NPC, 601.35, -20.75, 346.76, 2, 0)
  168. MovementLoopAddLocation(NPC, 605.31, -20.76, 337.62, 2, 0)
  169. MovementLoopAddLocation(NPC, 607.73, -20.65, 331.06, 2, 0)
  170. MovementLoopAddLocation(NPC, 613.2, -20.62, 323.51, 2, 0)
  171. MovementLoopAddLocation(NPC, 619.27, -20.52, 316.12, 2, 0)
  172. MovementLoopAddLocation(NPC, 620.88, -20.5, 313.91, 2, 0)
  173. MovementLoopAddLocation(NPC, 622.75, -20.41, 306.83, 2, 1)
  174. MovementLoopAddLocation(NPC, 622.75, -20.41, 306.83, 2, math.random(25,36),"Sleep")
  175. MovementLoopAddLocation(NPC, 623.06, -20.45, 309.56, 2, 0)
  176. MovementLoopAddLocation(NPC, 626.02, -20.63, 307.83, 2, 0)
  177. MovementLoopAddLocation(NPC, 632.63, -20.7, 304.36, 2, 0)
  178. MovementLoopAddLocation(NPC, 646.04, -20.49, 299.41, 2, 0)
  179. MovementLoopAddLocation(NPC, 653.92, -20.42, 296.15, 2, 0)
  180. MovementLoopAddLocation(NPC, 660.19, -20.42, 298.58, 2, 0)
  181. MovementLoopAddLocation(NPC, 674.9, -20.24, 300.69, 2, 1)
  182. MovementLoopAddLocation(NPC, 674.9, -20.24, 300.69, 2, math.random(25,36),"Sleep")
  183. MovementLoopAddLocation(NPC, 671.49, -20.25, 304.9, 2, 0)
  184. MovementLoopAddLocation(NPC, 668.72, -20.26, 308.31, 2, 0)
  185. MovementLoopAddLocation(NPC, 668.85, -20.43, 313.21, 2, 0)
  186. MovementLoopAddLocation(NPC, 669.65, -20.43, 319.22, 2, 0)
  187. MovementLoopAddLocation(NPC, 669.48, -20.44, 324.68, 2, 0)
  188. MovementLoopAddLocation(NPC, 664.94, -20.44, 327.59, 2, 0)
  189. MovementLoopAddLocation(NPC, 662.32, -20.87, 328.68, 2, 0)
  190. MovementLoopAddLocation(NPC, 653.62, -22.31, 331.59, 2, 0)
  191. MovementLoopAddLocation(NPC, 650.9, -22.32, 332.66, 2, 0)
  192. MovementLoopAddLocation(NPC, 642.64, -22.31, 337.16, 2, 0)
  193. MovementLoopAddLocation(NPC, 638.96, -22.32, 342.45, 2, 0)
  194. MovementLoopAddLocation(NPC, 632.17, -22.32, 345.61, 2, 1)
  195. MovementLoopAddLocation(NPC, 632.17, -22.32, 345.61, 2, math.random(25,36),"Sleep")
  196. MovementLoopAddLocation(NPC, 633.81, -22.32, 345.68, 2, 0)
  197. MovementLoopAddLocation(NPC, 640.75, -22.32, 339.35, 2, 0)
  198. MovementLoopAddLocation(NPC, 647.11, -22.31, 331.84, 2, 0)
  199. MovementLoopAddLocation(NPC, 651.76, -22.3, 328.78, 2, 0)
  200. MovementLoopAddLocation(NPC, 657.77, -22.3, 331.66, 2, 0)
  201. MovementLoopAddLocation(NPC, 663.79, -22.38, 335.83, 2, 0)
  202. MovementLoopAddLocation(NPC, 668.79, -22.59, 339.29, 2, 0)
  203. MovementLoopAddLocation(NPC, 670.18, -23.84, 343.63, 2, 0)
  204. MovementLoopAddLocation(NPC, 670.33, -24.58, 348.45, 2, 0)
  205. MovementLoopAddLocation(NPC, 664.48, -24.84, 355.08, 2, 0)
  206. MovementLoopAddLocation(NPC, 658.16, -24.84, 357.51, 2, 1)
  207. MovementLoopAddLocation(NPC, 658.16, -24.84, 357.51, 2, math.random(25,36),"Sleep")
  208. MovementLoopAddLocation(NPC, 659.3, -24.82, 360.12, 2, 0)
  209. MovementLoopAddLocation(NPC, 656.33, -24.81, 362.43, 2, 0)
  210. MovementLoopAddLocation(NPC, 652.83, -24.72, 366.02, 2, 0)
  211. MovementLoopAddLocation(NPC, 640.55, -24.79, 380.32, 2, 0)
  212. MovementLoopAddLocation(NPC, 638.05, -24.82, 383.12, 2, 0)
  213. MovementLoopAddLocation(NPC, 631.42, -25.07, 384.02, 2, 0)
  214. MovementLoopAddLocation(NPC, 624.91, -25.94, 381.66, 2, 1)
  215. MovementLoopAddLocation(NPC, 624.91, -25.94, 381.66, 2,math.random(25,36),"Sleep")
  216. MovementLoopAddLocation(NPC, 621.92, -26.02, 379.37, 2, 0)
  217. MovementLoopAddLocation(NPC, 617.1, -26.22, 375.68, 2, 0)
  218. MovementLoopAddLocation(NPC, 611.13, -26.44, 375.2, 2, 0)
  219. MovementLoopAddLocation(NPC, 605.74, -25.21, 369.57, 2, 0)
  220. MovementLoopAddLocation(NPC, 605.03, -24.28, 367.47, 2, 0)
  221. MovementLoopAddLocation(NPC, 605.05, -20.73, 358.82, 2, 0)
  222. MovementLoopAddLocation(NPC, 604.68, -20.51, 351.26, 2, 0)
  223. MovementLoopAddLocation(NPC, 608.47, -20.61, 348.5, 2, 1)
  224. MovementLoopAddLocation(NPC, 608.47, -20.61, 348.5, 2, math.random(25,36),"Sleep")
  225. MovementLoopAddLocation(NPC, 606.77, -20.62, 348.5, 2, 0)
  226. end