DavynThornbranch.lua 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. --[[
  2. Script Name : SpawnScripts/WillowWood/DavynThornbranch.lua
  3. Script Purpose : Davyn Thornbranch
  4. Script Author : Scatman
  5. Script Date : 2009.09.15
  6. Script Notes : Updated by Jabantiz (4/21/2017)
  7. --]]
  8. local WOOD_ELF_QUEST_1 = 213 -- Offering Help
  9. local WOOD_ELF_QUEST_2 = 214 -- Tribute Leaves
  10. local WOOD_ELF_QUEST_3 = 215 -- A Task for Davyn
  11. local WOOD_ELF_QUEST_4 = 216 -- Tribute Flowers
  12. local WOOD_ELF_QUEST_5 = 217 -- A Tribute for Ulinir
  13. function spawn(NPC)
  14. ProvidesQuest(NPC, WOOD_ELF_QUEST_3)
  15. ProvidesQuest(NPC, WOOD_ELF_QUEST_5)
  16. SetPlayerProximityFunction(NPC, 8, "InRange", "LeaveRange")
  17. end
  18. function respawn(NPC)
  19. spawn(NPC)
  20. end
  21. function InRange(NPC, Spawn)
  22. if math.random(1, 100) <= 60 then
  23. choice = math.random(1,3)
  24. if choice ==1 then
  25. PlayFlavor(NPC, "", "", "ponder", 0, 0, Spawn)
  26. elseif choice ==3 then
  27. PlayFlavor(NPC, "", "", "sniff", 0, 0, Spawn)
  28. elseif choice ==4 then
  29. PlayFlavor(NPC, "", "", "hello", 0, 0, Spawn)
  30. FaceTarget(NPC, Spawn)
  31. else
  32. PlayFlavor(NPC, "", "", "cough", 0, 0, Spawn)
  33. end
  34. end
  35. end
  36. function hailed(NPC, Spawn)
  37. FaceTarget(NPC, Spawn)
  38. conversation = CreateConversation()
  39. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_1) then
  40. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_2) then
  41. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_3) then
  42. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_4) then
  43. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_5) then
  44. DeliveredTributeYet(NPC, Spawn, conversation)
  45. elseif HasQuest(Spawn, WOOD_ELF_QUEST_5) then
  46. DeliveredTributeYet(NPC, Spawn, conversation)
  47. else
  48. MeantTributeMine(NPC, Spawn)
  49. end
  50. elseif HasQuest(Spawn, WOOD_ELF_QUEST_4) then
  51. if GetQuestStep(Spawn, WOOD_ELF_QUEST_4) == 3 then
  52. HowGoesWorkOnTribute(NPC, Spawn, conversation)
  53. else
  54. Say(NPC, "Now that you've helped me you should go speak with Aelis again.", Spawn)
  55. end
  56. else
  57. Say(NPC, "Now that you've helped me you should go speak with Aelis again.", Spawn)
  58. end
  59. elseif HasQuest(Spawn, WOOD_ELF_QUEST_3) then
  60. if GetQuestStep(Spawn, WOOD_ELF_QUEST_3) == 6 then
  61. Say(NPC, "Now that you've helped me you should go speak with Aelis again.", Spawn)
  62. else
  63. FoundWolfYet(NPC, Spawn, conversation)
  64. end
  65. else
  66. IsMyTributeComplete(NPC, Spawn, conversation)
  67. end
  68. elseif HasQuest(Spawn, WOOD_ELF_QUEST_2) then
  69. if GetQuestStep(Spawn, WOOD_ELF_QUEST_2) == 1 or GetQuestStep(Spawn, WOOD_ELF_QUEST_2) == 2 then
  70. Say(NPC, "I hope you and Aelis are getting along well.", Spawn)
  71. elseif GetQuestStep(Spawn, WOOD_ELF_QUEST_2) == 3 then
  72. IsMyTributeComplete(NPC, Spawn, conversation)
  73. end
  74. else
  75. Say(NPC, "I hope you and Aelis are getting along well.", Spawn)
  76. end
  77. elseif HasQuest(Spawn, WOOD_ELF_QUEST_1) then
  78. if GetQuestStep(Spawn, WOOD_ELF_QUEST_1) == 1 then
  79. GoodDayToYou(NPC, Spawn, conversation)
  80. elseif GetQuestStep(Spawn, WOOD_ELF_QUEST_1) == 2 then
  81. Say(NPC, "I hope you and Aelis are getting along well.", Spawn)
  82. end
  83. else
  84. Say(NPC, "Sorry, I'm kind of busy right now.", Spawn)
  85. end
  86. end
  87. --------------------------------------------------------------------------------------------------------------------------------
  88. -- QUEST 1
  89. --------------------------------------------------------------------------------------------------------------------------------
  90. function GoodDayToYou(NPC, Spawn, conversation)
  91. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch001.mp3", "", "", 3860010631, 4122099989, Spawn)
  92. AddConversationOption(conversation, "How are you doing today?", "FineAndYou")
  93. AddConversationOption(conversation, "And to you. Good-bye for now.")
  94. StartConversation(conversation, NPC, Spawn, "Good day to you.")
  95. end
  96. function FineAndYou(NPC, Spawn)
  97. FaceTarget(NPC, Spawn)
  98. conversation = CreateConversation()
  99. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch002.mp3", "", "", 316906143, 655236793, Spawn)
  100. AddConversationOption(conversation, "I feel wonderful.", "dlg_3_2")
  101. AddConversationOption(conversation, "I am well.", "dlg_3_2")
  102. AddConversationOption(conversation, "I am not so well.", "dlg_5_2")
  103. AddConversationOption(conversation, "I feel terrible.", "dlg_5_2")
  104. StartConversation(conversation, NPC, Spawn, "I am fine, and you?")
  105. end
  106. function dlg_3_2(NPC, Spawn)
  107. FaceTarget(NPC, Spawn)
  108. conversation = CreateConversation()
  109. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch003.mp3", "", "", 2401906927, 1079328143, Spawn)
  110. AddConversationOption(conversation, "Nothing too troubling, I hope.", "dlg_6_4")
  111. AddConversationOption(conversation, "I will be going then.")
  112. StartConversation(conversation, NPC, Spawn, "That is good to hear. I apologize for being terse, but I am in the middle of some thoughts.")
  113. end
  114. function dlg_5_2(NPC, Spawn)
  115. FaceTarget(NPC, Spawn)
  116. conversation = CreateConversation()
  117. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch004.mp3", "", "", 2608502735, 3672722454, Spawn)
  118. AddConversationOption(conversation, "Nothing too troubling, I hope.", "dlg_6_4")
  119. AddConversationOption(conversation, "I will be going then.")
  120. StartConversation(conversation, NPC, Spawn, "That is unfortunate, though without the dark there would be no light. I apologize for being terse, but I am in the middle of some thoughts.")
  121. end
  122. function dlg_6_3(NPC, Spawn)
  123. FaceTarget(NPC, Spawn)
  124. conversation = CreateConversation()
  125. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch005.mp3", "", "", 4284267619, 900168490, Spawn)
  126. AddConversationOption(conversation, "Is there anything I can do to help?", "dlg_6_4")
  127. StartConversation(conversation, NPC, Spawn, "Not troubling, no. But important, and thus hard not to worry about.")
  128. end
  129. function dlg_6_4(NPC, Spawn)
  130. FaceTarget(NPC, Spawn)
  131. conversation = CreateConversation()
  132. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch008.mp3", "", "", 1201358473, 1534683104, Spawn)
  133. AddConversationOption(conversation, "What must I do?", "dlg_6_5")
  134. StartConversation(conversation, NPC, Spawn, "I am working on a Feir'Dal tribute for my old friend Ulinir. He was a very dear friend; a tribute is the least I could do. Sadly I am unable to focus properly and have been unable to make any progress at all. I suppose it speaks of some inner turmoil on my part, but I hate to keep Ulinir waiting. If you could help me create his tribute I would be very grateful.")
  135. end
  136. function dlg_6_5(NPC, Spawn)
  137. SetStepComplete(Spawn, WOOD_ELF_QUEST_1, 1)
  138. FaceTarget(NPC, Spawn)
  139. conversation = CreateConversation()
  140. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch009.mp3", "", "", 2426834769, 2651026217, Spawn)
  141. AddConversationOption(conversation, "I'll go speak with her.")
  142. StartConversation(conversation, NPC, Spawn, "I appreciate this more than you know. Go speak with Aelis. She should be on or near the docks. Tell her that you would like to help me create my tribute; she will know what to do.")
  143. end
  144. -------------------------------------------------------------------------------------------------------------------------------------------------------
  145. -- QUEST 2
  146. -------------------------------------------------------------------------------------------------------------------------------------------------------
  147. function IsMyTributeComplete(NPC, Spawn, conversation)
  148. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch010.mp3", "", "", 3747511411, 3979607357, Spawn)
  149. AddConversationOption(conversation, "Aelis said I needed to do a task for you as part of the tribute creation.", "dlg_12_1")
  150. AddConversationOption(conversation, "No, not yet.")
  151. StartConversation(conversation, NPC, Spawn, "Is my tribute complete?")
  152. end
  153. function dlg_12_1(NPC, Spawn)
  154. if HasQuest(Spawn, WOOD_ELF_QUEST_2) then
  155. SetStepComplete(Spawn, WOOD_ELF_QUEST_2, 3)
  156. end
  157. FaceTarget(NPC, Spawn)
  158. conversation = CreateConversation()
  159. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch011.mp3", "", "", 20096395, 3481349416, Spawn)
  160. AddConversationOption(conversation, "She said it could be any task, large or small.", "IHaveOneThing")
  161. StartConversation(conversation, NPC, Spawn, "Hmm, that's a little humorous, considering the tribute is already a favor you're doing for me. What kind of task did you need to do for me?")
  162. end
  163. -------------------------------------------------------------------------------------------------------------------------------------------------------
  164. -- QUEST 3
  165. -------------------------------------------------------------------------------------------------------------------------------------------------------
  166. function IHaveOneThing(NPC, Spawn)
  167. FaceTarget(NPC, Spawn)
  168. conversation = CreateConversation()
  169. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch012.mp3", "", "", 678144380, 633781914, Spawn)
  170. AddConversationOption(conversation, "Sure.", "CitizenReportedWolf")
  171. AddConversationOption(conversation, "No, I'll hold off for now.")
  172. StartConversation(conversation, NPC, Spawn, "I do have one thing you could do to satisfy Aelis' requirements, though it might be a little dangerous. Do you want to try?")
  173. end
  174. function CitizenReportedWolf(NPC, Spawn)
  175. FaceTarget(NPC, Spawn)
  176. conversation = CreateConversation()
  177. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch013.mp3", "", "", 539477564, 2851114968, Spawn)
  178. AddConversationOption(conversation, "I will speak with him immediately.", "OfferQuest3")
  179. AddConversationOption(conversation, "Perhaps another time.")
  180. StartConversation(conversation, NPC, Spawn, "A citizen reported seeing a wolf last night. Normally that isn't anything to worry about, but the behavior of this wolf was described as very, very aggressive. I am afraid Willow Wood may have a rabid wolf among its citizens. The initial report came from a man named Taval Zane. He is staying at the inn just just south of here. I suggest you start with him.")
  181. end
  182. function OfferQuest3(NPC, Spawn)
  183. FaceTarget(NPC, Spawn)
  184. OfferQuest(NPC, Spawn, WOOD_ELF_QUEST_3)
  185. end
  186. function FoundWolfYet(NPC, Spawn, conversation)
  187. if GetQuestStep(Spawn, WOOD_ELF_QUEST_3) == 5 then
  188. AddConversationOption(conversation, "Yes, the wolf is dead.", "dlg_21_1")
  189. end
  190. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch014.mp3", "", "", 3240548911, 582138521, Spawn)
  191. AddConversationOption(conversation, "No, not yet.")
  192. StartConversation(conversation, NPC, Spawn, "Have you found the wolf yet?")
  193. end
  194. function dlg_21_1(NPC, Spawn)
  195. SetStepComplete(Spawn, WOOD_ELF_QUEST_3, 5)
  196. FaceTarget(NPC, Spawn)
  197. conversation = CreateConversation()
  198. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch015.mp3", "", "", 1785285003, 1047753849, Spawn)
  199. AddConversationOption(conversation, "I am glad to have helped.", "dlg_21_2")
  200. StartConversation(conversation, NPC, Spawn, "I am sorry to have given you such a grim task. You have helped the village greatly, though.")
  201. end
  202. function dlg_21_2(NPC, Spawn)
  203. FaceTarget(NPC, Spawn)
  204. conversation = CreateConversation()
  205. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch016.mp3", "", "", 2783457255, 1132022982, Spawn)
  206. AddConversationOption(conversation, "I shall.")
  207. StartConversation(conversation, NPC, Spawn, "I am glad you did help... Well, I guess you should be getting back to Aelis now.")
  208. end
  209. -----------------------------------------------------------------------------------------------------------------------
  210. -- QUEST 4
  211. -----------------------------------------------------------------------------------------------------------------------
  212. function HowGoesWorkOnTribute(NPC, Spawn, conversation)
  213. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch017.mp3", "", "", 846132167, 3864459263, Spawn)
  214. AddConversationOption(conversation, "You mean your tribute?", "MeantTributeMine")
  215. AddConversationOption(conversation, "I am not quite done.")
  216. StartConversation(conversation, NPC, Spawn, "How goes work on your tribute?")
  217. end
  218. function MeantTributeMine(NPC, Spawn)
  219. if HasQuest(Spawn, WOOD_ELF_QUEST_4) then
  220. SetStepComplete(Spawn, WOOD_ELF_QUEST_4, 3)
  221. end
  222. FaceTarget(NPC, Spawn)
  223. conversation = CreateConversation()
  224. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch018.mp3", "", "", 3806105401, 4200917967, Spawn)
  225. AddConversationOption(conversation, "Yes, I think I can do that.", "dlg_25_2")
  226. AddConversationOption(conversation, "No, thank you.")
  227. StartConversation(conversation, NPC, Spawn, "I meant the tribute to be mine alone at first, but you and Aelis are the ones who made this tribute. It would be disrespectful for me to present it to Ulinir. I think you should use the tribute as your own and place it on Ulinir's grave. I know you didn't know him, but he was most certainly worthy. What do you say?")
  228. end
  229. ---------------------------------------------------------------------------------------------------------------------------
  230. -- QUEST 5
  231. ---------------------------------------------------------------------------------------------------------------------------
  232. function dlg_25_2(NPC, Spawn)
  233. FaceTarget(NPC, Spawn)
  234. conversation = CreateConversation()
  235. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch019.mp3", "", "", 795265842, 2129977796, Spawn)
  236. AddConversationOption(conversation, "Very well; I shall do that now.", "OfferQuest5")
  237. AddConversationOption(conversation, "I have no time to do this now.")
  238. StartConversation(conversation, NPC, Spawn, "I was hoping you would say that. You can find Ulinir's grave in the Forest Ruins. His grave is outside of the ruins themselves, to the northeast of them. There is a river that runs under the actual ruins. Ulinir's grave is at the end of that river.")
  239. end
  240. function OfferQuest5(NPC, Spawn)
  241. FaceTarget(NPC, Spawn)
  242. OfferQuest(NPC, Spawn, WOOD_ELF_QUEST_5)
  243. end
  244. function DeliveredTributeYet(NPC, Spawn, conversation)
  245. FaceTarget(NPC, Spawn)
  246. conversation = CreateConversation()
  247. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_5) then
  248. AddConversationOption(conversation, "Yes. Yes, I have.", "DeliveredTribute")
  249. end
  250. AddConversationOption(conversation, "No, I have not yet.")
  251. StartConversation(conversation, NPC, Spawn, "Have you delivered the tribute yet?")
  252. end
  253. function DeliveredTribute(NPC, Spawn)
  254. FaceTarget(NPC, Spawn)
  255. conversation = CreateConversation()
  256. AddConversationOption(conversation, "You are welcome.")
  257. StartConversation(conversation, NPC, Spawn, "Good. Ulinir will know a small part of it is from me as such, he will accept you as a friend. Thank you again, friend.")
  258. end