questroguechestwidget.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. --[[
  2. Script Name : SpawnScripts/FallenGate/questroguechestwidget.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.12 07:07:57
  5. Script Purpose : chest script needef for quest "Searching the Depths of Fallen Gate"
  6. :
  7. --]]
  8. local SearchTheDepthsOfFallenGate = 5307
  9. local FallenDragoonBangleItem = 7025
  10. function spawn(NPC)
  11. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  12. end
  13. function InRange(NPC, Spawn)
  14. if GetQuestStep(Spawn, SearchTheDepthsOfFallenGate) == 4 then
  15. SetAccessToEntityCommand(Spawn,NPC,"open the chest", 1)
  16. SpawnSet(NPC, "show_command_icon", 1)
  17. SpawnSet(NPC, "display_hand_icon", 1)
  18. end
  19. end
  20. function casted_on(NPC, Spawn, SpellName)
  21. if SpellName == 'open the chest' then
  22. if GetQuestStep(Spawn, SearchTheDepthsOfFallenGate) == 4 then
  23. conversation = CreateConversation()
  24. AddConversationOption(conversation, "1", "Correct_Number01")
  25. AddConversationOption(conversation, "2", "Wrong")
  26. AddConversationOption(conversation, "3", "Wrong")
  27. AddConversationOption(conversation, "4", "Wrong")
  28. AddConversationOption(conversation, "5", "Wrong")
  29. AddConversationOption(conversation, "6", "Wrong")
  30. StartDialogConversation(conversation, 1, NPC, Spawn, "This must be the chest the mad Teir'dal wrote of! As you reach to open the chest, you notice a circular dial with a sequence of numbers. You decide to spin the dial to...")
  31. elseif QuestStepIsComplete(Spawn, SearchTheDepthsOfFallenGate, 4) then
  32. SendMessage(Spawn, "You have already recovered the bracelet from this chest.", 20)
  33. end
  34. end
  35. end
  36. function Wrong(NPC, Spawn)
  37. conversation = CreateConversation()
  38. AddConversationOption(conversation, "Oops!")
  39. StartDialogConversation(conversation, 1, NPC, Spawn, "A strange glow lights up the area and the dial turns back to its starting place!")
  40. end
  41. function Correct_Number01(NPC, Spawn)
  42. conversation = CreateConversation()
  43. AddConversationOption(conversation, "1", "Wrong")
  44. AddConversationOption(conversation, "2", "Wrong")
  45. AddConversationOption(conversation, "3", "Wrong")
  46. AddConversationOption(conversation, "4", "Correct_Number02")
  47. AddConversationOption(conversation, "5", "Wrong")
  48. AddConversationOption(conversation, "6", "Wrong")
  49. StartDialogConversation(conversation, 1, NPC, Spawn, "The ancient tumbler creaks to a halt. You begin to spin the dial to the right and pick a new number...")
  50. end
  51. function Correct_Number02(NPC, Spawn)
  52. conversation = CreateConversation()
  53. AddConversationOption(conversation, "1", "Wrong")
  54. AddConversationOption(conversation, "2", "Correct_Number03")
  55. AddConversationOption(conversation, "3", "Wrong")
  56. AddConversationOption(conversation, "4", "Wrong")
  57. AddConversationOption(conversation, "5", "Wrong")
  58. AddConversationOption(conversation, "6", "Wrong")
  59. StartDialogConversation(conversation, 1, NPC, Spawn, "Again, the tumbler stops. Your third choice is...")
  60. end
  61. function Correct_Number03(NPC, Spawn)
  62. conversation = CreateConversation()
  63. AddConversationOption(conversation, "1", "Wrong")
  64. AddConversationOption(conversation, "2", "Wrong")
  65. AddConversationOption(conversation, "3", "Wrong")
  66. AddConversationOption(conversation, "4", "Wrong")
  67. AddConversationOption(conversation, "5", "Wrong")
  68. AddConversationOption(conversation, "6", "Correct_Number04")
  69. StartDialogConversation(conversation, 1, NPC, Spawn, "Something seems to block the lock for a moment, but then it slides into the correct position. You pick...")
  70. end
  71. function Correct_Number04(NPC, Spawn)
  72. conversation = CreateConversation()
  73. AddConversationOption(conversation, "1", "Wrong")
  74. AddConversationOption(conversation, "2", "Wrong")
  75. AddConversationOption(conversation, "3", "Correct_Number05")
  76. AddConversationOption(conversation, "4", "Wrong")
  77. AddConversationOption(conversation, "5", "Wrong")
  78. AddConversationOption(conversation, "6", "Wrong")
  79. StartDialogConversation(conversation, 1, NPC, Spawn, "The dial stops spinning. Your new choice is...")
  80. end
  81. function Correct_Number05(NPC, Spawn)
  82. conversation = CreateConversation()
  83. AddConversationOption(conversation, "1", "Wrong")
  84. AddConversationOption(conversation, "2", "Wrong")
  85. AddConversationOption(conversation, "3", "Wrong")
  86. AddConversationOption(conversation, "4", "Wrong")
  87. AddConversationOption(conversation, "5", "Correct_Number06")
  88. AddConversationOption(conversation, "6", "Wrong")
  89. StartDialogConversation(conversation, 1, NPC, Spawn, "The obviously-gnomish contraption creaks a bit as the cogs spin around. You turn to...")
  90. end
  91. function Correct_Number06(NPC, Spawn)
  92. conversation = CreateConversation()
  93. AddConversationOption(conversation, "[take the bracelet]", "complete")
  94. StartDialogConversation(conversation, 1, NPC, Spawn, "The decrepit lock falls apart as the magical energy holding it together releases. Inside you find a small metallic bracelet.")
  95. end
  96. function complete(NPC, Spawn)
  97. SummonItem(Spawn, FallenDragoonBangleItem, 1)
  98. SetStepComplete(Spawn, SearchTheDepthsOfFallenGate, 4)
  99. end
  100. function respawn(NPC)
  101. spawn(NPC)
  102. end