9
3

ShyzintheCoercer.lua 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. --[[
  2. Script Name : SpawnScripts/TheDesertedMine/ShyzinTheCoercer.lua
  3. Script Purpose : Ring Event for The Behemoth in The Deserted Mine
  4. Script Author : alfa24t
  5. Script Date : 03/10/2022
  6. Script Notes : Missing Spells for all mobs
  7. --]]
  8. function spawn(NPC)
  9. SetTempVariable(NPC, "combat_start", "0")
  10. SetTempVariable(NPC, "combat_finish", "0")
  11. SetPlayerProximityFunction(NPC, 15, "inrange")
  12. end
  13. function respawn(NPC)
  14. spawn(NPC)
  15. end
  16. function animationloop(NPC, Spawn)
  17. PlayAnimation(NPC, 10961)
  18. AddTimer(NPC, 2000, "animationloop")
  19. end
  20. function inrange(NPC, Spawn)
  21. AddTimer(NPC, 150000, "startfight")
  22. end
  23. function startfight(NPC)
  24. if GetTempVariable(NPC, "combat_start") == "0" then
  25. Say(NPC, "Thank goodness someone arrived! I'm working for the Far Seas Trading Company, trying to get the mine operational again. The \"Adventurers\" hired to help me pocketed their advance and fled. There's a behemoth that's been terrorizing the miners, and profits are nonexistent!")
  26. Say(NPC, "If you protect me while I cast my enchantment, you should be able to defeat the beast. The reward will be well worth your effort. Just protect me while I enchant the behemoth.")
  27. Say(NPC, "Make sure to dispatch any distractions quickly or I will lose my concentration. I must begin my casting now, before the beast reaches the top.")
  28. SetTempVariable(NPC, "combat_start", "1")
  29. animationloop(NPC, NPC)
  30. AddTimer(NPC, 150000, "spawnfirstwave")
  31. end
  32. end
  33. function spawnfirstwave(NPC)
  34. local zone = GetZone(NPC)
  35. local Spawn2 = SpawnGroupByID(zone, 4120) -- Greather Symbiant
  36. AddTimer(NPC, 120000, "spawnfirstwaveisalive")
  37. end
  38. function spawnfirstwaveisalive(NPC) -- If add alive display warning text / if not go to second wave
  39. local zone = GetZone(NPC)
  40. local firstwavegrp = GetGroup(GetSpawnGroupByID(zone, 4120))
  41. if not firstwavegrp == nil then
  42. SetTempVariable(NPC, "combat_notfinish", "0")
  43. for k,v in ipairs(firstwavegrp) do
  44. if IsAlive(GetSpawnByLocationID(zone, v)) then
  45. SetTempVariable(NPC, "combat_notfinish", "1")
  46. break
  47. end
  48. end
  49. else
  50. SetTempVariable(NPC, "combat_notfinish", "0")
  51. end
  52. if GetTempVariable(NPC, "combat_notfinish") == "1" then
  53. Say(NPC, "I can't work in these conditions. Dispatch those fleas so I can concentrate or I'll leave you to fight the creature in his natural state!")
  54. SetTempVariable(NPC, "combat_finish", "0")
  55. AddTimer(NPC, 30000, "spawnfirstwaveisalivefinal")
  56. else
  57. Say(NPC, "Good work with those symbiants. I should be done here soon.")
  58. AddTimer(NPC, 300000, "spawnsecondwave")
  59. end
  60. end
  61. function spawnfirstwaveisalivefinal(NPC) -- If add alive display fail text and continue pop / if not go to second wave
  62. local zone = GetZone(NPC)
  63. local firstwavegrp = GetGroup(GetSpawnGroupByID(zone, 4120))
  64. if not firstwavegrp == nil then
  65. SetTempVariable(NPC, "combat_notfinish", "0")
  66. for k,v in ipairs(firstwavegrp) do
  67. if IsAlive(GetSpawnByLocationID(zone, v)) then
  68. SetTempVariable(NPC, "combat_notfinish", "1")
  69. break
  70. end
  71. end
  72. else
  73. SetTempVariable(NPC, "combat_notfinish", "0")
  74. end
  75. if GetTempVariable(NPC, "combat_notfinish") == "1" then
  76. Say(NPC, "I can't work like this. You're on your own. I'm evacuating this forsaken mine, and I advise you to leave before the Behemoth tears you all apart as well.")
  77. -- Play annim and despawn
  78. Despawn(NPC)
  79. else
  80. Say(NPC, "Good work with those symbiants. I should be done here soon.")
  81. SetTempVariable(NPC, "combat_finish", "0")
  82. AddTimer(NPC, 300000, "spawnsecondwave")
  83. end
  84. end
  85. function spawnsecondwave(NPC)
  86. local zone = GetZone(NPC)
  87. SpawnGroupByID(zone, 4121) -- Greather Symbiant
  88. AddTimer(NPC, 120000, "spawnsecondwaveisalive")
  89. end
  90. function spawnsecondwaveisalive(NPC) -- If add alive display warning text / if not go to second wave
  91. local zone = GetZone(NPC)
  92. local firstwavegrp = GetGroup(GetSpawnGroupByID(zone, 4121))
  93. if not firstwavegrp == nil then
  94. SetTempVariable(NPC, "combat_notfinish", "0")
  95. for k,v in ipairs(firstwavegrp) do
  96. if IsAlive(GetSpawnByLocationID(zone, v)) then
  97. SetTempVariable(NPC, "combat_notfinish", "1")
  98. break
  99. end
  100. end
  101. else
  102. SetTempVariable(NPC, "combat_notfinish", "0")
  103. end
  104. if GetTempVariable(NPC, "combat_notfinish") == "1" then
  105. Say(NPC, "I can't work in these conditions. Dispatch those fleas so I can concentrate or I'll leave you to fight the creature in his natural state!")
  106. SetTempVariable(NPC, "combat_finish", "0")
  107. AddTimer(NPC, 30000, "spawnsecondwaveisalivefinal")
  108. else
  109. Say(NPC, "Good work with those symbiants. I should be done here soon.")
  110. SetTempVariable(NPC, "combat_finish", "0")
  111. AddTimer(NPC, 300000, "spawnthirdwave")
  112. end
  113. end
  114. function spawnsecondwaveisalivefinal(NPC)
  115. local zone = GetZone(NPC)
  116. local firstwavegrp = GetGroup(GetSpawnGroupByID(zone, 4121))
  117. if not firstwavegrp == nil then
  118. SetTempVariable(NPC, "combat_notfinish", "0")
  119. for k,v in ipairs(firstwavegrp) do
  120. if IsAlive(GetSpawnByLocationID(zone, v)) then
  121. SetTempVariable(NPC, "combat_notfinish", "1")
  122. break
  123. end
  124. end
  125. else
  126. SetTempVariable(NPC, "combat_notfinish", "0")
  127. end
  128. if GetTempVariable(NPC, "combat_notfinish") == "1" then
  129. Say(NPC, "I can't work like this. You're on your own. I'm evacuating this forsaken mine, and I advise you to leave before the Behemoth tears you all apart as well.")
  130. -- Play annim and despawn
  131. Despawn(NPC)
  132. else
  133. Say(NPC, "Good work with those symbiants. I should be done here soon.")
  134. SetTempVariable(NPC, "combat_finish", "0")
  135. AddTimer(NPC, 300000, "spawnsecondwave")
  136. end
  137. end
  138. function spawnthirdwave(NPC)
  139. local zone = GetZone(NPC)
  140. SpawnGroupByID(zone, 4122) -- Greather Symbiant
  141. AddTimer(NPC, 120000, "spawnthirdisalive")
  142. end
  143. function spawnthirdwaveisalive(NPC) -- If add alive display warning text / if not go to second wave
  144. local zone = GetZone(NPC)
  145. local firstwavegrp = GetGroup(GetSpawnGroupByID(zone, 4122))
  146. if not firstwavegrp == nil then
  147. SetTempVariable(NPC, "combat_notfinish", "0")
  148. for k,v in ipairs(firstwavegrp) do
  149. if IsAlive(GetSpawnByLocationID(zone, v)) then
  150. SetTempVariable(NPC, "combat_notfinish", "1")
  151. break
  152. end
  153. end
  154. else
  155. SetTempVariable(NPC, "combat_notfinish", "0")
  156. end
  157. if GetTempVariable(NPC, "combat_notfinish") == "1" then
  158. Say(NPC, "I can't work in these conditions. Dispatch those fleas so I can concentrate or I'll leave you to fight the creature in his natural state!")
  159. SetTempVariable(NPC, "combat_finish", "0")
  160. AddTimer(NPC, 30000, "spawnthirdwaveisalivefinal")
  161. else
  162. Say(NPC, "Good work with those symbiants. I should be done here soon.")
  163. SetTempVariable(NPC, "combat_finish", "0")
  164. AddTimer(NPC, 300000, "spawnbehemoth")
  165. end
  166. end
  167. function spawnthirdwaveisalivefinal(NPC)
  168. local zone = GetZone(NPC)
  169. local firstwavegrp = GetGroup(GetSpawnGroupByID(zone, 4122))
  170. if not firstwavegrp == nil then
  171. SetTempVariable(NPC, "combat_notfinish", "0")
  172. for k,v in ipairs(firstwavegrp) do
  173. if IsAlive(GetSpawnByLocationID(zone, v)) then
  174. SetTempVariable(NPC, "combat_notfinish", "1")
  175. break
  176. end
  177. end
  178. else
  179. SetTempVariable(NPC, "combat_notfinish", "0")
  180. end
  181. if GetTempVariable(NPC, "combat_notfinish") == "1" then
  182. Say(NPC, "I can't work like this. You're on your own. I'm evacuating this forsaken mine, and I advise you to leave before the Behemoth tears you all apart as well.")
  183. StopTimer(NPC, "animationloop")
  184. -- Play annim and despawn
  185. Despawn(NPC)
  186. else
  187. Say(NPC, "Good work with those symbiants. I should be done here soon.")
  188. SetTempVariable(NPC, "combat_finish", "0")
  189. AddTimer(NPC, 300000, "spawnbehemot")
  190. StopTimer(NPC, "animationloop")
  191. end
  192. end
  193. function spawnbehemot(NPC)
  194. local zone = GetZone(NPC) -- grab zone
  195. SpawnByLocationID(zone, 339505)
  196. Despawn(NPC)
  197. end
  198. function hailed(NPC, Spawn)
  199. end
  200. function hailed_busy(NPC, Spawn)
  201. end
  202. function casted_on(NPC, Spawn, Message)
  203. end
  204. function targeted(NPC, Spawn)
  205. end
  206. function attacked(NPC, Spawn)
  207. end
  208. function aggro(NPC, Spawn)
  209. end
  210. function healthchanged(NPC, Spawn)
  211. end
  212. function auto_attack_tick(NPC, Spawn)
  213. end
  214. function death(NPC, Spawn)
  215. end
  216. function killed(NPC, Spawn)
  217. end
  218. function CombatReset(NPC)
  219. end
  220. function randomchat(NPC, Message)
  221. end