aFreeporttraitor.lua 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. --[[
  2. Script Name : SpawnScripts/FreeportCitizenshipTrialChamber/aFreeporttraitor.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.06.25 01:06:51
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/DialogModule"
  9. require "SpawnScripts/Generic/CombatModule"
  10. local BBCitizen = 5866 --Big Bend
  11. local BCCitizen = 5867 --Beggar's Court
  12. local LACitizen = 5868 --Longshadow Alley
  13. local SYCitizen = 5869 -- Scale Yard
  14. local SBCitizen = 5870 --Stonestair Byway
  15. local TSCitizen = 5871 --Temple St
  16. function spawn(NPC, Spawn)
  17. combatModule(NPC, Spawn)
  18. SetPlayerProximityFunction(NPC, 7, "InRange", "LeaveRange")
  19. end
  20. function InRange(NPC, Spawn)
  21. if not IsInCombat(NPC) then
  22. PlayFlavor(NPC, "","Psst! Perhaps we can come to an arrangement...", "", 0,0, Spawn)
  23. end
  24. end
  25. function hailed(NPC, Spawn)
  26. Dialog1(NPC, Spawn)
  27. end
  28. function respawn(NPC)
  29. spawn(NPC)
  30. end
  31. function Dialog1(NPC, Spawn)
  32. FaceTarget(NPC, Spawn)
  33. PlayAnimation(NPC,"539")
  34. Dialog.New(NPC, Spawn)
  35. Dialog.AddDialog("Please don't hurt me. I can make you wealthy!")
  36. Dialog.AddVoiceover("voiceover/english/a_freeport_traitor/fprt_sewer_epic08/bribingtraitor000.mp3", 3714658197, 1541784827)
  37. Dialog.AddOption("I'm listening.", "Dialog2")
  38. Dialog.Start()
  39. end
  40. function Dialog2(NPC, Spawn)
  41. FaceTarget(NPC, Spawn)
  42. Dialog.New(NPC, Spawn)
  43. Dialog.AddDialog("My family already left for Qeynos. If you let me live, I'll send you exactly what you deserve for this!")
  44. Dialog.AddVoiceover("voiceover/english/a_freeport_traitor/fprt_sewer_epic08/bribingtraitor001.mp3", 0, 0)
  45. PlayFlavor(NPC,"","","nod",0,0,Spawn)
  46. Dialog.AddOption("Stay here. Let me consider this.")
  47. Dialog.AddOption("How can I trust you?", "Dialog3")
  48. Dialog.AddOption("Coin cannot cover what you've done!", "AttackTimer")
  49. Dialog.AddOption("I don't think so.", "AttackTimer")
  50. Dialog.Start()
  51. end
  52. function Dialog3(NPC, Spawn)
  53. FaceTarget(NPC, Spawn)
  54. Dialog.New(NPC, Spawn)
  55. Dialog.AddDialog("I don't suppose you can ... so you have to trust me.")
  56. Dialog.AddVoiceover("voiceover/english/a_freeport_traitor/fprt_sewer_epic08/bribingtraitor002.mp3", 0, 0)
  57. PlayFlavor(NPC,"","","whome",0,0,Spawn)
  58. Dialog.AddOption("Fine.","Fail")
  59. Dialog.AddOption("A bribe? Pay with your life!", "AttackTimer")
  60. Dialog.Start()
  61. end
  62. function AttackTimer(NPC,Spawn)
  63. AddTimer(NPC,1200,"Attacking",1,Spawn)
  64. end
  65. function Attacking(NPC,Spawn)
  66. SpawnSet(NPC,"attackable",1)
  67. SpawnSet(NPC,"show_level",1)
  68. AddPrimaryEntityCommand(Spawn,NPC,"",0,"")
  69. AddPrimaryEntityCommand(Spawn,NPC,"attack",10000,"attack")
  70. SendUpdateDefaultCommand(NPC,10000,"attack")
  71. Attack(NPC,Spawn)
  72. end
  73. function Fail(NPC,Spawn)
  74. PlaySound(Spawn,"sounds/ui/ui_warning.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  75. SendPopUpMessage(Spawn,"To accept a bribe from a Qeynosian shows a disgusting lack of ethics.",255,50,50)
  76. SendMessage(Spawn,"To accept a bribe from a Qeynosian shows a disgusting lack of ethics.","red")
  77. AddTimer(NPC,4500,"FailureExit",1,Spawn)
  78. end
  79. function FailureExit(NPC,Spawn)
  80. CloseConversation(NPC,Spawn)
  81. Race = GetRace(Spawn)
  82. -- Erudite / Kerra
  83. if Race == 3 or Race == 11 then
  84. ZoneRef = GetZone("Stonestair")
  85. Zone(ZoneRef,Spawn,3.24, -4.37, -98.46, 185.35)
  86. -- Ratonga / Gnome
  87. elseif Race == 5 or Race == 13 then
  88. ZoneRef = GetZone("TempleSt")
  89. Zone(ZoneRef,Spawn,21.81, 2.92, 21.37, 190.87)
  90. -- Human / Half Elf
  91. elseif Race == 9 or Race == 6 then
  92. ZoneRef = GetZone("BeggarsCourt")
  93. Zone(ZoneRef,Spawn,61.07, -7.08, 111.67, 339.27)
  94. -- Orge / Troll
  95. elseif Race == 12 or Race == 14 then
  96. ZoneRef = GetZone("BigBend")
  97. Zone(ZoneRef,Spawn,94.12, -2.00, 2.53, 98)
  98. -- Dark Elf
  99. elseif Race == 1 or Race == 19 or Race == 17 then
  100. ZoneRef = GetZone("longshadow")
  101. Zone(ZoneRef,Spawn,4.22, 3.00, 71.07, 353.87)
  102. -- Barbarian / Iksar / Sarnak
  103. elseif Race == 0 or Race == 10 or Race == 18 then
  104. ZoneRef = GetZone("ScaleYard")
  105. Zone(ZoneRef,Spawn,-6.78, -5.63, -12.96, 194.63)
  106. else
  107. ZoneRef = GetZone("BeggarsCourt")
  108. Zone(ZoneRef,Spawn,58.67, -7.08, 112.61, 352.60)
  109. end
  110. end
  111. function aggro(NPC,Spawn)
  112. SpawnSet(NPC,"attackable",1)
  113. SpawnSet(NPC,"show_level",1)
  114. SpawnSet(NPC,"command_primary",11)
  115. SpawnSet(NPC,"action_state",0)
  116. end
  117. function death(NPC,Spawn)
  118. local Traitor1 = GetSpawn(NPC,1640001)
  119. local Traitor2 = GetSpawn(NPC,1640002)
  120. local Traitor3 = GetSpawn(NPC,1640018)
  121. local Traitor3 = GetSpawn(NPC,1640021)
  122. if Traitor1 == nil or not IsAlive(Traitor1) then
  123. if Traitor2 == nil or not IsAlive(Traitor2) then
  124. if Traitor3 == nil or not IsAlive(Traitor3) then
  125. if Traitor3 == nil or not IsAlive(Traitor3) then
  126. if HasQuest(Spawn,BBCitizen) then
  127. SetStepComplete(Spawn,BBCitizen,4)
  128. elseif HasQuest(Spawn,BCCitizen) then
  129. SetStepComplete(Spawn,BCCitizen,4)
  130. elseif HasQuest(Spawn,LACitizen) then
  131. SetStepComplete(Spawn,LACitizen,4)
  132. elseif HasQuest(Spawn,SYCitizen) then
  133. SetStepComplete(Spawn,SYCitizen,4)
  134. elseif HasQuest(Spawn,SBCitizen) then
  135. SetStepComplete(Spawn,SBCitizen,4)
  136. elseif HasQuest(Spawn,TSCitizen) then
  137. SetStepComplete(Spawn,TSCitizen,4)
  138. end
  139. end
  140. end
  141. end
  142. end
  143. end
  144. function victory(NPC,Spawn)
  145. AddTimer(NPC,2500,"FailureExit",1,Spawn)
  146. end