TalkTest.lua 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. --[[
  2. Script Name : SpawnScripts/thunderdome/TalkTest.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.05.12 12:05:27
  5. Script Purpose : Testing Dialogue module for making conversations. Dialogue Pulled from Gubbo in Enchanted Lands.
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/DialogModule" -- Required at the start of any dialogue using this setup
  9. local LousyFairies = 117 -- Designates the quest ID for reference later
  10. function spawn(NPC)
  11. ProvidesQuest(NPC, LousyFairies) -- NPC Shows Quest Feather for the ID'd quest.
  12. SetPlayerProximityFunction(NPC, 10, "InRange") -- Setup for NPC Callout alerting player of something within 10 meters (in this case, a quest). New function "InRange" created.
  13. end
  14. function respawn(NPC)
  15. spawn(NPC) -- If NPC dies and respawns this will trigger the spawn function above.
  16. end
  17. function InRange(NPC, Spawn) -- Plays to player if they haven't finished or started the quest
  18. if not HasCompletedQuest(Spawn, LousyFairies) and not HasQuest(Spawn, LousyFairies) then
  19. PlayFlavor(NPC, "voiceover/english/gubbo_chaley/enchanted/halflings/halfling_gubbo_chaley_callout_f7b85d2f.mp3", "Fritz! They killed Fritz! Those lousy fairies killed Fritz!", "", 2757692791, 3745928300, Spawn)
  20. end
  21. end
  22. function hailed(NPC, Spawn) -- Primary Command for all normal dialogue
  23. if not HasCompletedQuest(Spawn, LousyFairies) and not HasQuest(Spawn,LousyFairies) then -- if player has NOT completed nor has the quest - will direct to Dialog1 function
  24. Dialog1(NPC, Spawn)
  25. elseif HasQuest(Spawn,LousyFairies) then -- if player has the quest - directs to Dialog3
  26. Dialog3(NPC, Spawn)
  27. else
  28. Dialog5(NPC, Spawn) -- if player has finished the quest and is not on 2nd step - will driect to Dialog5
  29. end
  30. end
  31. --Starting Quest---------------------------------------- First Hail. ONLY displayed if player hasn't finished and doesn't have the quest
  32. function Dialog1(NPC, Spawn)
  33. FaceTarget(NPC, Spawn) -- Forces NPC to face Spawn (player)
  34. Dialog.New(NPC, Spawn) -- Starts a new dialogue from NPC to player
  35. Dialog.AddDialog("Kill them! I want you to kill those lousy, stinking, yellow fairies! You'll do this for me, right? You'll do this for Fritz! ")
  36. Dialog.AddVoiceover("voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley001.mp3", 1577103216, 3792943385)
  37. -- Dialog.Emote("scream")
  38. Dialog.AddOption("Sure.", "Dialog2")
  39. Dialog.AddOption("I don't know Fritz. ")
  40. Dialog.Start()
  41. end
  42. function Dialog2(NPC, Spawn)
  43. FaceTarget(NPC, Spawn)
  44. Dialog.New(NPC, Spawn)
  45. Dialog.AddDialog("Right over there, along the coast ... those blasted, smug fairies!")
  46. Dialog.AddVoiceover("voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley002.mp3", 1079858941, 3307355952)
  47. Dialog.AddOption("Alright.[STARTS QUEST]","QuestStart")
  48. Dialog.Start()
  49. end
  50. function QuestStart(NPC, Spawn)
  51. OfferQuest(NPC, Spawn, LousyFairies)
  52. end
  53. --Finishing Quest--------------------------------------
  54. function Dialog3(NPC, Spawn)
  55. FaceTarget(NPC, Spawn)
  56. Dialog.New(NPC, Spawn)
  57. Dialog.AddDialog("Uh ... so you killed them fairies, yeah?")
  58. Dialog.AddVoiceover("voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley004.mp3", 2878548247, 952555633)
  59. if GetQuestStep(Spawn, LousyFairies)==2 then
  60. Dialog.AddOption("[STEP 2]Yes.", "Dialog4") -- if player is on the 2nd step of quest - will direct to Dialog4 function and allow finishing the quest.
  61. end
  62. Dialog.AddOption("Working on it.")
  63. Dialog.Start()
  64. end
  65. function Dialog4(NPC, Spawn)
  66. FaceTarget(NPC, Spawn)
  67. Dialog.New(NPC, Spawn)
  68. Dialog.AddDialog("I'm really sorry about that. Turns out, Fritz was just passed out under the docks. Umm ... why don't you take this, and we'll just pretend we never had this little discussion. ")
  69. Dialog.AddVoiceover("voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley005.mp3", 2881662034, 1373874040)
  70. Dialog.AddOption("Right.[FINISHES QUEST]","QuestDone")
  71. Dialog.Start()
  72. end
  73. function QuestDone(NPC,Spawn)
  74. FaceTarget(NPC, Spawn)
  75. SetStepComplete(Spawn, LousyFairies, 2)
  76. end
  77. --Post Quest-------------------------------------------
  78. function Dialog5(NPC, Spawn)
  79. FaceTarget(NPC, Spawn)
  80. Dialog.New(NPC, Spawn)
  81. Dialog.AddDialog("[POST QUEST] If you see Fritz, would you tell him I'm looking for him?")
  82. Dialog.AddVoiceover("voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley006.mp3", 4082962413, 3474255449)
  83. Dialog.AddOption("Sure.")
  84. Dialog.Start()
  85. end