9
3

aratnest.lua 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. --[[
  2. Script Name : SpawnScripts/Antonica/aratnest.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.07.13 12:07:08
  5. Script Purpose : Facilitates nest spawning loops.
  6. :
  7. --]]
  8. function spawn(NPC)
  9. CampSpawn(NPC)
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function CampSpawn(NPC)
  15. if GetSpawnLocationID(NPC)==589354 then --RatNest1
  16. Camp1Spawn(NPC)
  17. elseif GetSpawnLocationID(NPC)==589353 then
  18. Camp2Spawn(NPC)
  19. elseif GetSpawnLocationID(NPC)==589355 then
  20. Camp3Spawn(NPC)
  21. end
  22. end
  23. --- CAMP 1
  24. function Camp1Spawn(NPC, Spawn) -- Stage 1
  25. local zone = GetZone(NPC)
  26. local Camp1Spawn1 = SpawnByLocationID(zone, 133773758)
  27. local Camp1Spawn2 = SpawnByLocationID(zone, 133773759)
  28. local Camp1Spawn3 = SpawnByLocationID(zone, 133773760)
  29. local Camp1Spawn4 = SpawnByLocationID(zone, 133773761)
  30. local Camp1Spawn5 = SpawnByLocationID(zone, 133773762)
  31. local Camp1Spawn6 = SpawnByLocationID(zone, 133773763)
  32. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage1")
  33. end
  34. function Camp1SpawnCheck_Stage1(NPC, Spawn) --Stage 1 Living Check
  35. local zone = GetZone(NPC)
  36. local Camp1Spawn1 = GetSpawnByLocationID(zone, 133773758)
  37. local Camp1Spawn2 = GetSpawnByLocationID(zone, 133773759)
  38. local Camp1Spawn3 = GetSpawnByLocationID(zone, 133773760)
  39. local Camp1Spawn4 = GetSpawnByLocationID(zone, 133773761)
  40. local Camp1Spawn5 = GetSpawnByLocationID(zone, 133773762)
  41. local Camp1Spawn6 = GetSpawnByLocationID(zone, 133773763)
  42. if IsAlive(Camp1Spawn1) == true then
  43. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage1",1, Spawn)
  44. elseif IsAlive(Camp1Spawn2) == true then
  45. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage1",1, Spawn)
  46. elseif IsAlive(Camp1Spawn3) == true then
  47. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage1",1, Spawn)
  48. elseif IsAlive(Camp1Spawn4) == true then
  49. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage1",1, Spawn)
  50. elseif IsAlive(Camp1Spawn5) == true then
  51. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage1",1, Spawn)
  52. elseif IsAlive(Camp1Spawn6) == true then
  53. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage1",1, Spawn)
  54. else
  55. AddTimer(NPC, 6000, "Camp1_Stage2")
  56. end
  57. end
  58. function Camp1_Stage2(NPC, Spawn) --Stage 2
  59. local zone = GetZone(NPC)
  60. local Camp1_Stage2Spawn1=SpawnByLocationID(zone, 133773764)--large moat rat
  61. FaceTarget(Camp1_Stage2Spawn1, Spawn)
  62. Attack(Camp1_Stage2Spawn1, Spawn)
  63. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage2")
  64. end
  65. function Camp1SpawnCheck_Stage2(NPC, Spawn) --Stage 2 Living Check
  66. local zone = GetZone(NPC)
  67. local Camp1_Stage2Spawn1 = GetSpawnByLocationID(zone, 133773764)
  68. if IsAlive(Camp1_Stage2Spawn1) == true then
  69. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage2",1, Spawn)
  70. else
  71. AddTimer(NPC, 6000, "Camp1_Stage3")
  72. end
  73. end
  74. function Camp1_Stage3(NPC, Spawn) --Stage 3 (Possible Boss)
  75. local zone = GetZone(NPC)
  76. local choice = math.random(0,100)
  77. if choice <=33 then -- % Chance for Boss to Spawn
  78. local Camp1_Stage3Spawn1=SpawnByLocationID(zone, 133773789)--Toe-toed rat
  79. FaceTarget(Camp1_Stage3Spawn1, Spawn)
  80. Attack(Camp1_Stage3Spawn1, Spawn)
  81. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage3")
  82. else -- Failed Boss Spawn
  83. AddTimer(NPC,10000,"Camp1Reset")
  84. end
  85. end
  86. function Camp1SpawnCheck_Stage3(NPC, Spawn) --Stage 2 Living Check
  87. local zone = GetZone(NPC)
  88. local Camp1_Stage3Spawn1 = GetSpawnByLocationID(zone, 133773789)
  89. if IsAlive(Camp1_Stage2Spawn1) == true then
  90. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage3",1,Spawn)
  91. else
  92. AddTimer(NPC, 10000, "Camp1Reset")
  93. end
  94. end
  95. function Camp1Reset(NPC)
  96. local zone = GetZone(NPC)
  97. local Camp1Object = GetSpawnByLocationID(zone, 589354)
  98. if Camp1Object~= nil then
  99. Despawn(Camp1Object)
  100. end
  101. end
  102. --- CAMP 2
  103. function Camp2Spawn(NPC, Spawn) -- Stage 1
  104. local zone = GetZone(NPC)
  105. local Camp2Spawn1 = SpawnByLocationID(zone, 133773778)
  106. local Camp2Spawn2 = SpawnByLocationID(zone, 133773779)
  107. local Camp2Spawn3 = SpawnByLocationID(zone, 133773780)
  108. local Camp2Spawn4 = SpawnByLocationID(zone, 133773781)
  109. local Camp2Spawn5 = SpawnByLocationID(zone, 133773782)
  110. local Camp2Spawn6 = SpawnByLocationID(zone, 133773783)
  111. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage1")
  112. end
  113. function Camp2SpawnCheck_Stage1(NPC, Spawn) --Stage 1 Living Check
  114. local zone = GetZone(NPC)
  115. local Camp2Spawn1 = GetSpawnByLocationID(zone, 133773778)
  116. local Camp2Spawn2 = GetSpawnByLocationID(zone, 133773779)
  117. local Camp2Spawn3 = GetSpawnByLocationID(zone, 133773780)
  118. local Camp2Spawn4 = GetSpawnByLocationID(zone, 133773781)
  119. local Camp2Spawn5 = GetSpawnByLocationID(zone, 133773782)
  120. local Camp2Spawn6 = GetSpawnByLocationID(zone, 133773783)
  121. if IsAlive(Camp2Spawn1) == true then
  122. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage1",1, Spawn)
  123. elseif IsAlive(Camp2Spawn2) == true then
  124. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage1",1, Spawn)
  125. elseif IsAlive(Camp2Spawn3) == true then
  126. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage1",1, Spawn)
  127. elseif IsAlive(Camp2Spawn4) == true then
  128. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage1",1, Spawn)
  129. elseif IsAlive(Camp2Spawn5) == true then
  130. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage1",1, Spawn)
  131. elseif IsAlive(Camp2Spawn6) == true then
  132. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage1",1, Spawn)
  133. else
  134. AddTimer(NPC, 6000, "Camp2_Stage2")
  135. end
  136. end
  137. function Camp2_Stage2(NPC, Spawn) --Stage 2
  138. local zone = GetZone(NPC)
  139. local Camp2_Stage2Spawn1=SpawnByLocationID(zone, 183781)--large moat rat
  140. FaceTarget(Camp2_Stage2Spawn1, Spawn)
  141. Attack(Camp2_Stage2Spawn1, Spawn)
  142. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage2")
  143. end
  144. function Camp2SpawnCheck_Stage2(NPC, Spawn) --Stage 2 Living Check
  145. local zone = GetZone(NPC)
  146. local Camp2_Stage2Spawn1 = GetSpawnByLocationID(zone, 183781)
  147. if IsAlive(Camp2_Stage2Spawn1) == true then
  148. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage2",1, Spawn)
  149. else
  150. AddTimer(NPC, 6000, "Camp2_Stage3")
  151. end
  152. end
  153. function Camp2_Stage3(NPC, Spawn) --Stage 3 (Possible Boss)
  154. local zone = GetZone(NPC)
  155. local choice = math.random(0,100)
  156. if choice <=33 then -- % Chance for Boss to Spawn
  157. local Camp2_Stage3Spawn1=SpawnByLocationID(zone, 133773784)--Toe-toed rat
  158. FaceTarget(Camp2_Stage3Spawn1, Spawn)
  159. Attack(Camp2_Stage3Spawn1, Spawn)
  160. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage3")
  161. else -- Failed Boss Spawn
  162. AddTimer(NPC,10000,"Camp2Reset")
  163. end
  164. end
  165. function Camp2SpawnCheck_Stage3(NPC, Spawn) --Stage 2 Living Check
  166. local zone = GetZone(NPC)
  167. local Camp2_Stage3Spawn1 = GetSpawnByLocationID(zone, 133773785)
  168. if IsAlive(Camp2_Stage2Spawn1) == true then
  169. AddTimer(NPC,6000,"Camp2SpawnCheck_Stage3",1,Spawn)
  170. else
  171. AddTimer(NPC, 10000, "Camp2Reset")
  172. end
  173. end
  174. function Camp2Reset(NPC)
  175. local zone = GetZone(NPC)
  176. local Camp2Object = GetSpawnByLocationID(zone, 589353)
  177. if Camp2Object~= nil then
  178. Despawn(Camp2Object)
  179. end
  180. end
  181. --- CAMP 3
  182. function Camp3Spawn(NPC, Spawn) -- Stage 1
  183. local zone = GetZone(NPC)
  184. local Camp3Spawn1 = SpawnByLocationID(zone, 133773819)
  185. local Camp3Spawn2 = SpawnByLocationID(zone, 133773820)
  186. local Camp3Spawn3 = SpawnByLocationID(zone, 133773821)
  187. local Camp3Spawn4 = SpawnByLocationID(zone, 133773822)
  188. local Camp3Spawn5 = SpawnByLocationID(zone, 133773823)
  189. local Camp3Spawn6 = SpawnByLocationID(zone, 133773824)
  190. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage1")
  191. end
  192. function Camp3SpawnCheck_Stage1(NPC, Spawn) --Stage 1 Living Check
  193. local zone = GetZone(NPC)
  194. local Camp3Spawn1 = GetSpawnByLocationID(zone, 133773819)
  195. local Camp3Spawn2 = GetSpawnByLocationID(zone, 133773820)
  196. local Camp3Spawn3 = GetSpawnByLocationID(zone, 133773821)
  197. local Camp3Spawn4 = GetSpawnByLocationID(zone, 133773822)
  198. local Camp3Spawn5 = GetSpawnByLocationID(zone, 133773823)
  199. local Camp3Spawn6 = GetSpawnByLocationID(zone, 133773824)
  200. if IsAlive(Camp3Spawn1) == true then
  201. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage1",1, Spawn)
  202. elseif IsAlive(Camp3Spawn2) == true then
  203. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage1",1, Spawn)
  204. elseif IsAlive(Camp3Spawn3) == true then
  205. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage1",1, Spawn)
  206. elseif IsAlive(Camp3Spawn4) == true then
  207. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage1",1, Spawn)
  208. elseif IsAlive(Camp3Spawn5) == true then
  209. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage1",1, Spawn)
  210. elseif IsAlive(Camp3Spawn6) == true then
  211. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage1",1, Spawn)
  212. else
  213. AddTimer(NPC, 6000, "Camp3_Stage2")
  214. end
  215. end
  216. function Camp3_Stage2(NPC, Spawn) --Stage 2
  217. local zone = GetZone(NPC)
  218. local Camp3_Stage2Spawn1=SpawnByLocationID(zone, 133773825)--large moat rat
  219. FaceTarget(Camp3_Stage2Spawn1, Spawn)
  220. Attack(Camp3_Stage2Spawn1, Spawn)
  221. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage2")
  222. end
  223. function Camp3SpawnCheck_Stage2(NPC, Spawn) --Stage 2 Living Check
  224. local zone = GetZone(NPC)
  225. local Camp3_Stage2Spawn1 = GetSpawnByLocationID(zone, 133773825)
  226. if IsAlive(Camp3_Stage2Spawn1) == true then
  227. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage2",1, Spawn)
  228. else
  229. AddTimer(NPC, 6000, "Camp3_Stage3")
  230. end
  231. end
  232. function Camp3_Stage3(NPC, Spawn) --Stage 3 (Possible Boss)
  233. local zone = GetZone(NPC)
  234. local choice = math.random(0,100)
  235. if choice <=33 then -- % Chance for Boss to Spawn
  236. local Camp3_Stage3Spawn1=SpawnByLocationID(zone, 133773826)--Toe-toed rat
  237. FaceTarget(Camp3_Stage3Spawn1, Spawn)
  238. Attack(Camp3_Stage3Spawn1, Spawn)
  239. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage3")
  240. else -- Failed Boss Spawn
  241. AddTimer(NPC,10000,"Camp3Reset")
  242. end
  243. end
  244. function Camp3SpawnCheck_Stage3(NPC, Spawn) --Stage 2 Living Check
  245. local zone = GetZone(NPC)
  246. local Camp3_Stage3Spawn1 = GetSpawnByLocationID(zone, 133773826)
  247. if IsAlive(Camp3_Stage2Spawn1) == true then
  248. AddTimer(NPC,6000,"Camp3SpawnCheck_Stage3",1,Spawn)
  249. else
  250. AddTimer(NPC, 10000, "Camp3Reset")
  251. end
  252. end
  253. function Camp3Reset(NPC)
  254. local zone = GetZone(NPC)
  255. local Camp3Object = GetSpawnByLocationID(zone, 589355)
  256. if Camp3Object~= nil then
  257. Despawn(Camp3Object)
  258. end
  259. end