9
3

TalkTestOld.lua 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. if GetFactionAmount(Spawn,12) <0 then
  39. ChangeFaction(Spawn,12,5000)
  40. end
  41. end
  42. function Dialog2(NPC, Spawn)
  43. OfferQuest(NPC, Spawn, LousyFairies) -- Offers Quest
  44. end
  45. --Finishing Quest--------------------------------------
  46. function Dialog3(NPC, Spawn)
  47. conversation = CreateConversation() -- Designates diologue is created when referenced
  48. PlayFlavor(NPC, "voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley004.mp3", "", "", 2878548247, 952555633, Spawn)
  49. if GetQuestStep(Spawn, LousyFairies)==2 then -- if player is on the 2nd step of quest - will display dialogue option.
  50. AddConversationOption(conversation, "[STEP 2] Yes.", "Dialog4")
  51. end
  52. AddConversationOption(conversation, "Working on it.")
  53. StartConversation(conversation, NPC, Spawn, "Uh ... so you killed them fairies, yeah?")
  54. end
  55. function Dialog4(NPC, Spawn)
  56. conversation = CreateConversation() -- Designates diologue is created when referenced
  57. PlayFlavor(NPC, "voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley005.mp3","","cringe", 2881662034, 1373874040, Spawn)
  58. AddConversationOption(conversation, "Right. [FINISHES QUEST]","QuestDone")
  59. 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.")
  60. end
  61. function QuestDone(NPC,Spawn)
  62. FaceTarget(NPC, Spawn)
  63. SetStepComplete(Spawn, LousyFairies, 2) -- Updates player's quest by completing step 2.
  64. end
  65. --Post Quest-------------------------------------------
  66. function Dialog5(NPC, Spawn)
  67. conversation = CreateConversation() -- Designates diologue is created when referenced
  68. PlayFlavor(NPC, "voiceover/english/gubbo_chaley/enchanted/gubbo_chaley/gubbo_chaley006.mp3","","", 4082962413, 3474255449, Spawn)
  69. AddConversationOption(conversation, "Sure.")
  70. StartConversation(conversation, NPC, Spawn, "[POST QUEST] If you see Fritz, would you tell him I'm looking for him?")
  71. end