9
3

CaptainFeralis.lua 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/CaptainFeralis.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.02.18 08:02:10
  5. Script Purpose :
  6. Script Notes : Offer Quests "Filling the Coffers", "Ventar T'Kal", "Tesera Valnos".
  7. --]]
  8. require "SpawnScripts/Generic/NPCModule"
  9. local CaptainFeralis = 405
  10. local QUEST = 406 -- Filling the Coffers quest
  11. local QUEST2 = 407 -- Ventar T'Kal quest
  12. local QUEST3 = 412 -- Returning to Captain Feralis quest (Ventar)
  13. local QUEST4 = 414 -- Tesera Valnos quest
  14. local QUEST5 = 5221 -- Returning to Captain Feralis quest ( Tecera)
  15. function spawn(NPC, Spawn)
  16. NPCModule(NPC, Spawn)
  17. FreeportGuard(NPC)
  18. SetPlayerProximityFunction(NPC, 10, "InRange")
  19. end
  20. function InRange(NPC, Spawn)
  21. if GetDeity(Spawn) ~= 1 then
  22. if HasCompletedQuest(Spawn, CaptainFeralis) then
  23. ProvidesQuest(NPC, QUEST)
  24. SetInfoFlag(NPC)
  25. SetVisualFlag(NPC)
  26. elseif HasCompletedQuest(Spawn, QUEST) then
  27. ProvidesQuest(NPC, QUEST2)
  28. SetInfoFlag(NPC)
  29. SetVisualFlag(NPC)
  30. elseif HasCompletedQuest(Spawn, QUEST3) then
  31. ProvidesQuest(NPC, QUEST4)
  32. SetInfoFlag(NPC)
  33. SetVisualFlag(NPC)
  34. end
  35. end
  36. end
  37. function hailed(NPC, Spawn)
  38. FaceTarget(NPC, Spawn)
  39. if GetDeity(Spawn) ~= 1 then
  40. local choice = MakeRandomInt(1, 3)
  41. if HasQuest(Spawn, QUEST2) or HasCompletedQuest(Spawn, QUEST2) and not HasCompletedQuest(Spawn, QUEST3) or HasCompletedQuest(Spawn, QUEST4) or HasQuest(Spawn, QUEST4) then
  42. if choice == 1 then
  43. PlayFlavor(NPC, "", "Loyalty first!", "", 0, 0, Spawn)
  44. elseif choice == 2 then
  45. PlayFlavor(NPC, "", "Orcs, Undead... I'm more worried about what the Dervish Cutthroaths are up to.", "", 0, 0, Spawn)
  46. else
  47. PlayFlavor(NPC, "", "There is little to limit one's potential when they know how to exploit others...except others exploiting them, of course.", "", 0, 0, Spawn)
  48. end
  49. end
  50. if HasQuest(Spawn, CaptainFeralis) or HasCompletedQuest(Spawn, CaptainFeralis) and not HasQuest(Spawn, QUEST) then
  51. local conversation = CreateConversation()
  52. AddConversationOption(conversation, "I am "..GetName(Spawn)..". Rainus asked me to deliver these root samples to you.", "Option1")
  53. StartConversation(conversation, NPC, Spawn, "Yes?")
  54. elseif HasQuest(Spawn, QUEST) and GetQuestStep(Spawn, QUEST) <= 7 then
  55. QUEST_PROGRESS(NPC, Spawn)
  56. elseif HasQuest(Spawn, QUEST) and GetQuestStep(Spawn, QUEST) == 8 then
  57. QUEST_COMPLETE(NPC, Spawn)
  58. elseif HasCompletedQuest(Spawn, QUEST) and not HasQuest(Spawn, QUEST2) and not HasCompletedQuest(Spawn, QUEST2) then
  59. Option4(NPC, Spawn)
  60. elseif HasQuest(Spawn, QUEST3) or HasCompletedQuest(Spawn, QUEST3) and not HasQuest(Spawn, QUEST4) then
  61. Option6(NPC, Spawn)
  62. elseif HasQuest(Spawn, QUEST5) then
  63. QUEST5_COMPLETE(NPC, Spawn)
  64. elseif HasCompletedQuest(Spawn, QUEST5) then
  65. PlayFlavor(NPC, "", "Good work. The Overlord will hear of you.", "", 0, 0, Spawn)
  66. end
  67. elseif GetDeity(Spawn) == 1 or not HasQuest(Spawn, CaptainFeralis) and not HasCompletedQuest(Spawn, CaptainFeralis) then
  68. PlayFlavor(NPC, "", "I see no need to speak to you.", "", 0, 0, Spawn)
  69. end
  70. end
  71. function Option1(NPC, Spawn)
  72. FaceTarget(NPC, Spawn)
  73. local conversation = CreateConversation()
  74. if HasQuest(Spawn, CaptainFeralis) then
  75. SetStepComplete(Spawn, CaptainFeralis, 1)
  76. end
  77. AddConversationOption(conversation, "Rainus said you might have work to give me.", "Option2")
  78. AddConversationOption(conversation, "Uh, you're welcome.")
  79. StartConversation(conversation, NPC, Spawn, "Of course. Rainus mentioned you. Somehow I guessed you would be bigger. No matter. Thank you for acting courier, that will be all.")
  80. end
  81. function Option2(NPC, Spawn)
  82. FaceTarget(NPC, Spawn)
  83. local conversation = CreateConversation()
  84. AddConversationOption(conversation, "What is it?", "Option3")
  85. StartConversation(conversation, NPC, Spawn, "Oh... so that's your angle. I know your type. I got enough of you in the city before I was transferred out here. Still, I suppose you serve a purpose. Sure, I've got something you can do.")
  86. end
  87. function Option3(NPC, Spawn)
  88. FaceTarget(NPC, Spawn)
  89. local conversation = CreateConversation()
  90. AddConversationOption(conversation, "I understand.", "offer")
  91. StartConversation(conversation, NPC, Spawn, "Head down to that small ratonga and kerran community south west of here and collect their taxes. You'll need to collect from every house owner. Normally they place the money in their mailbox, on the front of their houses. Sometimes they forget... when that happens you remind them, understood?")
  92. end
  93. function Option4(NPC, Spawn)
  94. if GetQuestStep(Spawn, QUEST) == 8 then
  95. SetStepComplete(Spawn, QUEST, 8)
  96. end
  97. FaceTarget(NPC, Spawn)
  98. local conversation = CreateConversation()
  99. AddConversationOption(conversation, "Sure.", "Option5")
  100. AddConversationOption(conversation, "No thanks.")
  101. StartConversation(conversation, NPC, Spawn, "Nice work, here's your cut. While you were out another job came up, interested?")
  102. end
  103. function Option5(NPC, Spawn)
  104. FaceTarget(NPC, Spawn)
  105. local conversation = CreateConversation()
  106. AddConversationOption(conversation, "All right, I will go speak with him.", "offer2")
  107. StartConversation(conversation, NPC, Spawn, "Yeah, that's what I thought. Ventar T'Kal is a man of mine. You can find him north west of here, in the company of nomads. I need you to deliver these Bloodskull Frenzy Root samples to him. They've already been treated... so don't eat them.")
  108. end
  109. function Option6(NPC, Spawn)
  110. FaceTarget(NPC, Spawn)
  111. local conversation = CreateConversation()
  112. AddConversationOption(conversation, "Ventar didn't tell me you wanted to see me until just recently.", "Option7")
  113. StartConversation(conversation, NPC, Spawn, "Gee, were you stuck under a house or something?")
  114. end
  115. function Option7(NPC, Spawn)
  116. if GetQuestStep(Spawn, QUEST3) == 1 then
  117. SetStepComplete(Spawn, QUEST3, 1)
  118. end
  119. FaceTarget(NPC, Spawn)
  120. local conversation = CreateConversation()
  121. AddConversationOption(conversation, "I will go find her.", "offer3")
  122. StartConversation(conversation, NPC, Spawn, "I don't care about Ventar and I don't have time to be angry with you. Tecera Valnos has been working from the outpost south of the Ruins of Val'marr. Originally I had planned on her helping deal with the orcs, but as of late she has had her hands full. I need you to report to her and give her whatever assistance you can.")
  123. end
  124. function Option8(NPC, Spawn)
  125. SetStepComplete(Spawn, QUEST5, 1)
  126. FaceTarget(NPC, Spawn)
  127. local conversation = CreateConversation()
  128. AddConversationOption(conversation, "Thank you.")
  129. StartConversation(conversation, NPC, Spawn, "Better than you know. Please, take this, the city of Freeport thanks you.")
  130. end
  131. function offer(NPC, Spawn)
  132. FaceTarget(NPC, Spawn)
  133. OfferQuest(NPC, Spawn, QUEST)
  134. end
  135. function offer2(NPC, Spawn)
  136. FaceTarget(NPC, Spawn)
  137. OfferQuest(NPC, Spawn, QUEST2)
  138. end
  139. function offer3(NPC, Spawn)
  140. FaceTarget(NPC, Spawn)
  141. OfferQuest(NPC, Spawn, QUEST4)
  142. end
  143. function QUEST_PROGRESS(NPC, Spawn)
  144. FaceTarget(NPC, Spawn)
  145. local conversation = CreateConversation()
  146. AddConversationOption(conversation, "I'll be back.")
  147. StartConversation(conversation, NPC, Spawn, "Well?")
  148. end
  149. function QUEST_COMPLETE(NPC, Spawn)
  150. FaceTarget(NPC, Spawn)
  151. local conversation = CreateConversation()
  152. AddConversationOption(conversation, "Here's the money.", "Option4")
  153. StartConversation(conversation, NPC, Spawn, "Well?")
  154. end
  155. function QUEST5_COMPLETE(NPC, Spawn)
  156. FaceTarget(NPC, Spawn)
  157. local conversation = CreateConversation()
  158. AddConversationOption(conversation, "That is good to hear.", "Option2")
  159. StartConversation(conversation, NPC, Spawn, "Tecera sent word. I am very pleased with your work, "..GetName(Spawn)..". You've been a great asset, right when we needed it, too. The Overlord will be glad to hear it as well.")
  160. end
  161. function respawn(NPC)
  162. end