TalkTestOld.lua 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. --[[
  2. Script Name : SpawnScripts/thunderdome/TalkTestOld.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.05.12 02:05:26
  5. Script Purpose : For demonstration of dialogues with quests using ORIGINAL setup. Copied from Gubbo in Enchanted Lands.
  6. :
  7. --]]
  8. local LousyFairies = 117 -- Designates the quest ID for reference later
  9. function spawn(NPC)
  10. ProvidesQuest(NPC, LousyFairies) -- NPC Shows Quest Feather for the ID'd quest.
  11. SetPlayerProximityFunction(NPC, 10, "InRange") -- Setup for NPC Callout alerting player of something within 10 meters (in this case, a quest). New function "InRange" created.
  12. end
  13. function respawn(NPC)
  14. spawn(NPC) -- If NPC dies and respawns this will trigger the spawn function above.
  15. end
  16. function InRange(NPC, Spawn) -- Plays to player if they haven't finished or started the quest
  17. if not HasCompletedQuest(Spawn, LousyFairies) and not HasQuest(Spawn, LousyFairies) then
  18. 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)
  19. end
  20. end
  21. function hailed(NPC, Spawn) -- Primary Command for all normal dialogue
  22. 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
  23. Dialog1(NPC, Spawn)
  24. elseif HasQuest(Spawn,LousyFairies) then -- if player has the quest - directs to Dialog3
  25. Dialog3(NPC, Spawn)
  26. else
  27. Dialog5(NPC, Spawn) -- if player has finished the quest and does not have quest - will driect to Dialog5
  28. end
  29. end
  30. --Starting Quest---------------------------------------- First Hail. ONLY displayed if player hasn't finished and doesn't have the quest
  31. function Dialog1(NPC, Spawn)
  32. FaceTarget(NPC, Spawn) -- Forces NPC to face Spawn (player)
  33. conversation = CreateConversation() -- Designates diologue is created when referenced
  34. PlayFlavor(NPC, "voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley001.mp3", "", "scream", 1577103216, 3792943385, Spawn) --Plays Voiceover, emotes, and directs who the Voiceover is to.
  35. AddConversationOption(conversation, "Sure.[STARTS QUEST]", "Dialog2")
  36. AddConversationOption(conversation, "I don't know Fritz.")
  37. StartConversation(conversation, NPC, Spawn, "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! ") --Required to start a dialogue
  38. end
  39. function Dialog2(NPC, Spawn)
  40. OfferQuest(NPC, Spawn, LousyFairies) -- Offers Quest
  41. end
  42. --Finishing Quest--------------------------------------
  43. function Dialog3(NPC, Spawn)
  44. conversation = CreateConversation() -- Designates diologue is created when referenced
  45. PlayFlavor(NPC, "voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley004.mp3", "", "", 2878548247, 952555633, Spawn)
  46. if GetQuestStep(Spawn, LousyFairies)==2 then -- if player is on the 2nd step of quest - will display dialogue option.
  47. AddConversationOption(conversation, "[STEP 2] Yes.", "Dialog4")
  48. end
  49. AddConversationOption(conversation, "Working on it.")
  50. StartConversation(conversation, NPC, Spawn, "Uh ... so you killed them fairies, yeah?")
  51. end
  52. function Dialog4(NPC, Spawn)
  53. conversation = CreateConversation() -- Designates diologue is created when referenced
  54. PlayFlavor(NPC, "voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley005.mp3","","cringe", 2881662034, 1373874040, Spawn)
  55. AddConversationOption(conversation, "Right. [FINISHES QUEST]","QuestDone")
  56. StartConversation(conversation, NPC, Spawn, "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.")
  57. end
  58. function QuestDone(NPC,Spawn)
  59. FaceTarget(NPC, Spawn)
  60. SetStepComplete(Spawn, LousyFairies, 2) -- Updates player's quest by completing step 2.
  61. end
  62. --Post Quest-------------------------------------------
  63. function Dialog5(NPC, Spawn)
  64. conversation = CreateConversation() -- Designates diologue is created when referenced
  65. PlayFlavor(NPC, "voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley006.mp3","","", 4082962413, 3474255449, Spawn)
  66. AddConversationOption(conversation, "Sure.")
  67. StartConversation(conversation, NPC, Spawn, "[POST QUEST] If you see Fritz, would you tell him I'm looking for him?")
  68. end