DavynThornbranch.lua 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. SetInfoStructString(NPC, "action_state", "ponder")
  18. end
  19. function respawn(NPC)
  20. spawn(NPC)
  21. end
  22. function InRange(NPC, Spawn)
  23. if math.random(1, 100) <= 60 then
  24. choice = math.random(1,3)
  25. if choice ==1 then
  26. PlayFlavor(NPC, "", "", "ponder", 0, 0, Spawn)
  27. elseif choice ==3 then
  28. PlayFlavor(NPC, "", "", "sniff", 0, 0, Spawn)
  29. elseif choice ==4 then
  30. PlayFlavor(NPC, "", "", "hello", 0, 0, Spawn)
  31. FaceTarget(NPC, Spawn)
  32. else
  33. PlayFlavor(NPC, "", "", "cough", 0, 0, Spawn)
  34. end
  35. end
  36. end
  37. function hailed(NPC, Spawn)
  38. FaceTarget(NPC, Spawn)
  39. conversation = CreateConversation()
  40. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_1) then
  41. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_2) then
  42. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_3) then
  43. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_4) then
  44. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_5) then
  45. DeliveredTributeYet(NPC, Spawn, conversation)
  46. elseif HasQuest(Spawn, WOOD_ELF_QUEST_5) then
  47. DeliveredTributeYet(NPC, Spawn, conversation)
  48. else
  49. MeantTributeMine(NPC, Spawn)
  50. end
  51. elseif HasQuest(Spawn, WOOD_ELF_QUEST_4) then
  52. if GetQuestStep(Spawn, WOOD_ELF_QUEST_4) == 3 then
  53. HowGoesWorkOnTribute(NPC, Spawn, conversation)
  54. else
  55. Say(NPC, "Now that you've helped me you should go speak with Aelis again.", Spawn)
  56. end
  57. else
  58. Say(NPC, "Now that you've helped me you should go speak with Aelis again.", Spawn)
  59. end
  60. elseif HasQuest(Spawn, WOOD_ELF_QUEST_3) then
  61. if GetQuestStep(Spawn, WOOD_ELF_QUEST_3) == 6 then
  62. Say(NPC, "Now that you've helped me you should go speak with Aelis again.", Spawn)
  63. else
  64. FoundWolfYet(NPC, Spawn, conversation)
  65. end
  66. else
  67. IsMyTributeComplete(NPC, Spawn, conversation)
  68. end
  69. elseif HasQuest(Spawn, WOOD_ELF_QUEST_2) then
  70. if GetQuestStep(Spawn, WOOD_ELF_QUEST_2) == 1 or GetQuestStep(Spawn, WOOD_ELF_QUEST_2) == 2 then
  71. Say(NPC, "I hope you and Aelis are getting along well.", Spawn)
  72. elseif GetQuestStep(Spawn, WOOD_ELF_QUEST_2) == 3 then
  73. IsMyTributeComplete(NPC, Spawn, conversation)
  74. end
  75. else
  76. Say(NPC, "I hope you and Aelis are getting along well.", Spawn)
  77. end
  78. elseif HasQuest(Spawn, WOOD_ELF_QUEST_1) then
  79. if GetQuestStep(Spawn, WOOD_ELF_QUEST_1) == 1 then
  80. GoodDayToYou(NPC, Spawn, conversation)
  81. elseif GetQuestStep(Spawn, WOOD_ELF_QUEST_1) == 2 then
  82. Say(NPC, "I hope you and Aelis are getting along well.", Spawn)
  83. end
  84. else
  85. Say(NPC, "Sorry, I'm kind of busy right now.", Spawn)
  86. end
  87. end
  88. --------------------------------------------------------------------------------------------------------------------------------
  89. -- QUEST 1
  90. --------------------------------------------------------------------------------------------------------------------------------
  91. function GoodDayToYou(NPC, Spawn, conversation)
  92. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch001.mp3", "", "", 3860010631, 4122099989, Spawn)
  93. AddConversationOption(conversation, "How are you doing today?", "FineAndYou")
  94. AddConversationOption(conversation, "And to you. Good-bye for now.")
  95. StartConversation(conversation, NPC, Spawn, "Good day to you.")
  96. end
  97. function FineAndYou(NPC, Spawn)
  98. FaceTarget(NPC, Spawn)
  99. conversation = CreateConversation()
  100. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch002.mp3", "", "", 316906143, 655236793, Spawn)
  101. AddConversationOption(conversation, "I feel wonderful.", "dlg_3_2")
  102. AddConversationOption(conversation, "I am well.", "dlg_3_2")
  103. AddConversationOption(conversation, "I am not so well.", "dlg_5_2")
  104. AddConversationOption(conversation, "I feel terrible.", "dlg_5_2")
  105. StartConversation(conversation, NPC, Spawn, "I am fine, and you?")
  106. end
  107. function dlg_3_2(NPC, Spawn)
  108. FaceTarget(NPC, Spawn)
  109. conversation = CreateConversation()
  110. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch003.mp3", "", "", 2401906927, 1079328143, Spawn)
  111. AddConversationOption(conversation, "Nothing too troubling, I hope.", "dlg_6_4")
  112. AddConversationOption(conversation, "I will be going then.")
  113. StartConversation(conversation, NPC, Spawn, "That is good to hear. I apologize for being terse, but I am in the middle of some thoughts.")
  114. end
  115. function dlg_5_2(NPC, Spawn)
  116. FaceTarget(NPC, Spawn)
  117. conversation = CreateConversation()
  118. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch004.mp3", "", "", 2608502735, 3672722454, Spawn)
  119. AddConversationOption(conversation, "Nothing too troubling, I hope.", "dlg_6_4")
  120. AddConversationOption(conversation, "I will be going then.")
  121. 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.")
  122. end
  123. function dlg_6_3(NPC, Spawn)
  124. FaceTarget(NPC, Spawn)
  125. conversation = CreateConversation()
  126. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch005.mp3", "", "", 4284267619, 900168490, Spawn)
  127. AddConversationOption(conversation, "Is there anything I can do to help?", "dlg_6_4")
  128. StartConversation(conversation, NPC, Spawn, "Not troubling, no. But important, and thus hard not to worry about.")
  129. end
  130. function dlg_6_4(NPC, Spawn)
  131. FaceTarget(NPC, Spawn)
  132. conversation = CreateConversation()
  133. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch008.mp3", "", "", 1201358473, 1534683104, Spawn)
  134. AddConversationOption(conversation, "What must I do?", "dlg_6_5")
  135. 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.")
  136. end
  137. function dlg_6_5(NPC, Spawn)
  138. SetStepComplete(Spawn, WOOD_ELF_QUEST_1, 1)
  139. FaceTarget(NPC, Spawn)
  140. conversation = CreateConversation()
  141. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch009.mp3", "", "", 2426834769, 2651026217, Spawn)
  142. AddConversationOption(conversation, "I'll go speak with her.")
  143. 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.")
  144. end
  145. -------------------------------------------------------------------------------------------------------------------------------------------------------
  146. -- QUEST 2
  147. -------------------------------------------------------------------------------------------------------------------------------------------------------
  148. function IsMyTributeComplete(NPC, Spawn, conversation)
  149. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch010.mp3", "", "", 3747511411, 3979607357, Spawn)
  150. AddConversationOption(conversation, "Aelis said I needed to do a task for you as part of the tribute creation.", "dlg_12_1")
  151. AddConversationOption(conversation, "No, not yet.")
  152. StartConversation(conversation, NPC, Spawn, "Is my tribute complete?")
  153. end
  154. function dlg_12_1(NPC, Spawn)
  155. if HasQuest(Spawn, WOOD_ELF_QUEST_2) then
  156. SetStepComplete(Spawn, WOOD_ELF_QUEST_2, 3)
  157. end
  158. FaceTarget(NPC, Spawn)
  159. conversation = CreateConversation()
  160. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch011.mp3", "", "", 20096395, 3481349416, Spawn)
  161. AddConversationOption(conversation, "She said it could be any task, large or small.", "IHaveOneThing")
  162. 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?")
  163. end
  164. -------------------------------------------------------------------------------------------------------------------------------------------------------
  165. -- QUEST 3
  166. -------------------------------------------------------------------------------------------------------------------------------------------------------
  167. function IHaveOneThing(NPC, Spawn)
  168. FaceTarget(NPC, Spawn)
  169. conversation = CreateConversation()
  170. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch012.mp3", "", "", 678144380, 633781914, Spawn)
  171. AddConversationOption(conversation, "Sure.", "CitizenReportedWolf")
  172. AddConversationOption(conversation, "No, I'll hold off for now.")
  173. 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?")
  174. end
  175. function CitizenReportedWolf(NPC, Spawn)
  176. FaceTarget(NPC, Spawn)
  177. conversation = CreateConversation()
  178. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch013.mp3", "", "", 539477564, 2851114968, Spawn)
  179. AddConversationOption(conversation, "I will speak with him immediately.", "OfferQuest3")
  180. AddConversationOption(conversation, "Perhaps another time.")
  181. 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.")
  182. end
  183. function OfferQuest3(NPC, Spawn)
  184. FaceTarget(NPC, Spawn)
  185. OfferQuest(NPC, Spawn, WOOD_ELF_QUEST_3)
  186. end
  187. function FoundWolfYet(NPC, Spawn, conversation)
  188. if GetQuestStep(Spawn, WOOD_ELF_QUEST_3) == 5 then
  189. AddConversationOption(conversation, "Yes, the wolf is dead.", "dlg_21_1")
  190. end
  191. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch014.mp3", "", "", 3240548911, 582138521, Spawn)
  192. AddConversationOption(conversation, "No, not yet.")
  193. StartConversation(conversation, NPC, Spawn, "Have you found the wolf yet?")
  194. end
  195. function dlg_21_1(NPC, Spawn)
  196. SetStepComplete(Spawn, WOOD_ELF_QUEST_3, 5)
  197. FaceTarget(NPC, Spawn)
  198. conversation = CreateConversation()
  199. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch015.mp3", "", "", 1785285003, 1047753849, Spawn)
  200. AddConversationOption(conversation, "I am glad to have helped.", "dlg_21_2")
  201. StartConversation(conversation, NPC, Spawn, "I am sorry to have given you such a grim task. You have helped the village greatly, though.")
  202. end
  203. function dlg_21_2(NPC, Spawn)
  204. FaceTarget(NPC, Spawn)
  205. conversation = CreateConversation()
  206. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch016.mp3", "", "", 2783457255, 1132022982, Spawn)
  207. AddConversationOption(conversation, "I shall.")
  208. StartConversation(conversation, NPC, Spawn, "I am glad you did help... Well, I guess you should be getting back to Aelis now.")
  209. end
  210. -----------------------------------------------------------------------------------------------------------------------
  211. -- QUEST 4
  212. -----------------------------------------------------------------------------------------------------------------------
  213. function HowGoesWorkOnTribute(NPC, Spawn, conversation)
  214. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch017.mp3", "", "", 846132167, 3864459263, Spawn)
  215. AddConversationOption(conversation, "You mean your tribute?", "MeantTributeMine")
  216. AddConversationOption(conversation, "I am not quite done.")
  217. StartConversation(conversation, NPC, Spawn, "How goes work on your tribute?")
  218. end
  219. function MeantTributeMine(NPC, Spawn)
  220. if HasQuest(Spawn, WOOD_ELF_QUEST_4) then
  221. SetStepComplete(Spawn, WOOD_ELF_QUEST_4, 3)
  222. end
  223. FaceTarget(NPC, Spawn)
  224. conversation = CreateConversation()
  225. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch018.mp3", "", "", 3806105401, 4200917967, Spawn)
  226. AddConversationOption(conversation, "Yes, I think I can do that.", "dlg_25_2")
  227. AddConversationOption(conversation, "No, thank you.")
  228. 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?")
  229. end
  230. ---------------------------------------------------------------------------------------------------------------------------
  231. -- QUEST 5
  232. ---------------------------------------------------------------------------------------------------------------------------
  233. function dlg_25_2(NPC, Spawn)
  234. FaceTarget(NPC, Spawn)
  235. conversation = CreateConversation()
  236. PlayFlavor(NPC, "voiceover/english/tutorial_revamp/davyn_thornbranch/qey_village05/quests/davyn_thornbranch/davyn_thornbranch019.mp3", "", "", 795265842, 2129977796, Spawn)
  237. AddConversationOption(conversation, "Very well; I shall do that now.", "OfferQuest5")
  238. AddConversationOption(conversation, "I have no time to do this now.")
  239. 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.")
  240. end
  241. function OfferQuest5(NPC, Spawn)
  242. FaceTarget(NPC, Spawn)
  243. OfferQuest(NPC, Spawn, WOOD_ELF_QUEST_5)
  244. end
  245. function DeliveredTributeYet(NPC, Spawn, conversation)
  246. FaceTarget(NPC, Spawn)
  247. conversation = CreateConversation()
  248. if HasCompletedQuest(Spawn, WOOD_ELF_QUEST_5) then
  249. AddConversationOption(conversation, "Yes. Yes, I have.", "DeliveredTribute")
  250. end
  251. AddConversationOption(conversation, "No, I have not yet.")
  252. StartConversation(conversation, NPC, Spawn, "Have you delivered the tribute yet?")
  253. end
  254. function DeliveredTribute(NPC, Spawn)
  255. FaceTarget(NPC, Spawn)
  256. conversation = CreateConversation()
  257. AddConversationOption(conversation, "You are welcome.")
  258. 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.")
  259. end