asupplycrate.lua 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. --[[
  2. Script Name : SpawnScripts/IsleRefuge1/asupplycrate.lua
  3. Script Author : LordPazuzu
  4. Script Date : 2022.09.05 04:09:53
  5. Script Purpose :
  6. Note: Gave crates each their own goblin protector and a replacement if theirs is gone. - Dorbin
  7. --]]
  8. local Healing = true
  9. function spawn(NPC)
  10. -- set the calls to the ai as there is no ai
  11. SetLuaBrain(NPC)
  12. SetBrainTick(NPC, 600000)
  13. -- give the spawn a crap load of hp so we can't one hit kill
  14. SetHP(NPC, 1000000)
  15. SetRequiredQuest(NPC,5736,1)
  16. -- SetInvulnerable(NPC)
  17. end
  18. function casted_on(NPC, Spawn, Message)
  19. if Message == "Lightning Burst" then
  20. SpawnSet(NPC,"visual_state",3120)
  21. GoblinRevenge(NPC,Spawn)
  22. AddTimer(NPC,4200,"Collapse")
  23. AddTimer(NPC,6000,"Despawning")
  24. end
  25. end
  26. function respawn(NPC)
  27. spawn(NPC)
  28. end
  29. function Think(NPC,Target)
  30. -- no ai so won't attack
  31. return
  32. end
  33. function healthchanged(NPC, Spawn)
  34. -- insta heal, so should be impossible to kill without the /kill command
  35. SetHP(NPC, GetMaxHP(NPC))
  36. end
  37. function Collapse(NPC)
  38. SpawnSet(NPC,"model_type",2501)
  39. PlaySound(NPC,"sounds/widgets/chests/chest_smash001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  40. end
  41. function Despawning(NPC,Spawn)
  42. KillSpawn(NPC)
  43. Despawn(NPC)
  44. end
  45. function death(NPC, Spawn)
  46. end
  47. function aggro(NPC,Spawn)
  48. end
  49. function respawn(NPC)
  50. spawn(NPC)
  51. end
  52. function GoblinRevenge(NPC,Spawn)
  53. local zone = GetZone(Spawn)
  54. local Crate1 = GetSpawnByLocationID(zone, 133774895)
  55. local Goblin1 = GetSpawnByLocationID(zone, 133774771)
  56. local Crate2 = GetSpawnByLocationID(zone, 133774896)
  57. local Goblin2 = GetSpawnByLocationID(zone, 133774978)
  58. local Crate3 = GetSpawnByLocationID(zone, 133774897)
  59. local Goblin3 = GetSpawnByLocationID(zone, 133774989)
  60. local Crate4 = GetSpawnByLocationID(zone, 133774898)
  61. local Goblin4 = GetSpawnByLocationID(zone, 133774775)
  62. local Crate5 = GetSpawnByLocationID(zone, 133774899)
  63. local Goblin5 = GetSpawnByLocationID(zone, 133774976)
  64. local Crate6 = GetSpawnByLocationID(zone, 133774900)
  65. local Goblin6 = GetSpawnByLocationID(zone, 133774776)
  66. local Crate7 = GetSpawnByLocationID(zone, 133774901)
  67. local Goblin7 = GetSpawnByLocationID(zone, 133774779)
  68. local Crate8 = GetSpawnByLocationID(zone, 133774902)
  69. local Goblin8 = GetSpawnByLocationID(zone, 133774778)
  70. local Crate9 = GetSpawnByLocationID(zone, 133774892)
  71. local Goblin9 = GetSpawnByLocationID(zone, 133775605)
  72. local Crate10 = GetSpawnByLocationID(zone, 133774893)
  73. local Goblin10 = GetSpawnByLocationID(zone, 133774773)
  74. local Crate11 = GetSpawnByLocationID(zone, 133774894)
  75. local Goblin11 = GetSpawnByLocationID(zone, 133774781)
  76. local GoblinPop1 = GetSpawnByLocationID(zone,133775330) --Crates 4,5,6,1
  77. local GoblinPop2 = GetSpawnByLocationID(zone,133775328) --Crates 2,3,9,10,11
  78. local GoblinPop3 = GetSpawnByLocationID(zone,133775331) --Crates 7,8
  79. if GetSpawnLocationID(NPC) == 133774895 then
  80. if IsAlive(Goblin1) == true and IsInCombat(Goblin1)==false then
  81. Attack(Goblin1,Spawn)
  82. AddHate(Spawn, Goblin1, 50)
  83. else GoblinPop1 = SpawnByLocationID(zone,133775330)
  84. Attack(GoblinPop1,Spawn)
  85. AddHate(Spawn, GoblinPop1, 50)
  86. end
  87. elseif GetSpawnLocationID(NPC) == 133774896 then
  88. if IsAlive(Goblin2) == true and IsInCombat(Goblin2) == false then
  89. Attack(Goblin2,Spawn)
  90. AddHate(Spawn, Goblin2, 50)
  91. else GoblinPop2 = SpawnByLocationID(zone,133775328)
  92. Attack(GoblinPop2,Spawn)
  93. AddHate(Spawn, GoblinPop2, 50)
  94. end
  95. elseif GetSpawnLocationID(NPC) == 133774897 then
  96. if IsAlive(Goblin3) == true and IsInCombat(Goblin3) == false then
  97. Attack(Goblin3,Spawn)
  98. AddHate(Spawn, Goblin3, 50)
  99. else GoblinPop2 = SpawnByLocationID(zone,133775328)
  100. Attack(GoblinPop2,Spawn)
  101. AddHate(Spawn, GoblinPop2, 50)
  102. end
  103. elseif GetSpawnLocationID(NPC) == 133774898 then
  104. if IsAlive(Goblin4) == true and IsInCombat(Goblin4) == false then
  105. Attack(Goblin4,Spawn)
  106. AddHate(Spawn, Goblin4, 50)
  107. else GoblinPop1 = SpawnByLocationID(zone,133775330)
  108. Attack(GoblinPop1,Spawn)
  109. AddHate(Spawn, GoblinPop1, 50)
  110. end
  111. elseif GetSpawnLocationID(NPC) == 133774899 then
  112. if IsAlive(Goblin5) == true and IsInCombat(Goblin5) == false then
  113. Attack(Goblin5,Spawn)
  114. AddHate(Spawn, Goblin5, 50)
  115. else GoblinPop1 = SpawnByLocationID(zone,133775330)
  116. Attack(GoblinPop1,Spawn)
  117. AddHate(Spawn, GoblinPop1, 50)
  118. end
  119. elseif GetSpawnLocationID(NPC) == 133774900 then
  120. if IsAlive(Goblin6) == true and IsInCombat(Goblin6) == false then
  121. Attack(Goblin6,Spawn)
  122. AddHate(Spawn, Goblin6, 50)
  123. else GoblinPop1 = SpawnByLocationID(zone,133775330)
  124. Attack(GoblinPop1,Spawn)
  125. AddHate(Spawn, GoblinPop1, 50)
  126. end
  127. elseif GetSpawnLocationID(NPC) == 133774901 then
  128. if IsAlive(Goblin7) == true and IsInCombat(Goblin7)==false then
  129. Attack(Goblin7,Spawn)
  130. AddHate(Spawn, Goblin7, 50)
  131. else GoblinPop3 = SpawnByLocationID(zone,133775331)
  132. Attack(GoblinPop3,Spawn)
  133. AddHate(Spawn, GoblinPop3, 50)
  134. end
  135. elseif GetSpawnLocationID(NPC) == 133774902 then
  136. if IsAlive(Goblin8) == true and IsInCombat(Goblin8) == false then
  137. Attack(Goblin8,Spawn)
  138. AddHate(Spawn, Goblin8, 50)
  139. else GoblinPop3 = SpawnByLocationID(zone,133775331)
  140. Attack(GoblinPop3,Spawn)
  141. AddHate(Spawn, GoblinPop3, 50)
  142. end
  143. elseif GetSpawnLocationID(NPC) == 133774892 then
  144. if IsAlive(Goblin9) == true and IsInCombat(Goblin9) == false then
  145. Attack(Goblin9,Spawn)
  146. AddHate(Spawn, Goblin9, 50)
  147. else GoblinPop3 = SpawnByLocationID(zone,133775328)
  148. Attack(GoblinPop,Spawn)
  149. AddHate(Spawn, GoblinPop, 50)
  150. end
  151. elseif GetSpawnLocationID(NPC) == 133774893 then
  152. if IsAlive(Goblin10) == true and IsInCombat(Goblin10) == false then
  153. Attack(Goblin10,Spawn)
  154. AddHate(Spawn, Goblin10, 50)
  155. else GoblinPopping = SpawnByLocationID(zone,133775328)
  156. Attack(GoblinPop,Spawn)
  157. AddHate(Spawn, GoblinPop, 50)
  158. end
  159. elseif GetSpawnLocationID(NPC) == 133774894 then
  160. if IsAlive(Goblin11) == true and IsInCombat(Goblin11) == false then
  161. Attack(Goblin11,Spawn)
  162. AddHate(Spawn, Goblin11, 50)
  163. else GoblinPop2 = SpawnByLocationID(zone,133775496)
  164. Attack(GoblinPop2,Spawn)
  165. AddHate(Spawn, GoblinPop2, 50)
  166. end
  167. end
  168. end