CaptainVarlos.lua 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. --[[
  2. Script Name : SpawnScripts/FarJourneyFreeport/CaptainVarlos.lua
  3. Script Author : Cynnar
  4. Script Date : 2019.09.28 03:09:56
  5. Script Purpose :
  6. :
  7. --]]
  8. get_attention_animation = true
  9. needs_selection_help = true
  10. finished_hailed = false
  11. finished_where_am_I = false
  12. finished_who_are_you = false
  13. finished_how_did_I_get_here = false
  14. finished_where_are_we_headed = false
  15. finished_high_winds_1 = false
  16. finished_high_winds_2 = false
  17. finished_high_winds_3 = false
  18. seen_quest_praise = false
  19. require "SpawnScripts/Generic/DialogModule"
  20. function spawn(NPC)
  21. end
  22. function get_attention_init(NPC, player)
  23. InstructionWindow(player, -1.0, "Captain Varlos looks like he is trying to get your attention.", "voiceover/english/narrator/boat_06p_tutorial02/narrator_027_30c39009.mp3", 2146230300, 3258594756, "captain_attention", "", "continue")
  24. AddTimer(NPC, 100, "get_attention", 1, player)
  25. end
  26. function get_attention(NPC, player)
  27. FaceTarget(NPC, player)
  28. SendStateCommand(NPC, 883)
  29. AddTimer(NPC, math.random(2000, 3000), "stop_get_attention", 1, player)
  30. end
  31. function stop_get_attention(NPC, player)
  32. SendStateCommand(NPC, 0)
  33. if get_attention_animation and HasQuest(player, 524) == true and GetQuestStep(player, 524) == 7 then
  34. AddTimer(NPC, 500, "get_attention", 1, player)
  35. end
  36. end
  37. function hailed(NPC, player)
  38. FaceTarget(NPC, player)
  39. SendStateCommand(GetSpawn(NPC, 270000), 318)
  40. SendStateCommand(GetSpawn(NPC, 270000), 0)
  41. if HasQuest(player, 524) == false and HasCompletedQuest(player, 524) == false then
  42. InstructionWindowClose(player)
  43. needs_selection_help = true
  44. finished_hailed = false
  45. finished_where_am_I = false
  46. finished_who_are_you = false
  47. finished_how_did_I_get_here = false
  48. finished_where_are_we_headed = false
  49. finished_high_winds_1 = false
  50. finished_high_winds_2 = false
  51. finished_high_winds_3 = false
  52. Dialog.New(NPC, player)
  53. Dialog.AddDialog("Ahoy! 'Tis good to see you awake. Ya seem a little squiffy, least ya' cheated death!")
  54. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_001.mp3", 1930075150, 2666442405)
  55. Dialog.AddEmote("salute")
  56. Dialog.AddOption("Where am I?", "where_am_I")
  57. Dialog.Start()
  58. AddTimer(NPC, 8000, "hailed_instructions", 1, player)
  59. elseif HasQuest(player, 524) == true and GetQuestStep(player, 524) == 7 then
  60. SetTutorialStep(player, 32)
  61. Dialog.New(NPC, player)
  62. Dialog.AddDialog("Avast ye! We need to talk.")
  63. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_011.mp3", 570868734, 3287597835)
  64. Dialog.AddOption("What is it?", "quest_step_7a")
  65. Dialog.Start()
  66. get_attention_animation = false
  67. elseif HasQuest(player, 524) == true and GetQuestStep(player, 524) == 10 then
  68. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_023.mp3", "You still need to kill that landlubber of a goblin! Get to it mate!", "", 3269557913, 3104212801)
  69. elseif HasQuest(player, 524) == true and GetQuestStep(player, 524) == 9 then
  70. SetTutorialStep(player, 51)
  71. Dialog.New(NPC, player)
  72. Dialog.AddDialog("Ya' made quick work of them vermin.")
  73. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_016.mp3", 1130776869, 4119313971)
  74. Dialog.AddOption("Thanks.", "quest_step_9")
  75. Dialog.Start()
  76. elseif HasCompletedQuest(player, 524) == true and seen_quest_praise == false then
  77. seen_quest_praise = true
  78. Dialog.New(NPC, player)
  79. Dialog.AddDialog("Arr! Ya saved the Far Journey and me crew! Seems ya' proved ta' be quite a hero. Well, with the help of that young lass there, ya' do.")
  80. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_024.mp3", 998172564, 1159207795)
  81. Dialog.AddOption("It was nothing.", "quest_completed")
  82. Dialog.Start()
  83. elseif HasCompletedQuest(player, 524) == true then
  84. Dialog.New(NPC, player)
  85. Dialog.AddDialog("So, ya' ready ta go ashore matey?")
  86. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_027.mp3", 2285948102, 2994720481)
  87. Dialog.AddOption("Yes.", "ready_to_go_ashore")
  88. Dialog.AddOption("No. I would like some more time.", "conversation8_2")
  89. Dialog.Start()
  90. end
  91. end
  92. function quest_completed(NPC, player)
  93. Dialog.New(NPC, player)
  94. Dialog.AddDialog("There be the Island of Refuge, get ready ta' drop anchor. Just let me know when ya' want ta' go ashore.")
  95. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_025.mp3", 3643967618, 2645907420)
  96. Dialog.AddOption("Ok.", "drop_anchor")
  97. Dialog.Start()
  98. end
  99. function drop_anchor(NPC, player)
  100. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_026.mp3", "Ingrid! Swing the lead and prepare to drop anchor!", "", 3011518245, 3851752713)
  101. end
  102. function ready_to_go_ashore(NPC, player)
  103. Dialog.New(NPC, player)
  104. Dialog.AddDialog("Don't ya' mind, we get paid ta' do that.")
  105. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_028.mp3", 1009737776, 2173458794)
  106. Dialog.AddOption("Good point.", "zone_to_isle")
  107. Dialog.Start()
  108. end
  109. function zone_to_isle(NPC, player)
  110. serverType = GetRuleFlagInt32("R_World", "StartingZoneRuleFlag")
  111. -- if no server type is set (default of 0 wildcard) or odd number means bit 1 is set
  112. if serverType == 0 or (serverType % 2) == 1 then
  113. -- DoF alignment, 0 = evil (Outpost of Overlord), 1 = good (Queens Colony)
  114. alignment = GetDeity(player)
  115. if alignment == 0 then
  116. Zone(GetZone(278), player) -- outpost of overlord
  117. else
  118. Zone(GetZone(253), player) -- queens colony
  119. end
  120. -- even value serverType > 0 (return 0) means isle of refuge (bit 2) is set
  121. else
  122. Zone(GetZone(325), player) -- isle of refuge
  123. end
  124. end
  125. function quest_step_9(NPC, player)
  126. AddTimer(GetSpawn(NPC, 270013), 100, "attack")
  127. AddTimer(NPC, 1000, "quest_step_9b", 1, player)
  128. end
  129. function quest_step_9b(NPC, player)
  130. FaceTarget(NPC, GetSpawn(NPC, 270013))
  131. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_017.mp3", "Wait. Tis that a... No, it cain' be!", "", 1253231512, 1752159147)
  132. AddTimer(NPC, 5000, "quest_step_9c", 1, player)
  133. SendStateCommand(GetSpawn(NPC, 270005), 250)
  134. end
  135. function quest_step_9c(NPC, player)
  136. Drake = GetSpawn(NPC, 270013)
  137. Anikra = GetSpawn(NPC, 270006)
  138. Valik = GetSpawn(NPC, 270005)
  139. Geredo = GetSpawn(NPC, 270004)
  140. FaceTarget(Anikra, Drake)
  141. FaceTarget(Valik, Drake)
  142. FaceTarget(Geredo, Drake)
  143. SendStateCommand(Anikra, 429)
  144. SendStateCommand(Valik, 429)
  145. SendStateCommand(Geredo, 429)
  146. SendStateCommand(GetSpawn(NPC, 270001), 219)
  147. SendStateCommand(GetSpawn(NPC, 270007), 631)
  148. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_018.mp3", "Quick! Ingrid, secure th'loot! Thar be a Drakota off the bow! Quick now! Secure those chests!", "", 3607547478, 39534308)
  149. AddTimer(NPC, 9000, "quest_step_9d", 1, player)
  150. end
  151. function quest_step_9d(NPC, player)
  152. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_019.mp3", "Everyone down! Watch it!", "", 2065401462, 2542613809)
  153. SendStateCommand(GetSpawn(NPC, 270007), 219)
  154. SendStateCommand(GetSpawn(NPC, 270001), 220)
  155. SendStateCommand(GetSpawn(NPC, 270004), 210)
  156. SendStateCommand(GetSpawn(NPC, 270006), 403)
  157. SendStateCommand(GetSpawn(NPC, 270005), 218)
  158. SendStateCommand(GetSpawn(NPC, 270002), 218)
  159. AddTimer(NPC, 3500, "quest_step_9e", 1, player)
  160. i=1
  161. spawns = GetSpawnListBySpawnID(player, 270011)
  162. repeat
  163. cage = GetSpawnFromList(spawns, i-1)
  164. if cage then
  165. Despawn(cage)
  166. end
  167. i = i + 1
  168. until cage == Nil
  169. end
  170. function quest_step_9e(NPC, player)
  171. PerformCameraShake(player, 0.699999988079071)
  172. PerformCameraShake(player, 0.5)
  173. PerformCameraShake(player, 0.30000001192092896)
  174. PerformCameraShake(player, 0.10000000149011612)
  175. AddTimer(NPC, 3500, "quest_step_9f", 1, player)
  176. end
  177. function quest_step_9f(NPC, player)
  178. AddTimer(NPC, 3500, "quest_step_9g", 1, player)
  179. end
  180. function quest_step_9g(NPC, player)
  181. AddTimer(NPC, 3000, "quest_step_9h", 1, player)
  182. end
  183. function quest_step_9h(NPC, player)
  184. SendStateCommand(GetSpawn(NPC, 270001), 0)
  185. SendStateCommand(GetSpawn(NPC, 270004), 0)
  186. SendStateCommand(GetSpawn(NPC, 270006), 0)
  187. SendStateCommand(GetSpawn(NPC, 270005), 0)
  188. SendStateCommand(GetSpawn(NPC, 270002), 0)
  189. SendStateCommand(GetSpawn(NPC, 270007), 220)
  190. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_020.mp3", "Blimey! That was close! It has been near two months since the last reported sightings of one of them.", "", 814285897, 1688547621)
  191. AddTimer(NPC, 6000, "quest_step_9i", 1, player)
  192. end
  193. function quest_step_9i(NPC, player)
  194. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_021.mp3", "That damnable goblin has escaped. An' look, me beautiful ship is on fire!", "", 1401094820, 2183903275)
  195. AddTimer(NPC, 6000, "quest_step_9j", 1, player)
  196. end
  197. function quest_step_9j(NPC, player)
  198. SetStepComplete(player, 524, 9)
  199. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_022.mp3", "Ye must put an end to 'is life, afore he tears me ship apart!", "", 2385052787, 1324494518)
  200. end
  201. function quest_step_7a(NPC, player)
  202. Dialog.New(NPC, player)
  203. Dialog.AddDialog("Well, 'tis a bit of a problem. Ya' see, there be rats on board. The vermin keep eating the supplies and I need ya' to go feed them to the deep, afore they eat anything else.")
  204. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_012.mp3", 705765462, 3202743441)
  205. Dialog.AddOption("So you want me to kill them?", "quest_step_7b")
  206. Dialog.Start()
  207. end
  208. function quest_step_7b(NPC, player)
  209. Dialog.New(NPC, player)
  210. Dialog.AddDialog("Yar! That's what we be needin'.")
  211. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_013.mp3", 3880459741, 170861362)
  212. Dialog.AddOption("How do you expect me to kill them?", "quest_step_7c")
  213. Dialog.Start()
  214. end
  215. function quest_step_7c(NPC, player)
  216. Dialog.New(NPC, player)
  217. Dialog.AddDialog("Wit this 'ere club. It is nice and splintered, sure ta' cause them some pain.")
  218. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_014.mp3", 2083163804, 202693960)
  219. Dialog.AddOption("Aye, aye, Captain!", "quest_step_7d")
  220. Dialog.Start()
  221. end
  222. function quest_step_7d(NPC, player)
  223. SetStepComplete(player, 524, 7)
  224. end
  225. function hailed_instructions(NPC, player)
  226. if needs_selection_help == true then
  227. InstructionWindowGoal(player,0)
  228. InstructionWindowClose(player)
  229. InstructionWindow(player, -1.0, "To respond to the Captain and other characters you will meet, left click on the response text.", "voiceover/english/narrator/boat_06p_tutorial02/narrator_006_7521b625.mp3", 3936228257, 1877316160, "tutorial_stage_8", "Left click on one of the response options.", "server")
  230. needs_selection_help = false
  231. end
  232. end
  233. function where_am_I(NPC, player)
  234. finished_hailed = true
  235. --[[Say(NPC, "Testing function call")
  236. drake = GetSpawn(player, 270013)
  237. SendStateCommand(drake,65")
  238. Say(drake, "attacking")
  239. AddTimer(drake, 40000, "drake_rain")
  240. --]]
  241. if needs_selection_help == true then
  242. needs_selection_help = false
  243. else
  244. InstructionWindowGoal(player,0)
  245. InstructionWindowClose(player)
  246. end
  247. if finished_where_am_I == false then
  248. FaceTarget(NPC, player)
  249. Dialog.New(NPC, player)
  250. Dialog.AddDialog("Me apologies.")
  251. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_002.mp3", 2054400186, 1976167819)
  252. Dialog.AddOption("Who are you?", "who_are_you")
  253. Dialog.Start()
  254. end
  255. end
  256. function who_are_you(NPC, player)
  257. if finished_who_are_you == false then
  258. finished_where_am_I = true
  259. FaceTarget(NPC, player)
  260. Dialog.New(NPC, player)
  261. Dialog.AddDialog("I am Captain Draik Varlos, and this 'ere fine ship is the Far Journey.")
  262. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_003.mp3", 2565389482, 560555759)
  263. Dialog.AddOption("How did I get here?", "how_did_I_get_here")
  264. Dialog.Start()
  265. end
  266. end
  267. function how_did_I_get_here(NPC, player)
  268. finished_who_are_you = true
  269. if finished_how_did_I_get_here == false then
  270. FaceTarget(NPC, player)
  271. Dialog.New(NPC, player)
  272. Dialog.AddDialog("Me hearties pulled ya' from the sea, you an those other bilge rats. Do ya' remember?")
  273. Dialog.AddVoiceover("voiceover/english/captain_varlos/boat_06p_tutorial02/varlos_0_004.mp3", 29296168, 2709023783)
  274. Dialog.AddOption("Vaguely. Where are we headed?", "where_are_we_headed")
  275. Dialog.Start()
  276. end
  277. end
  278. function where_are_we_headed(NPC, player)
  279. finished_how_did_I_get_here = true
  280. if finished_where_are_we_headed == false then
  281. FaceTarget(NPC, player)
  282. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_005.mp3", "We are heading to the Island of Refuge.", "", 1602680439, 2810422278)
  283. AddTimer(NPC, 500, "shake_camera_medium", 1, player)
  284. AddTimer(NPC, 1500, "shake_camera_low", 1, player)
  285. AddTimer(NPC, 2500, "shake_camera_low", 1, player)
  286. AddTimer(NPC, 3000, "high_winds_1", 1, player)
  287. end
  288. end
  289. function shake_camera_low(NPC, player)
  290. PerformCameraShake(player, 0.10000000149011612)
  291. end
  292. function shake_camera_medium(NPC, player)
  293. PerformCameraShake(player, 0.20000000298023224)
  294. end
  295. function shake_camera_high(NPC, player)
  296. PerformCameraShake(player, 0.699999988079071)
  297. end
  298. function high_winds_1(NPC, player)
  299. finished_where_are_we_headed = true
  300. if finished_high_winds_1 == false then
  301. FaceTarget(NPC, GetSpawn(NPC, 270001))
  302. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_006.mp3", "Ingrid! Quit gawking at the shorty and fix that yard-arm!", "", 2753489262, 3183736171)
  303. SendStateCommand(GetSpawn(NPC, 270001), 0)
  304. AddTimer(NPC, 3500, "high_winds_2", 1, player)
  305. end
  306. end
  307. function high_winds_2(NPC, player)
  308. finished_high_winds_1 = true
  309. if finished_high_winds_2 == false then
  310. PlayFlavor(GetSpawn(NPC, 270001), "voiceover/english/ingrid/boat_06p_tutorial02/020_deckhand_ingrid_010_1637e047.mp3", "Aye, aye, Captain!", "", 1250282628, 237171958)
  311. SendStateCommand(GetSpawn(NPC, 270001), 520)
  312. AddTimer(NPC, 2500, "high_winds_3", 1, player)
  313. end
  314. end
  315. function high_winds_3(NPC, player)
  316. finished_high_winds_2 = true
  317. if finished_high_winds_3 == false then
  318. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_007.mp3", "Don't want the ship to come apart in these high winds, do ya'?!", "", 517097409, 4194681002)
  319. SendStateCommand(GetSpawn(NPC, 270001), 0)
  320. AddTimer(NPC, 5000, "high_winds_4", 1, player)
  321. end
  322. end
  323. function high_winds_4(NPC, player)
  324. finished_high_winds_3 = true
  325. FaceTarget(NPC, player)
  326. PlayFlavor(NPC, "voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_008.mp3", "Ya think she'd never seen a gnome afore.", "", 2447879193, 4289147535)
  327. SendStateCommand(GetSpawn(NPC, 270001), 630)
  328. AddTimer(NPC, 500, "shake_camera_medium", 1, player)
  329. AddTimer(NPC, 3500, "shake_camera_high", 1, player)
  330. AddTimer(NPC, 5500, "shake_camera_medium", 1, player)
  331. AddTimer(NPC, 9500, "shake_camera_low", 1, player)
  332. AddTimer(NPC, 5000, "offer_quest", 1, player)
  333. end
  334. function offer_quest(NPC, player)
  335. if HasQuest(player, 524) == false then
  336. OfferQuest(NPC, player, 524, true)
  337. AddTimer(NPC, 7000, "Accepted_Tutorial_Instructions", 1, player)
  338. end
  339. end
  340. function Accepted_Tutorial_Instructions(NPC, player)
  341. InstructionWindowClose(player)
  342. ShowWindow(player, "Journals.JournalsQuest", 0)
  343. InstructionWindow(player, -1.0, "The Captain has given you a quest. Left click on the quest journal button to open your quest journal.", "voiceover/english/narrator/boat_06p_tutorial02/narrator_007_59f6d83b.mp3", 1470829818, 519016852, "tutorial_stage_9", "Open your quest journal. (click on the journal button)", "open JournalsQuest")
  344. ShowWindow(player, "MainHUD.StartMenu", 1)
  345. FlashWindow(player, "MainHUD.StartMenu.quest_journal", 20.0)
  346. SetTutorialStep(player, 8)
  347. end
  348. function respawn(NPC)
  349. end