Jaza.lua 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. --[[
  2. Script Name : SpawnScripts/SinkingSands/Jaza.lua
  3. Script Author : premierio015
  4. Script Date : 2023.12.16 04:12:14
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/DialogModule"
  9. local KallonsVengeance = 5938 -- Kallon's Vengeance Quest ID
  10. function spawn(NPC)
  11. if GetSpawnLocationID(NPC) == 308200 then
  12. SetPlayerProximityFunction(NPC, 15, "InRange")
  13. end
  14. end
  15. function prespawn(NPC)
  16. if GetSpawnLocationID(NPC) == 308201 then
  17. SpawnSet(NPC, "model_type", 4922)
  18. SetTempVariable(NPC, "NoDupe", "true")
  19. end
  20. end
  21. function hailed(NPC, Spawn)
  22. FaceTarget(NPC, Spawn)
  23. if GetSpawnLocationID(NPC) == 308200 then
  24. if not HasQuest(Spawn, KallonsVengeance) and not HasCompletedQuest(Spawn, KallonsVengeance) then
  25. PlayFlavor(NPC, "", "Go away, I am busy.", "heckno", 0, 0, Spawn)
  26. elseif GetQuestStep(Spawn, KallonsVengeance) == 1 then
  27. Option0(NPC, Spawn)
  28. elseif GetQuestStep(Spawn, KallonsVengeance) == 2 then
  29. PlayFlavor(NPC, "", "We shall meet at the oasis as i have indicated! Please leave so that i can prepare.", "", 0, 0, Spawn)
  30. elseif GetQuestStep(Spawn, KallonsVengeance) == 5 then
  31. PlayFlavor(NPC, "", "Thank you for sparing me, barrashar!", "", 1689589577, 4560189, Spawn)
  32. end
  33. elseif GetSpawnLocationID(NPC) == 308201 then
  34. if HasQuest(Spawn, KallonsVengeance) then
  35. Option2(NPC, Spawn)
  36. elseif GetQuestStep(Spawn, KallonsVengeance) == 4 then
  37. Option4(NPC, Spawn)
  38. elseif not HasQuest(Spawn, KallonsVengeance) then
  39. PlayFlavor(NPC, "", "There is nothing around here that interests you, move along!", "", 0, 0, Spawn)
  40. Despawn(308201, 60000)
  41. elseif GetQuestStep(Spawn, KallonsVengeance) == 5 or HasCompletedQuest(Spawn, KallonsVengeance) then
  42. PlayFlavor(NPC, "", "I have heeded your warning, please do not harm me!", "", 1231512930, 1030010135, Spawn)
  43. end
  44. end
  45. end
  46. function Option0(NPC, Spawn)
  47. Dialog.New(NPC, Spawn)
  48. Dialog.AddDialog("Greetings, barrashar, my name is Jaza. Perhaps you are looking for a guide to Maj'Dul? This desert can be quite deadly without proper direction.")
  49. Dialog.AddOption("Yes, I could use a guide.", "Option1")
  50. Dialog.AddOption("No, I am not interested at this time.")
  51. Dialog.Start()
  52. end
  53. function Option1(NPC, Spawn)
  54. SetStepComplete(Spawn, KallonsVengeance, 1)
  55. JazaSpawn(NPC, Spawn)
  56. FaceTarget(NPC, Spawn)
  57. Dialog.New(NPC, Spawn)
  58. Dialog.AddDialog("Excellent! I am your man for this. I will meet you at the beginning of the route to Maj'Dul within the Oasis of Marr in a short while. We can negotiate payment at that time.")
  59. Dialog.AddOption("I will meet you there.")
  60. Dialog.Start()
  61. end
  62. function JazaSpawn(NPC, Spawn)
  63. if HasQuest(Spawn, KallonsVengeance) then
  64. local zone = GetZone(Spawn)
  65. local JazaID = GetSpawnByLocationID(zone, 308201)
  66. if JazaID == nil then
  67. SpawnByLocationID(zone, 308201)
  68. end
  69. end
  70. end
  71. function Option2(NPC, Spawn)
  72. FaceTarget(NPC, Spawn)
  73. Dialog.New(NPC, Spawn)
  74. Dialog.AddDialog("Ah, welcome barrashar. Our escorts should be arriving any moment.")
  75. Dialog.AddOption("Escorts?", "Option3")
  76. Dialog.AddOption("I am not quite ready, I will return shortly.")
  77. Dialog.Start()
  78. end
  79. function Option3(NPC, Spawn)
  80. FaceTarget(NPC, Spawn)
  81. Dialog.New(NPC, Spawn)
  82. Dialog.AddDialog("Well, perhaps I am being a bit unclear. MY escorts are coming. I suspect you will be none too pleased to meet them, especially Fasul.")
  83. Dialog.AddOption("We shall see about that!", "escort_arriving")
  84. Dialog.Start()
  85. end
  86. function Option4(NPC, Spawn)
  87. FaceTarget(NPC, Spawn)
  88. Dialog.New(NPC, Spawn)
  89. Dialog.AddDialog("Please do not kill me! Please! They forced me to do this, I did not wish to lure people here. Please spare me!")
  90. Dialog.AddOption("Why should I?", "Option5")
  91. Dialog.AddOption("I do not have time for your begging.")
  92. Dialog.AddEmote("cringe")
  93. Dialog.Start()
  94. end
  95. function Option5(NPC, Spawn)
  96. SetStepComplete(Spawn, KallonsVengeance, 4)
  97. FaceTarget(NPC, Spawn)
  98. Dialog.New(NPC, Spawn)
  99. Dialog.AddDialog("Because you are a just and kind person! If you spare me, I swear never to mislead travelers. Give me a chance, please!")
  100. Dialog.AddOption("I'll let you live. However, if I hear of another incident involving you...")
  101. Dialog.AddEmote("beg")
  102. Dialog.Start()
  103. end
  104. function InRange(NPC, Spawn)
  105. FaceTarget(NPC, Spawn)
  106. PlayFlavor(NPC, "", "Welcome barrashar! Do you need a guide for this desert? If so, speak to me.", "", 1689589577, 4560189, Spawn)
  107. end
  108. function escort_arriving(NPC, Spawn) -- Spawns Fasul gang
  109. if GetTempVariable(NPC, "NoDupe") == "true" then
  110. AddTimer(NPC, 6000, "check")
  111. end
  112. end
  113. function check(NPC, Spawn)
  114. if GetTempVariable(NPC, "NoDupe") == "true" then
  115. local zone = GetZone(NPC)
  116. SpawnGroupByID(zone, 1056891)
  117. SetTempVariable(NPC, "NoDupe", "false")
  118. end
  119. end
  120. function respawn(NPC)
  121. spawn(NPC)
  122. end