9
3

adisgruntledrefugee.lua 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. --[[
  2. Script Name : SpawnScripts/QeynosCitizenshipTrialChamber/adisgruntledrefugee.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.08.31 06:08:19
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/DialogModule"
  9. require "SpawnScripts/Generic/CombatModule"
  10. local BQCitizen = 5718
  11. local CVQCitizen = 5719
  12. local GQCitizen = 5720
  13. local NQCitizen = 5721
  14. local SCQCitizen = 5722
  15. local WWQCitizen = 5723
  16. function spawn(NPC, Spawn)
  17. combatModule(NPC, Spawn)
  18. SetPlayerProximityFunction(NPC, 7, "InRange", "LeaveRange")
  19. SetTempVariable(NPC,"HailTimer",nil)
  20. end
  21. function InRange(NPC, Spawn)
  22. if not IsInCombat(NPC) and GetTempVariable(NPC,"HailTimer")==nil then
  23. PlayFlavor(NPC, "","I'm so sorry... I didn't mean to do it!", "cry", 0,0, Spawn)
  24. end
  25. end
  26. function hailed(NPC, Spawn)
  27. if GetTempVariable(NPC,"HailTimer")==nil then
  28. Dialog1(NPC, Spawn)
  29. end
  30. end
  31. function Dialog1(NPC, Spawn)
  32. FaceTarget(NPC, Spawn)
  33. Dialog.New(NPC, Spawn)
  34. PlayFlavor(NPC,"","","wince",0,0,Spawn)
  35. Dialog.AddDialog("I promise I'll be better if you find it in your heart to spare me")
  36. Dialog.AddOption("Why would I do that?", "Dialog2")
  37. Dialog.AddOption("You must be punished for your crimes!", "AttackTimer")
  38. Dialog.Start()
  39. end
  40. function Dialog2(NPC, Spawn)
  41. Dialog.New(NPC, Spawn)
  42. Dialog.AddDialog("I made one mistake ... I cast my lot with these scoundrels, and yet, I've regretted it ever since. Can you not spare me? I wish only to go back to my former life and make amends to the Ironforges.")
  43. Dialog.AddOption("Perhaps. I need to think upon this further.")
  44. Dialog.AddOption("I'm listening...", "Dialog3")
  45. Dialog.AddOption("You must be punished for your crimes!", "AttackTimer")
  46. Dialog.AddOption("All traitors to Qeynos must die!", "AttackTimer")
  47. Dialog.Start()
  48. end
  49. function Dialog3(NPC, Spawn)
  50. Dialog.New(NPC, Spawn)
  51. Dialog.AddDialog("I'll do anything! I betrayed all who I loved by my actions, and I cannot bring myself to face the consequences.")
  52. PlayFlavor(NPC,"","","beg",0,0,Spawn)
  53. Dialog.AddOption("You will have to face those consequences... but you will not face death. Begone.","ThankYou")
  54. Dialog.AddOption("You can and will face the consequences. For treason, this means death.", "AttackTimer")
  55. Dialog.Start()
  56. end
  57. function ThankYou(NPC,Spawn)
  58. SetTempVariable(NPC,"HailTimer",1)
  59. AddTimer(NPC,6400,"Runaway",1,Spawn)
  60. AddTimer(NPC,8000,"Sigh",1,Spawn)
  61. Update(NPC,Spawn)
  62. PlayFlavor(NPC,"","","notworthy",0,0,Spawn)
  63. CloseConversation(NPC,Spawn)
  64. end
  65. function Sigh(NPC,Spawn)
  66. Update(NPC,Spawn)
  67. PlayFlavor(NPC,"","","sigh",0,0,Spawn)
  68. end
  69. function Runaway(NPC,Spawn)
  70. MovementLoopAddLocation(NPC, -3.64, -0.39, 2.39, 4,0,"Update")
  71. MovementLoopAddLocation(NPC, -1.83, -0.39, -8.21, 4,0,"Update")
  72. MovementLoopAddLocation(NPC, 16.44, -0.39, -9.29, 4,0,"Update")
  73. MovementLoopAddLocation(NPC, 19.30, 1.17, -0.86, 4,0,"Leave")
  74. MovementLoopAddLocation(NPC, -10.94, 0.99, 8.04 , 4,0,"Leave")
  75. end
  76. function Leave(NPC,Spawn)
  77. Despawn(NPC)
  78. Update(NPC,Spawn)
  79. end
  80. function death(NPC,Spawn)
  81. Update(NPC,Spawn)
  82. end
  83. function Update(NPC,Spawn)
  84. local Mole = GetSpawn(NPC,8250011)
  85. local Refu = GetSpawn(NPC,8250012)
  86. local Part = GetSpawn(NPC,8250013)
  87. local Tavi = GetSpawn(NPC,8250014)
  88. if Mole == nil or not IsAlive(Mole) then
  89. --if Refu == nil or not IsAlive(Refu) then
  90. if Part == nil or not IsAlive(Part) then
  91. if Tavi == nil or not IsAlive(Tavi) then
  92. if HasQuest(Spawn,BQCitizen) then
  93. SetStepComplete(Spawn,BQCitizen,4)
  94. elseif HasQuest(Spawn,CVQCitizen) then
  95. SetStepComplete(Spawn,CVQCitizen,4)
  96. elseif HasQuest(Spawn,GQCitizen) then
  97. SetStepComplete(Spawn,GQCitizen,4)
  98. elseif HasQuest(Spawn,NQCitizen) then
  99. SetStepComplete(Spawn,NQCitizen,4)
  100. elseif HasQuest(Spawn,SCQCitizen) then
  101. SetStepComplete(Spawn,SCQCitizen,4)
  102. elseif HasQuest(Spawn,WWQCitizen) then
  103. SetStepComplete(Spawn,WWQCitizen,4)
  104. end
  105. --end
  106. end
  107. end
  108. end
  109. end
  110. function Leave(NPC)
  111. Despawn(NPC)
  112. end
  113. function AttackTimer(NPC,Spawn)
  114. SpawnSet(NPC, "show_level", 1)
  115. SpawnSet(NPC, "attackable", 1)
  116. AddPrimaryEntityCommand(Spawn,NPC,"",0,"")
  117. AddPrimaryEntityCommand(Spawn,NPC,"attack",10000,"attack")
  118. SendUpdateDefaultCommand(NPC,10000,"attack")
  119. AddTimer(NPC,1200,"Attacking",1,Spawn)
  120. end
  121. function Attacking(NPC,Spawn)
  122. Attack(NPC,Spawn)
  123. end
  124. function aggro(NPC,Spawn)
  125. SpawnSet(NPC,"attackable",1)
  126. SpawnSet(NPC,"show_level",1)
  127. SpawnSet(NPC,"command_primary",11)
  128. end
  129. function FailureExit(NPC,Spawn)
  130. if GetRace(Spawn)== 7 or GetRace(Spawn)== 5 then
  131. BBShire = GetZone("Baubbleshire")
  132. Zone(BBShire,Spawn,819.46, -20.60, -525.61, 200.47)
  133. elseif GetRace(Spawn)== 0 or GetRace(Spawn)== 2 then
  134. Gray = GetZone("graystone")
  135. Zone(Gray,Spawn,865.03, -25.45, -97.91, 357.68)
  136. elseif GetRace(Spawn)== 4 or GetRace(Spawn)== 8 then
  137. CV = GetZone("castleview")
  138. Zone(CV,Spawn,729.01, -21.10, -124.36, 290.81)
  139. elseif GetRace(Spawn)== 9 or GetRace(Spawn)== 11 then
  140. Net = GetZone("nettleville")
  141. Zone(Net,Spawn,670.07, -20.39, 273.85, 114.78)
  142. elseif GetRace(Spawn)== 3 or GetRace(Spawn)== 8 then
  143. SC = GetZone("starcrest")
  144. Zone(SC,Spawn,704.07, -20.38, 264.40, 269.84)
  145. elseif GetRace(Spawn)== 15 or GetRace(Spawn)== 16 or GetRace(Spawn)== 6 then
  146. WW = GetZone("willowwood")
  147. Zone(WW,Spawn,809.96, -21.30, -566.02, 323.13)
  148. else
  149. Net = GetZone("nettleville")
  150. Zone(Net,Spawn,670.07, -20.39, 273.85, 114.78)
  151. end
  152. end
  153. function victory(NPC,Spawn)
  154. AddTimer(NPC,2500,"FailureExit",1,Spawn)
  155. end