CaptainVertas.lua 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/CaptainVertas.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.01.03 01:01:54
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/NPCModule"
  9. local FinishingtheNegotiations = 425
  10. local TroubleAbout = 441
  11. local MoreThenMeetsTheEye = 442
  12. local ProvingYourWorth = 443
  13. local ConfusionIsTheKey = 444
  14. local OneFinalTask = 445
  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 not HasQuest(Spawn, FinishingtheNegotiations) and not HasCompletedQuest(Spawn, FinishingtheNegotiations) then
  22. ProvidesQuest(NPC, FinishingtheNegotiations)
  23. SetInfoFlag(NPC)
  24. SetVisualFlag(NPC)
  25. elseif HasCompletedQuest(Spawn, FinishingtheNegotiations) then
  26. ProvidesQuest(NPC, TroubleAbout)
  27. SetInfoFlag(NPC)
  28. SetVisualFlag(NPC)
  29. elseif HasCompletedQuest(Spawn, TroubleAbout) then
  30. ProvidesQuest(NPC, MoreThenMeetsTheEye)
  31. SetInfoFlag(NPC)
  32. SetVisualFlag(NPC)
  33. elseif HasCompletedQuest(Spawn, MoreThenMeetsTheEye) then
  34. ProvidesQuest(NPC, ProvingYourWorth)
  35. SetInfoFlag(NPC)
  36. SetVisualFlag(NPC)
  37. elseif HasCompletedQuest(Spawn, ProvingYourWorth) then
  38. ProvidesQuest(NPC, ConfusionIsTheKey)
  39. SetInfoFlag(NPC)
  40. SetVisualFlag(NPC)
  41. elseif HasCompletedQuest(Spawn, ConfusionIsTheKey) then
  42. ProvidesQuest(NPC, OneFinalTask)
  43. SetInfoFlag(NPC)
  44. SetVisualFlag(NPC)
  45. end
  46. end
  47. function hailed(NPC, Spawn)
  48. FaceTarget(NPC, Spawn)
  49. PlayFlavor(NPC, "voiceover/english/voice_emotes/greetings/greetings_3_1004.mp3", "", "", 0, 0, Spawn)
  50. if GetQuestStep(Spawn, FinishingtheNegotiations) == 1 then
  51. SetStepComplete(Spawn, FinishingtheNegotiations, 1)
  52. end
  53. if not HasQuest(Spawn, TroubleAbout) and not HasCompletedQuest(Spawn, TroubleAbout) then
  54. Option1(NPC, Spawn)
  55. elseif HasCompletedQuest(Spawn, TroubleAbout) and not HasCompletedQuest(Spawn, MoreThenMeetsTheEye) then
  56. Option6(NPC, Spawn)
  57. elseif GetQuestStep(Spawn, TroubleAbout) == 1 or GetQuestStep(Spawn, MoreThenMeetsTheEye) == 1 or GetQuestStep(Spawn, ProvingYourWorth) == 1 or GetQuestStep(Spawn, ProvingYourWorth) == 2 or GetQuestStep(Spawn, ProvingYourWorth) == 3 or GetQuestStep(Spawn, ProvingYourWorth) == 4 or GetQuestStep(Spawn, ConfusionIsTheKey) == 1 or GetQuestStep(Spawn, OneFinalTask) == 1 then
  58. QuestProgress(NPC, Spawn)
  59. elseif GetQuestStep(Spawn, TroubleAbout) == 2 or GetQuestStep(Spawn, MoreThenMeetsTheEye) == 2 or GetQuestStep(Spawn, ProvingYourWorth) == 5 or GetQuestStep(Spawn, ConfusionIsTheKey) == 2 or GetQuestStep(Spawn, OneFinalTask) == 2 then
  60. QuestFinish(NPC, Spawn)
  61. elseif HasCompletedQuest(Spawn, TroubleAbout) and HasCompletedQuest(Spawn, MoreThenMeetsTheEye) and not HasCompletedQuest(Spawn, ProvingYourWorth) then
  62. Option10(NPC, Spawn)
  63. elseif HasCompletedQuest(Spawn, TroubleAbout) and HasCompletedQuest(Spawn, MoreThenMeetsTheEye) and HasCompletedQuest(Spawn, ProvingYourWorth) and not HasCompletedQuest(Spawn, ConfusionIsTheKey) then
  64. Option15(NPC, Spawn)
  65. elseif HasCompletedQuest(Spawn, TroubleAbout) and HasCompletedQuest(Spawn, MoreThenMeetsTheEye) and HasCompletedQuest(Spawn, ProvingYourWorth) and HasCompletedQuest(Spawn, ConfusionIsTheKey) and not HasCompletedQuest(Spawn, OneFinalTask) then
  66. Option19(NPC, Spawn)
  67. elseif HasCompletedQuest(Spawn, TroubleAbout) and HasCompletedQuest(Spawn, MoreThenMeetsTheEye) and HasCompletedQuest(Spawn, ProvingYourWorth) and HasCompletedQuest(Spawn, ConfusionIsTheKey) and HasCompletedQuest(Spawn, OneFinalTask) then
  68. PlayFlavor(NPC, "", "Hail, good to see you again soldier!", "salute", 0, 0, Spawn)
  69. end
  70. end
  71. function Option1(NPC, Spawn)
  72. conversation = CreateConversation()
  73. AddConversationOption(conversation, "What does the job pay?", "Option2")
  74. AddConversationOption(conversation, "No, I don't have time right now.")
  75. StartConversation(conversation, NPC, Spawn, "Pah, the orcs and the dervish... Listen, the Freeport Militia requires your help. Will you do a service for the Militia?")
  76. end
  77. function Option2(NPC, Spawn)
  78. FaceTarget(NPC, Spawn)
  79. local conversation = CreateConversation()
  80. AddConversationOption(conversation, "Whatever. I'll work for you. Getting paid is nice, though", "Option3")
  81. AddConversationOption(conversation, "Right, I'll be on my way.")
  82. StartConversation(conversation, NPC, Spawn, "Pay... PAY? You insolent pig, you should be bowing down at my feet asking me for forgiveness. You ought to be paying homage to the Overlord for all he has given you!")
  83. end
  84. function Option3(NPC, Spawn)
  85. FaceTarget(NPC, Spawn)
  86. local conversation = CreateConversation()
  87. AddConversationOption(conversation, "What will I do when I find him?", "Option4")
  88. AddConversationOption(conversation, "Find someone else. I don't have time.")
  89. StartConversation(conversation, NPC, Spawn, "You will be compensated for your time. There have been reports of a growing threat in the Commonlands. The militia requires you to travel to the west to the road beyond the druid ring to find the orc emissary. Our reports tell us the emissary is the one who is passing stolen information to the Deathfist Empire.")
  90. end
  91. function Option4(NPC, Spawn)
  92. FaceTarget(NPC, Spawn)
  93. local conversation = CreateConversation()
  94. AddConversationOption(conversation, "I will serve the Overlord.", "offer")
  95. AddConversationOption(conversation, "Maybe later.")
  96. StartConversation(conversation, NPC, Spawn, "Deal with him by any means necessary! Bring back to me any evidence you may find.")
  97. end
  98. function Option5(NPC, Spawn)
  99. SetStepComplete(Spawn, TroubleAbout, 2)
  100. FaceTarget(NPC, Spawn)
  101. local conversation = CreateConversation()
  102. AddConversationOption(conversation, "Just doing my part for the Overlord.")
  103. StartConversation(conversation, NPC, Spawn, "Note? Indeed, this is interesting. You were right to bring this to me. Well done, soldier.")
  104. end
  105. function Option6(NPC, Spawn)
  106. FaceTarget(NPC, Spawn)
  107. local conversation = CreateConversation()
  108. AddConversationOption(conversation, "No, sir, I did not.", "Option7")
  109. AddConversationOption(conversation, "Yes, I showed it to everyone. May I go now?")
  110. StartConversation(conversation, NPC, Spawn, "This note you brought me provided us with some good information. Did you show it to anyone else?")
  111. end
  112. function Option7(NPC, Spawn)
  113. FaceTarget(NPC, Spawn)
  114. local conversation = CreateConversation()
  115. AddConversationOption(conversation, "No, sir, I am not.", "Option8")
  116. AddConversationOption(conversation, "Nope. I don't have time for this.")
  117. StartConversation(conversation, NPC, Spawn, "Good. Very good to hear. Careful, kid, the dervishes have spies everywhere. Whatever you do, do not trust anyone because they might be a spy. Just last week, we had to put two people to death because we suspected them of being spies. Are you sure you're not a spy?")
  118. end
  119. function Option8(NPC, Spawn)
  120. FaceTarget(NPC, Spawn)
  121. local conversation = CreateConversation()
  122. AddConversationOption(conversation, "Yes, sir. I will go now.", "offer2")
  123. AddConversationOption(conversation, "Maybe another time.")
  124. StartConversation(conversation, NPC, Spawn, "I guess not. You don't look like a spy. A spy wouldn't look so foolish. I need you to go scout out the dervish camps in the southwest area of The Commonlands. The note says they've set up camp in that area. Go there now and investigate it.")
  125. end
  126. function Option9(NPC, Spawn)
  127. SetStepComplete(Spawn, MoreThenMeetsTheEye, 2)
  128. FaceTarget(NPC, Spawn)
  129. local conversation = CreateConversation()
  130. AddConversationOption(conversation, "Thanks, Captain.")
  131. StartConversation(conversation, NPC, Spawn, "I knew it! Excellent work, soldier. You have earned your first insignia. If you keep up the good work, you just might make something of yourself.")
  132. end
  133. function Option10(NPC, Spawn)
  134. FaceTarget(NPC, Spawn)
  135. local conversation = CreateConversation()
  136. AddConversationOption(conversation, "Prove my worth?", "Option11")
  137. AddConversationOption(conversation, "I have nothing to prove to you!")
  138. StartConversation(conversation, NPC, Spawn, "Oh good, you've returned. Thank you for the information you have gathered. You seem trustworthy, but you will now need to prove your worth to the Militia and to the Overlord of Freeport.")
  139. end
  140. function Option11(NPC, Spawn)
  141. FaceTarget(NPC, Spawn)
  142. local conversation = CreateConversation()
  143. AddConversationOption(conversation, "I'm worthy, and I'll prove it.", "Option12")
  144. AddConversationOption(conversation, "I don't like your attitude. Bye!")
  145. StartConversation(conversation, NPC, Spawn, "Yes, it is time you prove your worth to me... err... to Freeport and to the Overlord. Stop asking so many questions! I have a special mission for you.")
  146. end
  147. function Option12(NPC, Spawn)
  148. FaceTarget(NPC, Spawn)
  149. local conversation = CreateConversation()
  150. AddConversationOption(conversation, "Ah, yes. About time we got back to the killing.", "Option13")
  151. AddConversationOption(conversation, "I'm sorry, but I have a prior engagement.")
  152. StartConversation(conversation, NPC, Spawn, "Good to hear. That is the attitude we want to see in young recruits. I need you to travel back to the camp to the west. There you will need to remove some of the dervishes from the land of the living. ")
  153. end
  154. function Option13(NPC, Spawn)
  155. FaceTarget(NPC, Spawn)
  156. local conversation = CreateConversation()
  157. AddConversationOption(conversation, "I will do my best.", "offer3")
  158. StartConversation(conversation, NPC, Spawn, "Let me give you a list. Make sure to crush them thoroughly. Dervish heretics, outlanders, cutthroats, and thaumaturges. Go now! Hurry back.")
  159. end
  160. function Option14(NPC, Spawn)
  161. SetStepComplete(Spawn, ProvingYourWorth, 5)
  162. FaceTarget(NPC, Spawn)
  163. local conversation = CreateConversation()
  164. AddConversationOption(conversation, "Thanks for the compliment, I guess")
  165. StartConversation(conversation, NPC, Spawn, "Really? Well, you may not be as useless as I first thought.")
  166. end
  167. function Option15(NPC, Spawn)
  168. FaceTarget(NPC, Spawn)
  169. local conversation = CreateConversation()
  170. AddConversationOption(conversation, "That sounds amusing.", "Option16")
  171. AddConversationOption(conversation, "I am not a spy. Go get someone else.")
  172. StartConversation(conversation, NPC, Spawn, "For one so young, you have done well thus far. I still have more for you to do before I can let you go. Are you up to some undercover work?")
  173. end
  174. function Option16(NPC, Spawn)
  175. FaceTarget(NPC, Spawn)
  176. local conversation = CreateConversation()
  177. AddConversationOption(conversation, "Kid? You're pushing it, Vertas.", "Option17")
  178. AddConversationOption(conversation, "I don't have time for this.")
  179. StartConversation(conversation, NPC, Spawn, "I like you, kid. What I need you to do is travel to their forward command camp and infiltrate their defenses. You will take this set of orders and switch them for their current list of orders.")
  180. end
  181. function Option17(NPC, Spawn)
  182. FaceTarget(NPC, Spawn)
  183. local conversation = CreateConversation()
  184. AddConversationOption(conversation, "Just give me the orders already.", "offer4")
  185. AddConversationOption(conversation, "No, not this time. Bye!")
  186. StartConversation(conversation, NPC, Spawn, "Oh, sorry sport. Will you take this mission or not? It will be dangerous. Something I'm sure is right up your alley. If it's not, well... we'll have to send the medics, I guess.")
  187. end
  188. function Option18(NPC, Spawn)
  189. SetStepComplete(Spawn, ConfusionIsTheKey, 2)
  190. FaceTarget(NPC, Spawn)
  191. local conversation = CreateConversation()
  192. AddConversationOption(conversation, "Thanks, Captain!")
  193. StartConversation(conversation, NPC, Spawn, "Very well done. Impressive, in fact. You have earned another rank on your insignia.")
  194. end
  195. function Option19(NPC, Spawn)
  196. FaceTarget(NPC, Spawn)
  197. local conversation = CreateConversation()
  198. AddConversationOption(conversation, "That's good to hear.", "Option20")
  199. AddConversationOption(conversation, "Yeah, okay. I'll be on my way.")
  200. StartConversation(conversation, NPC, Spawn, "You've done well up to this point, cadet. The information you have gathered so far has helped our cause. Now it's time I give you a real mission.")
  201. end
  202. function Option20(NPC, Spawn)
  203. FaceTarget(NPC, Spawn)
  204. local conversation = CreateConversation()
  205. AddConversationOption(conversation, "Okay. Who is my target?", "Option21")
  206. AddConversationOption(conversation, "Get someone else.")
  207. StartConversation(conversation, NPC, Spawn, "You are now required to perform an important task for the Militia. Because of the fake orders you delivered, we were able to pinpoint the highest ranking officer in this regiment. Now, you must go and eliminate him.")
  208. end
  209. function Option21(NPC, Spawn)
  210. FaceTarget(NPC, Spawn)
  211. local conversation = CreateConversation()
  212. AddConversationOption(conversation, "Affirmative, sir.", "offer5")
  213. AddConversationOption(conversation, "Sounds like you should tighten security.")
  214. StartConversation(conversation, NPC, Spawn, "Shh... Not so loud! I'll whisper it to you. This type of information we do not speak in open areas. You never know who is listening. One spy hearing the wrong bit of information can ruin just about everything.")
  215. end
  216. function Option22(NPC, Spawn)
  217. SetStepComplete(Spawn, OneFinalTask, 2)
  218. FaceTarget(NPC, Spawn)
  219. local conversation = CreateConversation()
  220. AddConversationOption(conversation, "I will wear it with pride, sir.")
  221. StartConversation(conversation, NPC, Spawn, "I knew you had it in you, soldier. You have earned my highest respect. Take this insignia and wear it proudly as a symbol of your bravery as a member of the Militia.")
  222. end
  223. function offer(NPC, Spawn)
  224. OfferQuest(NPC, Spawn, TroubleAbout)
  225. end
  226. function offer2(NPC, Spawn)
  227. OfferQuest(NPC, Spawn, MoreThenMeetsTheEye)
  228. end
  229. function offer3(NPC, Spawn)
  230. OfferQuest(NPC, Spawn, ProvingYourWorth)
  231. end
  232. function offer4(NPC, Spawn)
  233. OfferQuest(NPC, Spawn, ConfusionIsTheKey)
  234. end
  235. function offer5(NPC, Spawn)
  236. OfferQuest(NPC, Spawn, OneFinalTask)
  237. end
  238. function QuestProgress(NPC, Spawn)
  239. FaceTarget(NPC, Spawn)
  240. local conversation = CreateConversation()
  241. AddConversationOption(conversation, "Slime?")
  242. StartConversation(conversation, NPC, Spawn, "Nothing to see here, move along! Be on your way slime!")
  243. end
  244. function QuestFinish(NPC, Spawn)
  245. FaceTarget(NPC, Spawn)
  246. local conversation = CreateConversation()
  247. if GetQuestStep(Spawn, TroubleAbout) == 2 then
  248. AddConversationOption(conversation, "I killed the emissary and he had this note on him. I thought you might find it interesting.", "Option5")
  249. elseif GetQuestStep(Spawn, MoreThenMeetsTheEye) == 2 then
  250. AddConversationOption(conversation, "I scouted the dervish camp, as you asked.", "Option9")
  251. elseif GetQuestStep(Spawn, ProvingYourWorth) == 5 then
  252. AddConversationOption(conversation, "I have removed some of the dervish insurgents, as you asked.", "Option14")
  253. elseif GetQuestStep(Spawn, ConfusionIsTheKey) == 2 then
  254. AddConversationOption(conversation, "I was able to switch the orders.", "Option18")
  255. elseif GetQuestStep(Spawn, OneFinalTask) == 2 then
  256. AddConversationOption(conversation, "Ralio has been eliminated, sir.", "Option22")
  257. end
  258. AddConversationOption(conversation, "Nothing right now.")
  259. StartConversation(conversation, NPC, Spawn, "Hail. What have you to report?")
  260. end
  261. function respawn(NPC)
  262. end