9
3

MadamVi.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. --[[
  2. Script Name : SpawnScripts/TheCommonlands/MadamVi.lua
  3. Script Purpose : Madam Vi
  4. Script Author : premierio015
  5. Script Date : 2021.17.05
  6. Script Notes :
  7. --]]
  8. local QuenchingTheirThirst = 5222
  9. local FarFromHome = 5223
  10. local NoRiskNoReward = 5224
  11. local SeerStone = 5225
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, QuenchingTheirThirst) and not HasCompletedQuest(Spawn, QuenchingTheirThirst) then
  14. ProvidesQuest(NPC, QuenchingTheirThirst)
  15. SetInfoFlag(NPC)
  16. SetVisualFlag(NPC)
  17. elseif HasCompletedQuest(Spawn, QuenchingTheirThirst) then
  18. ProvidesQuest(NPC, FarFromHome)
  19. SetInfoFlag(NPC)
  20. SetVisualFlag(NPC)
  21. elseif HasCompletedQuest(Spawn, FarFromHome) then
  22. ProvidesQuest(NPC, NoRiskNoReward)
  23. SetInfoFlag(NPC)
  24. SetVisualFlag(NPC)
  25. elseif HasCompletedQuest(Spawn, NoRiskNoReward) then
  26. ProvidesQuest(NPC, SeerStone)
  27. SetInfoFlag(NPC)
  28. SetVisualFlag(NPC)
  29. end
  30. end
  31. function spawn(NPC)
  32. SetPlayerProximityFunction(NPC, 10, "InRange")
  33. end
  34. function respawn(NPC)
  35. spawn(NPC)
  36. end
  37. function hailed(NPC)
  38. FaceTarget(NPC, Spawn)
  39. if not HasQuest(Spawn, QuenchingTheirThirst) and not HasoCompletedQuest(Spawn, QuenchingTheirThirst) then
  40. local conversation = CreateConversation()
  41. AddConversationOption(conversation, "What assistance do you require?", "Option1")
  42. AddConversationOption(conversation, "I'm busy at the moment.")
  43. StartConversation(conversation, NPC, Spawn, "I need some assistance. Would you be willing to aid me?")
  44. elseif GetQuestStep(Spawn, QuenchingTheirThirst) == 1 or GetQuestStep(Spawn, QuenchingTheirThirst) == 2 or GetQuestStep(Spawn, QuenchingTheirThirst) == 3 or GetQuestStep(Spawn, FarFromHome) == 1 or GetQuestStep(Spawn, NoRiskNoReward) == 1 or GetQuestStep(Spawn, SeerStone) == 1 or GetQuestStep(Spawn, SeerStone) == 2 or GetQuestStep(Spawn, SeerStone) == 3 then
  45. QuestProgress(NPC, Spawn)
  46. elseif GetQuestStep(Spawn, QuenchingTheirThirst) == 4 or GetQuestStep(Spawn, FarFromHome) == 2 or GetQuestStep(Spawn, NoRiskNoReward) == 2 or GetQuestStep(Spawn, SeerStone) == 4 then
  47. QuestFinish(NPC, Spawn)
  48. elseif HasCompletedQuest(Spawn, QuenchingTheirThirst) and not HasCompletedQuest(Spawn, FarFromHome) then
  49. Option3(NPC, Spawn)
  50. elseif HasCompletedQuest(Spawn, QuenchingTheirThirst) and HasCompletedQuest(Spawn, FarFromHome) and not HasCompletedQuest(Spawn, NoRiskNoReward) then
  51. Option7(NPC, Spawn)
  52. elseif HasCompletedQuest(Spawn, QuenchingTheirThirst) and HasCompletedQuest(Spawn, FarFromHome) and HasCompletedQuest(Spawn, NoRiskNoReward) and not HasCompletedQuest(Spawn, SeerStone) then
  53. Option11(NPC, Spawn)
  54. elseif HasCompletedQuest(Spawn, QuenchingTheirThirst) and HasCompletedQuest(Spawn, FarFromHome) and HasCompletedQuest(Spawn, NoRiskNoReward) and HasCompletedQuest(Spawn, SeerStone) then
  55. PlayFlavor(NPC, "", "Wonderful to see you, thanks again for all your help.", "", 0, 0, Spawn)
  56. end
  57. end
  58. function Option1(NPC, Spawn)
  59. FaceTarget(NPC, Spawn)
  60. local conversation = CreateConversation()
  61. AddConversationOption(conversation, "Sure.", "offer")
  62. AddConversationOption(conversation, "Not right now.")
  63. StartConversation(conversation, NPC, Spawn, "The heat out here is ridiculous and I am parched. I would do anything for some nice cool water. The water around here gets so filthy from the livestock. Even as hot as it is, I can't just drink any water, you know? Do you think you could go out and fill each of these flasks with clean water from the lake and river for me? Oh, and I will also need one of them filled from the sea. Mooshga always needs more salt for curing her specialties.")
  64. end
  65. function Quest_Finish(NPC, Spawn)
  66. FaceTarget(NPC, Spawn)
  67. local conversation = CreateConversation()
  68. if GetQuestStep(Spawn, QuenchingTheirThirst) == 4 then
  69. AddConversationOption(conversation, "I have filled the flasks for you, Madam.", "Option2")
  70. elseif GetQuestStep(Spawn, FarFromHome) == 2 then
  71. AddConversationOption(conversation, "I was able to find your friends. They were very grateful for the water.", "Option6")
  72. elseif GetQuestStep(Spawn, NoRiskNoReward) == 2 then
  73. AddConversationOption(conversation, "I was able to find your stone, Madam.", "Option10")
  74. elseif GetQuestStep(Spawn, SeerStone) == 4 then
  75. AddConversationOption(conversation, "I have the things you need for your Seer Stone, Madam.", "Option15")
  76. end
  77. AddConversationOption(conversation, "Nothing right now.")
  78. StartConversation(conversation, NPC, Spawn, "Hello again. Any news?")
  79. end
  80. function Option2(NPC, Spawn)
  81. SetStepComplete(Spawn, QuenchingTheirThirst, 4)
  82. FaceTarget(NPC, Spawn)
  83. local conversation = CreateConversation()
  84. AddConversationOption(conversation, "You're welcome, Madam.")
  85. StartConversation(conversation, NPC, Spawn, "Excellent work!")
  86. end
  87. function Option3(NPC, Spawn)
  88. FaceTarget(NPC, Spawn)
  89. local conversation = CreateConversation()
  90. AddConversationOption(conversation, "Actually, I do.", "Option4")
  91. AddConversationOption(conversation, "Not for you.")
  92. StartConversation(conversation, NPC, Spawn, "Hello again. Do you have any further time to spare?")
  93. end
  94. function Option4(NPC, Spawn)
  95. FaceTarget(NPC, Spawn)
  96. local conversation = CreateConversation()
  97. AddConversationOption(conversation, "No problem, where are they?", "Option5")
  98. AddConversationOption(conversation, "I care not for your friends.")
  99. StartConversation(conversation, NPC, Spawn, "A section of my entourage seems to be lost out there. I need you to find them, give them the water you collected earlier, and relay their location to me.")
  100. end
  101. function Option5(NPC, Spawn)
  102. FaceTarget(NPC, Spawn)
  103. local conversation = CreateConversation()
  104. AddConversationOption(conversation, "I will find them.", "offer2")
  105. StartConversation(conversation, NPC, Spawn, "Head out to the northwest. They have been missing for quite some time.")
  106. end
  107. function Option6(NPC, Spawn)
  108. SetStepComplete(Spawn, FarFromHome, 2)
  109. FaceTarget(NPC, Spawn)
  110. local conversation = CreateConversation()
  111. AddConversationOption(conversation, "I agree.")
  112. StartConversation(conversation, NPC, Spawn, "Great news! Nothing like an ice cold drink on a hot day.")
  113. end
  114. function Option7(NPC, Spawn)
  115. FaceTarget(NPC, Spawn)
  116. local conversation = CreateConversation()
  117. AddConversationOption(conversation, "It was my pleasure, but you seem distracted. Do you require further assistance?", "Option8")
  118. AddConversationOption(conversation, "I did do great, didn't I? I'll be off now.")
  119. StartConversation(conversation, NPC, Spawn, "Hello, friend. My companions are rehydrated and back to themselves, thanks to you.")
  120. end
  121. function Option8(NPC, Spawn)
  122. FaceTarget(NPC, Spawn)
  123. local conversation = CreateConversation()
  124. AddConversationOption(conversation, "I meant no offense. Is there anything I can do to rid you of this distraction?", "Option9")
  125. AddConversationOption(conversation, "I think you need to get out of the sun. Goodbye.")
  126. StartConversation(conversation, NPC, Spawn, "Wha..distracted? Hmm, well I suppose you are correct, but please do keep your observations to yourself in the future. ")
  127. end
  128. function Option9(NPC, Spawn)
  129. FaceTarget(NPC, Spawn)
  130. local conversation = CreateConversation()
  131. AddConversationOption(conversation, "I will find the gem for you.", "offer3")
  132. AddConversationOption(conversation, "Wailing Caves? Are you insane?!")
  133. StartConversation(conversation, NPC, Spawn, "There is a gem that I truly desire which has evaded me. I heard that it can be found by breaking open clumps of rocks inside the Wailing Caves to the west. Look for dull stone outcroppings near the vibrant blue rocks found inside.")
  134. end
  135. function Option10(NPC, Spawn)
  136. SetStepComplete(Spawn, NoRiskNoReward, 2)
  137. FaceTarget(NPC, Spawn)
  138. local conversation = CreateConversation()
  139. AddConversationOption(conversation, "You're welcome.")
  140. StartConversation(conversation, NPC, Spawn, "Oh yes, this is just what I needed. Look here, the gem is right inside. Oh, it's just gorgeous, and will work perfectly for what I have in mind. Thank you.")
  141. end
  142. function Option11(NPC, Spawn)
  143. FaceTarget(NPC, Spawn)
  144. local conversation = CreateConversation()
  145. AddConversationOption(conversation, "Some, yes.", "Option12")
  146. AddConversationOption(conversation, "No, nothing at all. I better go.")
  147. StartConversation(conversation, NPC, Spawn, "You have certainly proven yourself, and it is I who am honored. Tell me, do you know anything of mage craft?")
  148. end
  149. function Option12(NPC, Spawn)
  150. FaceTarget(NPC, Spawn)
  151. local conversation = CreateConversation()
  152. AddConversationOption(conversation, "Ahh, so that is what the gem samples were for.", "Option13")
  153. AddConversationOption(conversation, "I am sick of your ego. Goodbye.")
  154. StartConversation(conversation, NPC, Spawn, "There are certain items that, when created, can help a mage focus his or her power. These items enhance my already impressive gift of Sight.")
  155. end
  156. function Option13(NPC, Spawn)
  157. FaceTarget(NPC, Spawn)
  158. local conversation = CreateConversation()
  159. AddConversationOption(conversation, "I am very interested. Where do I look?", "Option14")
  160. AddConversationOption(conversation, "No, not right now. Maybe later.")
  161. StartConversation(conversation, NPC, Spawn, "Exactly. You are quite intuitive. The gem you retrieved for me is in itself not enough to create the quality item I desire. Would you be interested in fetching the rest of the components I need?")
  162. end
  163. function Option14(NPC, Spawn)
  164. FaceTarget(NPC, Spawn)
  165. local conversation = CreateConversation()
  166. AddConversationOption(conversation, "I'll be off then.", "offer4")
  167. AddConversationOption(conversation, "I don't think I will help.")
  168. StartConversation(conversation, NPC, Spawn, "To finish my Seer Stone, I will need some components that you can gather for me from different beasts around the Commonlands. I will need some bone dust, a few water glands and, just for good measure, some sparkly bits.")
  169. end
  170. function Option15(NPC, Spawn)
  171. SetStepComplete(Spawn, SeerStone, 4)
  172. FaceTarget(NPC, Spawn)
  173. local conversation = CreateConversation()
  174. AddConversationOption(conversation, "You're welcome, Madam.")
  175. StartConversation(conversation, NPC, Spawn, "Oh, thank you... I can complete my stone, at long last!")
  176. end
  177. function offer(NPC, Spawn)
  178. OfferQuest(NPC, Spawn, QuenchingTheirThirst )
  179. end
  180. function offer2(NPC, Spawn)
  181. OfferQuest(NPC, Spawn, FarFromHome)
  182. end
  183. function offer3(NPC, Spawn)
  184. OfferQuest(NPC, Spawn, NoRiskNoReward)
  185. end
  186. function offer4(NPC, Spawn)
  187. OfferQuest(NPC, Spawn, SeerStone)
  188. end
  189. function QuestProgress(NPC, Spawn)
  190. FaceTarget(NPC, Spawn)
  191. local conversation = CreateConversation()
  192. AddConversationOption(conversation, "Not yet. Patience, my lady.")
  193. StartConversation(conversation, NPC, Spawn, "Have you completed your task?")
  194. end