Pockets.lua 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. --[[
  2. Script Name : SpawnScripts/TempleSt/Pockets.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.10.24 08:10:54
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/CombatModule"
  9. function spawn(NPC)
  10. AddTimer(NPC,MakeRandomInt(3000,6000),"ChefCheck")
  11. AddTimer(NPC,MakeRandomInt(3000,6000),"waypoints")
  12. SetPlayerProximityFunction(NPC, 7, "InRange", "LeaveRange")
  13. SetTempVariable(NPC,"HissTimer", "0")
  14. end
  15. function InRange(NPC,Spawn)
  16. if not IsInCombat(NPC) and GetTempVariable(NPC,"HissTimer")~="1" then
  17. local Choice = MakeRandomInt(0,100)
  18. if GetRace(Spawn)== 13 then
  19. if Choice <=75 then
  20. InRange_Attack(NPC,Spawn)
  21. end
  22. elseif Choice <= 40 then
  23. InRange_Attack(NPC,Spawn)
  24. end
  25. end
  26. end
  27. function InRange_Attack(NPC,Spawn)
  28. local Choice = MakeRandomInt(1,2)
  29. if Choice == 1 then
  30. FaceTarget(NPC,Spawn)
  31. AddTimer(NPC,1000,"HissAttack",1,Spawn)
  32. else
  33. AddTimer(NPC,500,"Hiss",1,Spawn)
  34. end
  35. SetTempVariable(NPC,"HissTimer", "1")
  36. AddTimer(NPC,25000,"HissReset",1,Spawn)
  37. end
  38. function HissAttack(NPC,Spawn)
  39. PlayFlavor(NPC,"","","attack",0,0)
  40. end
  41. function Hiss(NPC,Spawn)
  42. local Choice = MakeRandomInt(1,2)
  43. if Choice == 1 then
  44. PlaySound(NPC,"sounds/critters/cat/cat_hiss001.wav",GetX(NPC), GetY(NPC), GetZ(NPC))
  45. else
  46. PlaySound(NPC,"sounds/critters/cat/cat_hiss002.wav",GetX(NPC), GetY(NPC), GetZ(NPC))
  47. end
  48. SetTarget(NPC,nil)
  49. end
  50. function HissReset(NPC,Spawn)
  51. SetTempVariable(NPC,"HissTimer", "0")
  52. end
  53. function ChefCheck(NPC,Spawn)
  54. if IsAlive(NPC) then
  55. AddTimer(NPC,MakeRandomInt(4000,7000),"ChefCheck")
  56. local zone = GetZone(NPC)
  57. local Chef = GetSpawnByLocationID(zone,420550)
  58. if not IsInCombat(NPC) and Chef~= nil and not IsInCombat(Chef)then
  59. local Distance = GetDistance(NPC,Chef,1)
  60. if Distance <=4 then
  61. Attack(Chef,NPC)
  62. Attack(NPC,Chef)
  63. local x = GetX(Chef)
  64. local y = GetY(Chef)
  65. local z = GetZ(Chef)
  66. SetFollowTarget(Chef,NPC)
  67. SetFollowTarget(NPC,Chef)
  68. ToggleFollow(Chef)
  69. ToggleFollow(NPC)
  70. SetTarget(Chef,NPC)
  71. FaceTarget(Chef,NPC)
  72. FaceTarget(NPC,Chef)
  73. PlayFlavor(NPC,"","","attack",0,0)
  74. AddTimer(NPC,MakeRandomInt(2500,4500),"kill",1,Spawn)
  75. end
  76. end
  77. end
  78. end
  79. function kill (NPC,Spawn)
  80. ApplySpellVisual(NPC,51)
  81. local zone = GetZone(NPC)
  82. local Chef = GetSpawnByLocationID(zone,420550)
  83. PlayFlavor(Chef,"","","1h_sword_attack",0,0)
  84. KillSpawn(NPC)
  85. AddTimer(Chef,2500,"scoop")
  86. AddTimer(NPC,3000,"Despawning")
  87. end
  88. function Despawning(NPC,Spawn)
  89. Despawn(NPC)
  90. end
  91. function scoop(NPC,Spawn)
  92. local zone = GetZone(NPC)
  93. local Chef = GetSpawnByLocationID(zone,420550)
  94. PlayFlavor(Chef,"","","gathering_success",0,0)
  95. Despawn(NPC)
  96. end
  97. function respawn(NPC)
  98. spawn(NPC)
  99. end
  100. function waypoints(NPC)
  101. local choice = MakeRandomInt(1,2)
  102. if choice == 1 then
  103. SetTempVariable(NPC,"Speed1_Set", "1")
  104. SetTempVariable(NPC,"Speed2_Set", "4")
  105. else
  106. SetTempVariable(NPC,"Speed1_Set", "4")
  107. SetTempVariable(NPC,"Speed2_Set", "1")
  108. end
  109. local Speed1 = GetTempVariable(NPC,"Speed1_Set")
  110. local Speed2 = GetTempVariable(NPC,"Speed2_Set")
  111. MovementLoopAddLocation(NPC, -61.41, 2.85, 128.83, Speed1, 11)
  112. MovementLoopAddLocation(NPC, -62.02, 2.84, 130.9, Speed1, 0)
  113. MovementLoopAddLocation(NPC, -58.28, 2.84, 128.57, Speed2, 0)
  114. MovementLoopAddLocation(NPC, -34.35, 2.83, 116.34, Speed1, 11)
  115. MovementLoopAddLocation(NPC, -34.07, 2.82, 112.86, Speed2, 0)
  116. MovementLoopAddLocation(NPC, -31.12, 2.8, 109.17, Speed2, 0)
  117. MovementLoopAddLocation(NPC, -21.38, 2.74, 104.08, Speed2, 0)
  118. MovementLoopAddLocation(NPC, -13.46, 3, 103.88, Speed2, 0)
  119. MovementLoopAddLocation(NPC, -6.45, 3, 100.2, Speed2, 0)
  120. MovementLoopAddLocation(NPC, -0.39, 3, 106.7, Speed2, 0)
  121. MovementLoopAddLocation(NPC, 3.51, 3, 109.95, Speed2, 0)
  122. MovementLoopAddLocation(NPC, 10.76, 3, 106.88, Speed2, 0)
  123. MovementLoopAddLocation(NPC, 13.12, 3, 103.9, Speed2, 11)
  124. MovementLoopAddLocation(NPC, 11.46, 3, 107.51, Speed1, 0)
  125. MovementLoopAddLocation(NPC, 2.61, 3, 111.09, Speed1, 0)
  126. MovementLoopAddLocation(NPC, -2.04, 3, 102.97, Speed1, 0)
  127. MovementLoopAddLocation(NPC, -6.05, 3, 98.32, Speed1, 0)
  128. MovementLoopAddLocation(NPC, -6.89, 3, 91.65, Speed1, 0)
  129. MovementLoopAddLocation(NPC, -5.91, 3, 88.59, Speed2, 0)
  130. MovementLoopAddLocation(NPC, -10.87, 3, 82.13, Speed2, 0)
  131. MovementLoopAddLocation(NPC, -8.98, 3, 79.39, Speed2, 0)
  132. MovementLoopAddLocation(NPC, -1.98, 3, 71.53, Speed1, 0)
  133. MovementLoopAddLocation(NPC, -0.55, 3, 70.39, Speed1, 0)
  134. MovementLoopAddLocation(NPC, 8.78, 3, 68.85, Speed1, 0)
  135. MovementLoopAddLocation(NPC, 17.25, 3.01, 70.19, Speed1, 0)
  136. MovementLoopAddLocation(NPC, 26.64, 3, 71.57, Speed1, 4)
  137. MovementLoopAddLocation(NPC, 27.99, 3, 62.05, Speed2, 0)
  138. MovementLoopAddLocation(NPC, 32.29, 3, 51.47, Speed2, 0)
  139. MovementLoopAddLocation(NPC, 29.68, 3, 49.47, Speed2, 0)
  140. MovementLoopAddLocation(NPC, 25.59, 2.92, 41.69, Speed2, 0)
  141. MovementLoopAddLocation(NPC, 21.24, 2.92, 35.89, Speed1, 0)
  142. MovementLoopAddLocation(NPC, 13.67, 2.92, 33.38, Speed1, 0)
  143. MovementLoopAddLocation(NPC, 5, 2.92, 39.08, Speed1, 11)
  144. MovementLoopAddLocation(NPC, 11.29, 2.92, 36.82, Speed1, 0)
  145. MovementLoopAddLocation(NPC, 14.53, 2.92, 39.66, Speed2, 0)
  146. MovementLoopAddLocation(NPC, 15.98, 2.92, 41.06, Speed2, 0)
  147. MovementLoopAddLocation(NPC, 21.53, 2.92, 39.83, Speed2, 0)
  148. MovementLoopAddLocation(NPC, 24.28, 2.92, 38.63, Speed2, 0)
  149. MovementLoopAddLocation(NPC, 33.49, 2.99, 46.77, Speed2, 0)
  150. MovementLoopAddLocation(NPC, 37.69, 3, 50.56, Speed1, 0)
  151. MovementLoopAddLocation(NPC, 43.68, 3, 49.92, Speed1, 0)
  152. MovementLoopAddLocation(NPC, 50.72, 3, 60.3, Speed1, 0)
  153. MovementLoopAddLocation(NPC, 54.45, 3, 63.38, Speed1, 0)
  154. MovementLoopAddLocation(NPC, 63.11, 2.79, 67.74, Speed1, 0)
  155. MovementLoopAddLocation(NPC, 70.85, 1.28, 71.33, Speed2, 0)
  156. MovementLoopAddLocation(NPC, 72.42, 0.01, 76.44, Speed2, 0)
  157. MovementLoopAddLocation(NPC, 72.92, -1.51, 81.33, Speed2, 0)
  158. MovementLoopAddLocation(NPC, 77.34, -3.88, 86.47, Speed2, 0)
  159. MovementLoopAddLocation(NPC, 84.48, -4.57, 95.07, Speed2, 0)
  160. MovementLoopAddLocation(NPC, 86.81, -4.57, 99.49, Speed1, 0)
  161. MovementLoopAddLocation(NPC, 92.37, -4.57, 101.07, Speed1, 0)
  162. MovementLoopAddLocation(NPC, 101.18, -4.57, 103.36, Speed1, 0)
  163. MovementLoopAddLocation(NPC, 105.98, -4.57, 98.41, Speed1, 11)
  164. MovementLoopAddLocation(NPC, 98.05, -4.57, 101.28, Speed2, 0)
  165. MovementLoopAddLocation(NPC, 90.17, -4.57, 101.22, Speed2, 0)
  166. MovementLoopAddLocation(NPC, 78.03, -4.57, 105.5, Speed2, 11)
  167. MovementLoopAddLocation(NPC, 80.47, -4.57, 102.26, Speed1, 0)
  168. MovementLoopAddLocation(NPC, 80.19, -4.57, 97.13, Speed1, 0)
  169. MovementLoopAddLocation(NPC, 73.24, -1.86, 82.39, Speed1, 0)
  170. MovementLoopAddLocation(NPC, 71.94, 0.24, 76.21, Speed1, 0)
  171. MovementLoopAddLocation(NPC, 68.5, 1.81, 70.66, Speed2, 0)
  172. MovementLoopAddLocation(NPC, 65.39, 2.7, 69.96, Speed2, 0)
  173. MovementLoopAddLocation(NPC, 54.85, 3, 66.9, Speed2, 0)
  174. MovementLoopAddLocation(NPC, 44.08, 3, 50.5, Speed1, 0)
  175. MovementLoopAddLocation(NPC, 43.21, 3, 49.47, Speed1, 0)
  176. MovementLoopAddLocation(NPC, 30.81, 3, 56.06, Speed1, 0)
  177. MovementLoopAddLocation(NPC, 25.8, 3, 62.48, Speed2, 0)
  178. MovementLoopAddLocation(NPC, 15.21, 3, 83.94, Speed2, 0)
  179. MovementLoopAddLocation(NPC, 10.84, 3, 85.49, Speed2, 0)
  180. MovementLoopAddLocation(NPC, 4.46, 3, 84.47, Speed2, 11)
  181. MovementLoopAddLocation(NPC, -3.77, 3, 90.83, Speed2, 0)
  182. MovementLoopAddLocation(NPC, -6.1, 3, 93.04, Speed1, 0)
  183. MovementLoopAddLocation(NPC, -5.06, 3, 98.95, Speed1, 0)
  184. MovementLoopAddLocation(NPC, -6.67, 3, 102.04, Speed2, 0)
  185. MovementLoopAddLocation(NPC, -15.04, 3, 106.09, Speed1, 0)
  186. MovementLoopAddLocation(NPC, -17.55, 2.9, 106.09, Speed2, 0)
  187. MovementLoopAddLocation(NPC, -35.95, 2.82, 113.86, Speed1, 0)
  188. MovementLoopAddLocation(NPC, -49.54, 2.83, 123.09, Speed2, 0)
  189. MovementLoopAddLocation(NPC, -58.43, 2.84, 124.19, Speed1, 11)
  190. MovementLoopAddLocation(NPC, -59.49, 2.84, 123.88, Speed1, 0)
  191. end