GuttertoothWarTotem.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. --[[
  2. Script Name : SpawnScripts/IsleRefuge1/GuttertoothWarTotem.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.09.06 02:09:14
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. -- set the calls to the ai as there is no ai
  10. SetLuaBrain(NPC)
  11. SetBrainTick(NPC, 600000)
  12. -- give the spawn a crap load of hp so we can't one hit kill
  13. SetHP(NPC, 1000000)
  14. SetRequiredQuest(NPC,5734,1)
  15. end
  16. function casted_on(NPC, Spawn, Message)
  17. if Message == "Smite" then
  18. SpawnSet(NPC,"visual_state",3120)
  19. PlaySound(NPC,"sounds/widgets/chests/chest_smash001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  20. GoblinRevenge(NPC,Spawn)
  21. AddTimer(NPC,800,"Collapse")
  22. AddTimer(NPC,4200,"CoolOff")
  23. AddTimer(NPC,6000,"Despawning")
  24. end
  25. end
  26. function Collapse(NPC)
  27. SpawnSet(NPC,"model_type",1428)
  28. PlaySound(NPC,"sounds/widgets/chests/chest_smash001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  29. end
  30. function CoolOff(NPC)
  31. SpawnSet(NPC,"visual_state",0)
  32. end
  33. function respawn(NPC)
  34. spawn(NPC)
  35. end
  36. function Despawning(NPC,Spawn)
  37. KillSpawn(NPC)
  38. Despawn(NPC)
  39. end
  40. function Think(NPC,Target)
  41. -- no ai so won't attack
  42. return
  43. end
  44. function healthchanged(NPC, Spawn)
  45. -- insta heal so should be impossible to kill without the /kill command
  46. SetHP(NPC, GetMaxHP(NPC))
  47. end
  48. function GoblinRevenge(NPC,Spawn)
  49. local zone = GetZone(Spawn)
  50. local Totem1 = GetSpawnByLocationID(zone, 133774885)
  51. local Totem2 = GetSpawnByLocationID(zone, 133774886)
  52. local Totem3 = GetSpawnByLocationID(zone, 133774887)
  53. local Totem4 = GetSpawnByLocationID(zone, 133774888)
  54. local Totem5 = GetSpawnByLocationID(zone, 133774889)
  55. local Totem6 = GetSpawnByLocationID(zone, 133774890)
  56. local Goblin1 = GetSpawnByLocationID(zone, 133774844)
  57. local Goblin2 = GetSpawnByLocationID(zone, 133774846)
  58. local Goblin3 = GetSpawnByLocationID(zone, 133774842)
  59. local Goblin4 = GetSpawnByLocationID(zone, 133774847)
  60. local Goblin5 = GetSpawnByLocationID(zone, 133774841)
  61. local Goblin6 = GetSpawnByLocationID(zone, 133774840)
  62. local GoblinPop = GetSpawnByLocationID(zone,133775496)
  63. if GetSpawnLocationID(NPC) == 133774885 then
  64. if IsAlive(Goblin1)==true and IsInCombat(Goblin1)==false then
  65. Attack(Goblin1,Spawn)
  66. AddHate(Spawn, Goblin1, 50)
  67. else GoblinPopping = SpawnByLocationID(zone,133775496)
  68. Attack(GoblinPopping,Spawn)
  69. AddHate(Spawn, GoblinPopping, 50)
  70. end
  71. elseif GetSpawnLocationID(NPC) == 133774886 then
  72. if IsAlive(Goblin2)==true and IsInCombat(Goblin2)==false then
  73. Attack(Goblin2,Spawn)
  74. AddHate(Spawn, Goblin2, 50)
  75. else GoblinPopping = SpawnByLocationID(zone,133775496)
  76. Attack(GoblinPopping,Spawn)
  77. AddHate(Spawn, GoblinPopping, 50)
  78. end
  79. elseif GetSpawnLocationID(NPC) == 133774887 then
  80. if IsAlive(Goblin3)==true and IsInCombat(Goblin3)==false then
  81. Attack(Goblin3,Spawn)
  82. AddHate(Spawn, Goblin3, 50)
  83. else GoblinPopping = SpawnByLocationID(zone,133775496)
  84. Attack(GoblinPopping,Spawn)
  85. AddHate(Spawn, GoblinPopping, 50)
  86. end
  87. elseif GetSpawnLocationID(NPC) == 133774888 then
  88. if IsAlive(Goblin4)==true and IsInCombat(Goblin4)==false then
  89. Attack(Goblin4,Spawn)
  90. AddHate(Spawn, Goblin4, 50)
  91. else GoblinPopping = SpawnByLocationID(zone,133775496)
  92. Attack(GoblinPopping,Spawn)
  93. AddHate(Spawn, GoblinPopping, 50)
  94. end
  95. elseif GetSpawnLocationID(NPC) == 133774889 then
  96. if IsAlive(Goblin5)==true and IsInCombat(Goblin5)==false then
  97. Attack(Goblin5,Spawn)
  98. AddHate(Spawn, Goblin5, 50)
  99. else GoblinPopping = SpawnByLocationID(zone,133775496)
  100. Attack(GoblinPopping,Spawn)
  101. AddHate(Spawn, GoblinPopping, 50)
  102. end
  103. elseif GetSpawnLocationID(NPC) == 133774880 then
  104. if IsAlive(Goblin6)==true and IsInCombat(Goblin6)==false then
  105. Attack(Goblin6,Spawn)
  106. AddHate(Spawn, Goblin6, 50)
  107. else GoblinPopping = SpawnByLocationID(zone,133775496)
  108. Attack(GoblinPopping,Spawn)
  109. AddHate(Spawn, GoblinPopping, 50)
  110. end
  111. end
  112. end