9
3

Ingrid.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. AddTimer(NPC,5000,"Next",1,Spawn)
  37. Dialog.New(NPC, Spawn)
  38. Dialog.AddDialog("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.")
  39. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_006.mp3", 502975024, 483052250)
  40. PlayFlavor(NPC,"","","happy")
  41. Dialog.AddOption("Thanks.", "thanks_for_getting_shard")
  42. Dialog.Start()
  43. elseif GetX(NPC) < 5 then
  44. FaceTarget(NPC, Spawn)
  45. local rand = math.random(0, 2)
  46. if rand == 0 then
  47. 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)
  48. elseif rand == 1 then
  49. PlayFlavor(NPC, "voiceover/english/ingrid/boat_06p_tutorial02_fvo_008.mp3", "Don't you just love the sea?","sniff", 541733813, 1294072887, Spawn)
  50. else
  51. PlayFlavor(NPC, "voiceover/english/ingrid/boat_06p_tutorial02_fvo_007.mp3", "Yo ho ho and a bottle of rum!","smile", 964088856, 3568852318, Spawn)
  52. end
  53. end
  54. end
  55. function Next(NPC,Spawn)
  56. SetTutorialStep(Spawn, 31)
  57. end
  58. end
  59. function InRange(NPC,Spawn)
  60. if GetTempVariable(NPC,"Starting","Checking") then
  61. SetTempVariable(NPC, "Starting", "Done")
  62. AddTimer(NPC, 30000, "WalkToGeredo",1,Spawn)
  63. end
  64. end
  65. function WalkToGeredo(NPC, Spawn)
  66. playerhasquest = HasQuest(Spawn, 524)
  67. if playerhasquest == true then
  68. MoveToLocation(NPC, 2.35, -2.07, -3.34, 5, nil, false)
  69. else
  70. MoveToLocation(NPC, 5.85, -2.07, -2.94, 2, nil, true)
  71. MoveToLocation(NPC, 5.77, -2.07, -1.56, 2, nil, false)
  72. AddTimer(NPC, 1500, "EmoteAnimationStart")
  73. end
  74. end
  75. -- sends to Geredo to start the flirting
  76. -- no action on Ingrid's part yet
  77. function EmoteAnimationStart(NPC, Spawn)
  78. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  79. AnimationChoice = math.random(0, 10)
  80. local Geredo = GetSpawn(NPC, 270004)
  81. if Geredo ~= nil then
  82. if GetTempVariable(NPC, "TempAnimationVar") == "FirstRun" then
  83. AddTimer(Geredo, 2000, "GeredoFlirtingWithIngird")
  84. else
  85. if GetTempVariable(NPC, "TempAnimationVar") == "SecondRun" and AnimationChoice <= 5 then
  86. AddTimer(Geredo, 5000, "GeredoFlirtingWithIngird")
  87. else
  88. AddTimer(Geredo, 5000, "FlirtingWithGeredo")
  89. end
  90. end
  91. end
  92. end
  93. end
  94. -- sent from Geredo's flex
  95. -- sends back to Geredo after Ingrid's response with a chuckle
  96. function FlirtWithIngrid(NPC, Spawn)
  97. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  98. PlayFlavor(NPC, "", "", "chuckle", 0, 0)
  99. AnimationChoice = math.random(0, 9)
  100. local Geredo = GetSpawn(NPC, 270004)
  101. if Geredo ~= nil then
  102. if GetTempVariable(NPC, "TempAnimationVar") == "FirstRun" then
  103. AddTimer(Geredo, 5000, "FlirtingWithGeredo")
  104. else
  105. if GetTempVariable(NPC, "TempAnimationVar") == "SecondRun" and AnimationChoice >= 7 then
  106. AddTimer(Geredo, 5000, "FlirtingWithGeredo")
  107. else
  108. EmoteAnimationStart(NPC, Spawn)
  109. end
  110. end
  111. end
  112. end
  113. end
  114. -- sent form Geredo's bow
  115. -- sends back to Geredo after Ingrid's curtsey
  116. function FlirtWithIngrid_2(NPC, Spawn)
  117. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  118. PlayFlavor(NPC, "", "", "curtsey", 0, 0)
  119. AnimationChoice = math.random(0, 9)
  120. local Geredo = GetSpawn(NPC, 270004)
  121. if Geredo ~= nil then
  122. if GetTempVariable(NPC, "TempAnimationVar") == "FirstRun" then
  123. AddTimer(Geredo, 5000, "FlirtingWithGeredo_2")
  124. elseif GetTempVariable(NPC, "TempAnimationVar") == "SecondRun" and AnimationChoice >= 7 then
  125. AddTimer(Geredo, 5000, "FlirtingWithGeredo_2")
  126. else
  127. EmoteAnimationStart(NPC, Spawn)
  128. end
  129. end
  130. end
  131. end
  132. -- sent form Geredo's flirt
  133. -- sends to flustered animation next
  134. function FlirtWithIngrid_3(NPC, Spawn)
  135. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  136. PlayFlavor(NPC, "", "", "giggle", 0, 0)
  137. AddTimer(NPC, 2500, "Ingridflustered")
  138. end
  139. end
  140. -- emotes flustered
  141. -- sends back to Geredo after Ingrid's giggle
  142. function Ingridflustered(NPC, Spawn)
  143. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  144. PlayFlavor(NPC, "", "", "flustered", 0, 0)
  145. local Geredo = GetSpawn(NPC, 270004)
  146. if Geredo ~= nil then
  147. AddTimer(Geredo, 3000, "FlirtingWithGeredo_3")
  148. end
  149. end
  150. end
  151. -- sent form Geredo's blowkiss
  152. -- sends back to Geredo after Ingrid's no
  153. function FlirtWithIngrid_4(NPC, Spawn)
  154. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  155. PlayFlavor(NPC, "", "", "no", 0, 0)
  156. local Geredo = GetSpawn(NPC, 270004)
  157. if Geredo ~= nil then
  158. AddTimer(Geredo, 2000, "FlirtingWithGeredo_4")
  159. end
  160. end
  161. end
  162. -- sent form Geredo's beg
  163. -- sends to foot tap animation
  164. function FlirtWithIngrid_5(NPC, Spawn)
  165. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  166. PlayFlavor(NPC, "", "", "tapfoot", 0, 0)
  167. AddTimer(NPC, 3000, "IngridTapFoot")
  168. end
  169. end
  170. -- emotes foot tap
  171. -- sends back to Geredo after Ingrid's shrug
  172. function IngridTapFoot(NPC, Spawn)
  173. if GetTempVariable(NPC, "TempAnimationVar") ~= nil then
  174. PlayFlavor(NPC, "", "", "shrug", 0, 0)
  175. if GetTempVariable(NPC, "TempAnimationVar") == "FirstRun" then
  176. SetTempVariable(NPC, "TempAnimationVar", "SecondRun")
  177. end
  178. AddTimer(NPC, 5000, "EmoteAnimationStart")
  179. end
  180. end
  181. -- Ingrid runs to Captain after camera shake
  182. -- sends to FaceCaptainVarlos function after movement
  183. function CaptainCallingIngrid(NPC, Spawn)
  184. PlayAnimation(NPC, 12246)
  185. if GetTempVariable(NPC, "TempAnimationVar") == nil then
  186. MoveToLocation(NPC, 2.47, -2.07, -3.26, 5)
  187. end
  188. SetTempVariable(NPC, "IngridSpawnPointer", Spawn)
  189. MoveToLocation(NPC, -2.72, -2.00, -8.34, 5, nil, true)
  190. MoveToLocation(NPC, -2.11, 1.21, -14.69, 5, nil, true)
  191. MoveToLocation(NPC, 0.78, 1.21, -14.51, 5, nil, true)
  192. MoveToLocation(NPC, 0.54, 1.18, -11.70, 5, nil, true)
  193. MoveToLocation(NPC, 1.68, 1.19, -12.13, 5, "FaceCaptainVarlos", false)
  194. end
  195. -- Ingird reaches Captain
  196. -- sends back to Captain upon arrival
  197. function FaceCaptainVarlos(NPC)
  198. local Spawn = GetTempVariable(NPC, "IngridSpawnPointer")
  199. SetTempVariable(NPC, "IngridSpawnPointer", nil)
  200. local Varlos = GetSpawn(NPC, 270000)
  201. FaceTarget(NPC, Varlos)
  202. if GetDistance(NPC, Varlos) >= 1.48 then
  203. AddTimer(Varlos, 500, "TalkToCaptainVarlos", 1, Spawn)
  204. end
  205. end
  206. -- Ingrid salutes Captain
  207. -- sends to ReturnToSpawnPoint function
  208. -- sends back to Captain
  209. function SaluteCaptainVarlos(NPC, Spawn)
  210. local Varlos = GetSpawn(NPC, 270000)
  211. PlayFlavor(NPC, "voiceover/english/ingrid/boat_06p_tutorial02/020_deckhand_ingrid_010_1637e047.mp3",
  212. "Aye, aye, Captain!", "salute", 1250282628, 237171958, Spawn)
  213. AddTimer(Varlos, 3000, "IngridLeaveCaptain", 1, Spawn)
  214. AddTimer(NPC, 2000, "ReturnToSpawnPoint", 1, Spawn)
  215. end
  216. function ReturnToSpawnPoint(NPC, Spawn)
  217. MoveToLocation(NPC, 0.78, 1.21, -14.51, 5, nil, true)
  218. MoveToLocation(NPC, -2.11, 1.21, -14.69, 5, nil, true)
  219. MoveToLocation(NPC, -2.72, -2.00, -8.34, 5, nil, true)
  220. MoveToLocation(NPC, 3.34, -2.07, -3.97, 5, nil, true)
  221. MoveToLocation(NPC, 2.35, -2.07, -3.34, 5, nil, false)
  222. end
  223. function small_talk(NPC, Spawn)
  224. Dialog.New(NPC, Spawn)
  225. Dialog.AddDialog(
  226. "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.")
  227. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_002.mp3", 3891218598, 1657063801)
  228. Dialog.AddOption("Vim?", "vim_who")
  229. Dialog.Start()
  230. end
  231. function vim_who(NPC, Spawn)
  232. Dialog.New(NPC, Spawn)
  233. Dialog.AddDialog(
  234. "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?")
  235. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_003.mp3", 3050752668, 1437910974)
  236. Dialog.AddOption("Sure, but I have no money.", "no_money")
  237. Dialog.Start()
  238. vim = GetRandomSpawnByID(NPC, 270007)
  239. FaceTarget(NPC, vim)
  240. PlayFlavor(NPC,"","","point",0,0,Player)
  241. AddTimer(NPC, 3000, "turn_towards_player", 1, Spawn)
  242. end
  243. function turn_towards_player(NPC, Spawn)
  244. FaceTarget(NPC, Spawn)
  245. end
  246. function no_money(NPC, Spawn)
  247. Dialog.New(NPC, Spawn)
  248. Dialog.AddDialog("Maybe you have something she will buy. Why don't you go talk to her.")
  249. Dialog.AddVoiceover("voiceover/english/ingrid/boat_06p_tutorial02/ingrid_0_004.mp3", 3978048706, 2537762235)
  250. Dialog.AddOption("Sure.", "finished_step_four")
  251. Dialog.Start()
  252. end
  253. function finished_step_four(NPC, Spawn)
  254. SetTutorialStep(Spawn, 22)
  255. SetStepComplete(Spawn, 524, 4)
  256. end
  257. function thanks_for_getting_shard(NPC, Spawn)
  258. SetStepComplete(Spawn, 524, 6)
  259. RemoveItem(Spawn, ShardOfLuclin)
  260. AddCoin(Spawn, 10)
  261. SendMessage(Spawn, "You receive 10 Copper.")
  262. end
  263. function respawn(NPC)
  264. end