Ingrid.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. --[[
  2. Script Name : SpawnScripts/FarJourneyFreeport/Ingrid.lua
  3. Script Author : Cynnar
  4. Script Date : 2019.10.18 06:10:27
  5. Script Purpose :
  6. Notes :
  7. Notes :
  8. --]]
  9. require "SpawnScripts/Generic/DialogModule"
  10. local TaskAboardTheFarJourney = 524
  11. local TempAnimationVar = nil
  12. local ShardOfLuclin = 12565
  13. function spawn(NPC)
  14. SetTempVariable(NPC, "TempAnimationVar", "FirstRun")
  15. SetTempVariable(NPC, "Staring", "Checking")
  16. -- AddTimer(NPC, 30000, "WalkToGeredo")
  17. SetPlayerProximityFunction(NPC, 12, "InRange", "LeaveRange")
  18. end
  19. function hailed(NPC, Spawn)
  20. step = GetQuestStep(Spawn, 524)
  21. if not HasQuest(Spawn,524) and not HasCompletedQuest(Spawn, 524) then --Avoids stopping Ingred while she is moving around
  22. else
  23. FaceTarget(NPC, Spawn)
  24. if step == 4 then
  25. SendStateCommand(NPC, 0)
  26. Dialog.New(NPC, Spawn)
  27. Dialog.AddDialog("Hello, how are you?")
  28. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_001.mp3", 1960704460, 917558592)
  29. Dialog.AddOption("Good, thanks. How about you?", "small_talk")
  30. Dialog.Start()
  31. elseif step == 5 then
  32. PlayFlavor(NPC, "voiceover/english/ingrid/boat_06p_tutorial02_fvo_005.mp3",
  33. "Is Vim not going to sell it to you? That is just my luck... well I guess I will have to finish this work then.",
  34. "", 4181806501, 3186272404)
  35. elseif step == 6 then
  36. SetTutorialStep(Spawn, 31)
  37. AddCoin(Spawn, 10)
  38. DisplayText(Spawn, 34, "You receive 10 Copper.")
  39. Dialog.New(NPC, Spawn)
  40. Dialog.AddDialog(
  41. "Ah! You got the shard. Great! Now I can stop doing this work and enjoy the rest of this trip. Here is some coin for your help.")
  42. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_006.mp3", 502975024, 483052250)
  43. Dialog.AddOption("Thanks.", "thanks_for_getting_shard")
  44. Dialog.Start()
  45. elseif GetX(NPC) < 5 then
  46. FaceTarget(NPC, Spawn)
  47. local rand = math.random(0, 2)
  48. if rand == 0 then
  49. PlayFlavor(NPC, "voiceover/english/ingrid/boat_06p_tutorial02_fvo_009.mp3","I hate rats, every time we dock they get on board and eat our supplies.", "grumble", 3636322414,1973183674, Spawn)
  50. elseif rand == 1 then
  51. PlayFlavor(NPC, "voiceover/english/ingrid/boat_06p_tutorial02_fvo_008.mp3", "Don't you just love the sea?","sniff", 541733813, 1294072887, Spawn)
  52. else
  53. PlayFlavor(NPC, "voiceover/english/ingrid/boat_06p_tutorial02_fvo_007.mp3", "Yo ho ho and a bottle of rum!","smile", 964088856, 3568852318, Spawn)
  54. end
  55. end
  56. end
  57. end
  58. function InRange(NPC,Player)
  59. if GetTempVariable(NPC,"Starting","Checking") then
  60. SetTempVariable(NPC, "Staring", "Done")
  61. AddTimer(NPC, 30000, "WalkToGeredo",1,Player)
  62. end
  63. end
  64. function WalkToGeredo(NPC, Player)
  65. playerhasquest = HasQuest(Player, 524)
  66. if playerhasquest == true then
  67. MoveToLocation(NPC, 2.35, -2.07, -3.34, 5, nil, false)
  68. else
  69. MoveToLocation(NPC, 5.85, -2.07, -2.94, 2, nil, true)
  70. MoveToLocation(NPC, 5.77, -2.07, -1.56, 2, nil, false)
  71. AddTimer(NPC, 1500, "EmoteAnimationStart")
  72. end
  73. end
  74. -- sends to Geredo to start the flirting
  75. -- no action on Ingrid's part yet
  76. function EmoteAnimationStart(NPC, Spawn)
  77. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  78. AnimationChoice = math.random(0, 10)
  79. local Geredo = GetSpawn(NPC, 270004)
  80. if Geredo ~= nil then
  81. if GetTempVariable(NPC, "TempAnimationVar") == "FirstRun" then
  82. AddTimer(Geredo, 2000, "GeredoFlirtingWithIngird")
  83. else
  84. if GetTempVariable(NPC, "TempAnimationVar") == "SecondRun" and AnimationChoice <= 5 then
  85. AddTimer(Geredo, 5000, "GeredoFlirtingWithIngird")
  86. else
  87. AddTimer(Geredo, 5000, "FlirtingWithGeredo")
  88. end
  89. end
  90. end
  91. end
  92. end
  93. -- sent from Geredo's flex
  94. -- sends back to Geredo after Ingrid's response with a chuckle
  95. function FlirtWithIngrid(NPC, Spawn)
  96. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  97. PlayFlavor(NPC, "", "", "chuckle", 0, 0)
  98. AnimationChoice = math.random(0, 9)
  99. local Geredo = GetSpawn(NPC, 270004)
  100. if Geredo ~= nil then
  101. if GetTempVariable(NPC, "TempAnimationVar") == "FirstRun" then
  102. AddTimer(Geredo, 5000, "FlirtingWithGeredo")
  103. else
  104. if GetTempVariable(NPC, "TempAnimationVar") == "SecondRun" and AnimationChoice >= 7 then
  105. AddTimer(Geredo, 5000, "FlirtingWithGeredo")
  106. else
  107. EmoteAnimationStart(NPC, Spawn)
  108. end
  109. end
  110. end
  111. end
  112. end
  113. -- sent form Geredo's bow
  114. -- sends back to Geredo after Ingrid's curtsey
  115. function FlirtWithIngrid_2(NPC, Spawn)
  116. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  117. PlayFlavor(NPC, "", "", "curtsey", 0, 0)
  118. AnimationChoice = math.random(0, 9)
  119. local Geredo = GetSpawn(NPC, 270004)
  120. if Geredo ~= nil then
  121. if GetTempVariable(NPC, "TempAnimationVar") == "FirstRun" then
  122. AddTimer(Geredo, 5000, "FlirtingWithGeredo_2")
  123. elseif GetTempVariable(NPC, "TempAnimationVar") == "SecondRun" and AnimationChoice >= 7 then
  124. AddTimer(Geredo, 5000, "FlirtingWithGeredo_2")
  125. else
  126. EmoteAnimationStart(NPC, Spawn)
  127. end
  128. end
  129. end
  130. end
  131. -- sent form Geredo's flirt
  132. -- sends to flustered animation next
  133. function FlirtWithIngrid_3(NPC, Spawn)
  134. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  135. PlayFlavor(NPC, "", "", "giggle", 0, 0)
  136. AddTimer(NPC, 2500, "Ingridflustered")
  137. end
  138. end
  139. -- emotes flustered
  140. -- sends back to Geredo after Ingrid's giggle
  141. function Ingridflustered(NPC, Spawn)
  142. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  143. PlayFlavor(NPC, "", "", "flustered", 0, 0)
  144. local Geredo = GetSpawn(NPC, 270004)
  145. if Geredo ~= nil then
  146. AddTimer(Geredo, 3000, "FlirtingWithGeredo_3")
  147. end
  148. end
  149. end
  150. -- sent form Geredo's blowkiss
  151. -- sends back to Geredo after Ingrid's no
  152. function FlirtWithIngrid_4(NPC, Spawn)
  153. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  154. PlayFlavor(NPC, "", "", "no", 0, 0)
  155. local Geredo = GetSpawn(NPC, 270004)
  156. if Geredo ~= nil then
  157. AddTimer(Geredo, 2000, "FlirtingWithGeredo_4")
  158. end
  159. end
  160. end
  161. -- sent form Geredo's beg
  162. -- sends to foot tap animation
  163. function FlirtWithIngrid_5(NPC, Spawn)
  164. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  165. PlayFlavor(NPC, "", "", "tapfoot", 0, 0)
  166. AddTimer(NPC, 3000, "IngridTapFoot")
  167. end
  168. end
  169. -- emotes foot tap
  170. -- sends back to Geredo after Ingrid's shrug
  171. function IngridTapFoot(NPC, Spawn)
  172. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  173. PlayFlavor(NPC, "", "", "shrug", 0, 0)
  174. if GetTempVariable(NPC, "TempAnimationVar") == "FirstRun" then
  175. SetTempVariable(NPC, "TempAnimationVar", "SecondRun")
  176. end
  177. AddTimer(NPC, 5000, "EmoteAnimationStart")
  178. end
  179. end
  180. -- Ingrid runs to Captain after camera shake
  181. -- sends to FaceCaptainVarlos function after movement
  182. function CaptainCallingIngrid(NPC, Spawn)
  183. PlayAnimation(NPC, 12246)
  184. if GetTempVariable(NPC, "TempAnimationVar") == nil then
  185. MoveToLocation(NPC, 2.47, -2.07, -3.26, 5)
  186. end
  187. SetTempVariable(NPC, "IngridSpawnPointer", Spawn)
  188. MoveToLocation(NPC, -2.72, -2.00, -8.34, 5, nil, true)
  189. MoveToLocation(NPC, -2.11, 1.21, -14.69, 5, nil, true)
  190. MoveToLocation(NPC, 0.78, 1.21, -14.51, 5, nil, true)
  191. MoveToLocation(NPC, 0.54, 1.18, -11.70, 5, nil, true)
  192. MoveToLocation(NPC, 1.68, 1.19, -12.13, 5, "FaceCaptainVarlos", false)
  193. end
  194. -- Ingird reaches Captain
  195. -- sends back to Captain upon arrival
  196. function FaceCaptainVarlos(NPC)
  197. local Spawn = GetTempVariable(NPC, "IngridSpawnPointer")
  198. SetTempVariable(NPC, "IngridSpawnPointer", nil)
  199. local Varlos = GetSpawn(NPC, 270000)
  200. FaceTarget(NPC, Varlos)
  201. if GetDistance(NPC, Varlos) >= 1.48 then
  202. AddTimer(Varlos, 500, "TalkToCaptainVarlos", 1, Spawn)
  203. end
  204. end
  205. -- Ingrid salutes Captain
  206. -- sends to ReturnToSpawnPoint function
  207. -- sends back to Captain
  208. function SaluteCaptainVarlos(NPC, Spawn)
  209. local Varlos = GetSpawn(NPC, 270000)
  210. PlayFlavor(NPC, "voiceover/english/ingrid/boat_06p_tutorial02/020_deckhand_ingrid_010_1637e047.mp3",
  211. "Aye, aye, Captain!", "salute", 1250282628, 237171958, Spawn)
  212. AddTimer(Varlos, 3000, "IngridLeaveCaptain", 1, Spawn)
  213. AddTimer(NPC, 2000, "ReturnToSpawnPoint", 1, Spawn)
  214. end
  215. function ReturnToSpawnPoint(NPC, Spawn)
  216. MoveToLocation(NPC, 0.78, 1.21, -14.51, 5, nil, true)
  217. MoveToLocation(NPC, -2.11, 1.21, -14.69, 5, nil, true)
  218. MoveToLocation(NPC, -2.72, -2.00, -8.34, 5, nil, true)
  219. MoveToLocation(NPC, 3.34, -2.07, -3.97, 5, nil, true)
  220. MoveToLocation(NPC, 2.35, -2.07, -3.34, 5, nil, false)
  221. end
  222. function small_talk(NPC, Spawn)
  223. Dialog.New(NPC, Spawn)
  224. Dialog.AddDialog(
  225. "I am fine, just... after the last pickup I have been working extra hard, since Vim said she would give me the piece of Luclin she found.")
  226. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_002.mp3", 3891218598, 1657063801)
  227. Dialog.AddOption("Vim?", "vim_who")
  228. Dialog.Start()
  229. end
  230. function vim_who(NPC, Spawn)
  231. Dialog.New(NPC, Spawn)
  232. Dialog.AddDialog(
  233. "Yes, yes, Vim. The merchant over there. She found a small piece of the moon and is having me work for it. Maybe you can go buy it from her for me?")
  234. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_003.mp3", 3050752668, 1437910974)
  235. Dialog.AddOption("Sure, but I have no money.", "no_money")
  236. Dialog.Start()
  237. vim = GetRandomSpawnByID(NPC, 270007)
  238. FaceTarget(NPC, vim)
  239. PlayFlavor(NPC,"","","point",0,0,Player)
  240. AddTimer(NPC, 3000, "turn_towards_player", 1, Spawn)
  241. end
  242. function turn_towards_player(NPC, Spawn)
  243. FaceTarget(NPC, Spawn)
  244. end
  245. function no_money(NPC, Spawn)
  246. Dialog.New(NPC, Spawn)
  247. Dialog.AddDialog("Maybe you have something she will buy. Why don't you go talk to her.")
  248. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_004.mp3", 3978048706, 2537762235)
  249. Dialog.AddOption("Sure.", "finished_step_four")
  250. Dialog.Start()
  251. end
  252. function finished_step_four(NPC, Spawn)
  253. SetTutorialStep(Spawn, 22)
  254. SetStepComplete(Spawn, 524, 4)
  255. end
  256. function thanks_for_getting_shard(NPC, Spawn)
  257. SetStepComplete(Spawn, 524, 6)
  258. RemoveItem(Spawn, ShardOfLuclin)
  259. end
  260. function respawn(NPC)
  261. end