ahighwaymancampfireB.lua 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. --[[
  2. Script Name : SpawnScripts/Antonica/ahighwaymancampfireB.lua
  3. Script Author : LordPazuzu
  4. Script Date : 2023.02.16 08:02:18
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. CampSpawn(NPC)
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. --- CAMP 1
  15. function CampSpawn(NPC, Spawn) -- Stage 1
  16. local zone = GetZone(NPC)
  17. local spawn1 = math.random(0,1)
  18. if spawn1 == 1 then
  19. local CampSpawn1 = SpawnByLocationID(zone, 133782397) --Highwayman Summoner
  20. else
  21. local CampSpawn1a = SpawnByLocationID(zone, 133782401) -- Highwayman Melee
  22. end
  23. local spawn2 = math.random(0,1)
  24. if spawn2 == 1 then
  25. local CampSpawn2 = SpawnByLocationID(zone, 133782398)--Highwayman Summoner
  26. else
  27. local CampSpawn2a = SpawnByLocationID(zone, 133782402)-- Highwayman Melee
  28. end
  29. local spawn3 = math.random(0,1)
  30. if spawn3 == 1 then
  31. local CampSpawn3 = SpawnByLocationID(zone, 133782399)--Highwayman Summoner
  32. else
  33. local CampSpawn3a = SpawnByLocationID(zone, 133782403)-- Highwayman Melee
  34. end
  35. local spawn4 = math.random(0,1)
  36. if spawn4 == 1 then
  37. local CampSpawn4 = SpawnByLocationID(zone, 133782400)--Highwayman Summoner
  38. else
  39. local CampSpawn4a = SpawnByLocationID(zone, 133782404)-- Highwayman Melee
  40. end
  41. local MerchantSpawn = math.random(0,1)
  42. if MerchantSpawn == 1 then
  43. local Camp1MerchantSpawn = SpawnByLocationID(zone, 133782407)--Distressed Merchant
  44. else
  45. end
  46. AddTimer(NPC,6000,"CampSpawnCheck_Stage1")
  47. end
  48. function CampSpawnCheck_Stage1(NPC, Spawn) --Stage 1 Living Check
  49. local zone = GetZone(NPC)
  50. local CampSpawn1 = GetSpawnByLocationID(zone, 133782397)
  51. local CampSpawn1a = GetSpawnByLocationID(zone, 133782401)
  52. local CampSpawn2 = GetSpawnByLocationID(zone, 133782398)
  53. local CampSpawn2a = GetSpawnByLocationID(zone, 133782402)
  54. local CampSpawn3 = GetSpawnByLocationID(zone, 133782399)
  55. local CampSpawn3a = GetSpawnByLocationID(zone, 133782403)
  56. local CampSpawn4 = GetSpawnByLocationID(zone, 133782400)
  57. local CampSpawn4a = GetSpawnByLocationID(zone, 133782404)
  58. if IsAlive(CampSpawn1) == true or IsAlive(Camp1Spawn1a) == true then
  59. AddTimer(NPC,6000,"CampSpawnCheck_Stage1",1, Spawn)
  60. elseif IsAlive(CampSpawn2) == true or IsAlive(Camp1Spawn2a) == true then
  61. AddTimer(NPC,6000,"CampSpawnCheck_Stage1",1, Spawn)
  62. elseif IsAlive(CampSpawn3) == true or IsAlive(Camp1Spawn3a) == true then
  63. AddTimer(NPC,6000,"CampSpawnCheck_Stage1",1, Spawn)
  64. elseif IsAlive(CampSpawn4) == true or IsAlive(Camp1Spawn4a) == true then
  65. AddTimer(NPC,6000,"CampSpawnCheck_Stage1",1, Spawn)
  66. else
  67. AddTimer(NPC, 6000, "Camp_Stage2")
  68. end
  69. end
  70. function Camp_Stage2(NPC, Spawn) --Stage 2
  71. local zone = GetZone(NPC)
  72. local Camp_Stage2Spawn1=SpawnByLocationID(zone, 133782405)--Bloodsaber Agent
  73. FaceTarget(Camp_Stage2Spawn1, Spawn)
  74. Attack(Camp_Stage2Spawn1, Spawn)
  75. AddTimer(NPC,6000,"CampSpawnCheck_Stage2")
  76. end
  77. function CampSpawnCheck_Stage2(NPC, Spawn) --Stage 2 Living Check
  78. local zone = GetZone(NPC)
  79. local Camp_Stage2Spawn1 = GetSpawnByLocationID(zone, 133782405)
  80. if IsAlive(Camp_Stage2Spawn1) == true then
  81. AddTimer(NPC,6000,"CampSpawnCheck_Stage2",1, Spawn)
  82. else
  83. AddTimer(NPC, 6000, "Camp_Stage3")
  84. end
  85. end
  86. function Camp_Stage3(NPC, Spawn) --Stage 3 (Possible Boss)
  87. local zone = GetZone(NPC)
  88. local choice = math.random(0,100)
  89. if choice <=33 then -- % Chance for Boss to Spawn
  90. local Camp_Stage3Spawn1=SpawnByLocationID(zone, 133782406)--Bloodsaber Corruptor
  91. FaceTarget(Camp_Stage3Spawn1, Spawn)
  92. Attack(Camp_Stage3Spawn1, Spawn)
  93. AddTimer(NPC,6000,"Camp1SpawnCheck_Stage3")
  94. else -- Failed Boss Spawn
  95. local CampArkofPower = SpawnByLocationID(zone, 133782409)--Ark of Power
  96. local CampMerchantSpawn = GetSpawnByLocationID(zone, 133782407)--Distressed Merchant
  97. if CampMerchantSpawn ~=nil then
  98. Despawn(CampMerchantSpawn)
  99. local CampGratifiedMerchant = SpawnByLocationID(zone, 133782408)--Gratified Merchant
  100. AddTimer(NPC,90000,"CampReset")
  101. else
  102. AddTimer(NPC,60000,"CampReset")
  103. end
  104. end
  105. end
  106. function CampSpawnCheck_Stage3(NPC, Spawn) --Stage 2 Living Check
  107. local zone = GetZone(NPC)
  108. local Camp_Stage3Spawn1 = GetSpawnByLocationID(zone, 133782406) --Blodsaber Corrupter
  109. if IsAlive(Camp_Stage2Spawn1) == true then
  110. AddTimer(NPC,6000,"CampSpawnCheck_Stage3",1,Spawn)
  111. else
  112. local CampMerchantSpawn = GetSpawnByLocationID(zone, 133782407)--Distressed Merchant
  113. if CampMerchantSpawn ~=nil then
  114. Despawn(CampMerchantSpawn)
  115. local CampGratifiedMerchant = SpawnByLocationID(zone, 133782408)--Gratified Merchant
  116. AddTimer(NPC, 90000, "CampReset",1,Spawn)
  117. else
  118. AddTimer(NPC, 10000, "CampReset",1,Spawn)
  119. end
  120. end
  121. end
  122. function CampReset(NPC)
  123. local zone = GetZone(NPC)
  124. local CampObject = GetSpawnByLocationID(zone, 591794)
  125. if CampObject~= nil then
  126. Despawn(CampObject)
  127. local CampArkofPower = GetSpawnByLocationID(zone, 133782409)--Ark of Power
  128. if CampArkofPower ~=nil then
  129. Despawn(CampArkofPower)
  130. end
  131. local CampGratifiedMerchant = GetSpawnByLocationID(zone, 133782408)--Gratified Merchant
  132. if CampGratifiedMerchant ~=nil then
  133. Despawn(CampGratifiedMerchant)
  134. end
  135. end
  136. end