aWindstalkerCitizen2.lua 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. --[[
  2. Script Name : SpawnScripts/Antonica/aWindstalkerCitizen2.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.08.16 08:08:43
  5. Script Purpose :
  6. :
  7. --]]
  8. local LichaDancingQueen = 5342
  9. function spawn(NPC)
  10. SetTempVariable(NPC, "QUEST_HAILED", "false")
  11. end
  12. function hailed(NPC, Spawn)
  13. FaceTarget(NPC, Spawn)
  14. if HasQuest(Spawn, LichaDancingQueen) and GetTempVariable(NPC, "QUEST_HAILED") == "false" then
  15. local conversation = CreateConversation()
  16. AddConversationOption(conversation, "Licha asked me to tell the villagers that she is going to dance.", "Option3")
  17. AddConversationOption(conversation, "Never mind.")
  18. StartConversation(conversation, NPC, Spawn, "What can I do for you?")
  19. elseif GetTempVariable(NPC, "QUEST_HAILED") == "true" or HasCompletedQuest(Spawn, LichaDancingQueen) then
  20. local choice = MakeRandomInt(1, 2)
  21. if choice == 1 then
  22. PlayFlavor(NPC, "", "I heard you the first time.", "", 0, 0, Spawn)
  23. elseif choice == 2 then
  24. PlayFlavor(NPC, "", "I know, I know. You already told me.", "", 0, 0, Spawn)
  25. end
  26. end
  27. end
  28. function Option3(NPC, Spawn) -- we don't use easy ways to sort.
  29. SetTempVariable(NPC, "QUEST_HAILED", "true")
  30. if QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and QuestStepIsComplete(Spawn, LichaDancingQueen, 2) then
  31. SetStepComplete(Spawn, LichaDancingQueen, 3)
  32. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 2) and QuestStepIsComplete(Spawn, LichaDancingQueen, 3) then
  33. SetStepComplete(Spawn, LichaDancingQueen, 1)
  34. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 3) and QuestStepIsComplete(Spawn, LichaDancingQueen, 1) then
  35. SetStepComplete(Spawn, LichaDancingQueen, 2)
  36. elseif not QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 2) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 3) then
  37. SetStepComplete(Spawn, LichaDancingQueen, 1)
  38. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 2) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 3) then
  39. local random_step = MakeRandomInt(1, 2)
  40. if random_step == 1 then
  41. SetStepComplete(Spawn, LichaDancingQueen, 2)
  42. elseif random_step == 2 then
  43. SetStepComplete(Spawn, LichaDancingQueen, 3)
  44. end
  45. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 2) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 3) then
  46. local random_step = MakeRandomInt(1, 2)
  47. if random_step == 1 then
  48. SetStepComplete(Spawn, LichaDancingQueen, 1)
  49. elseif random_step == 2 then
  50. SetStepComplete(Spawn, LichaDancingQueen, 3)
  51. end
  52. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 3) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 2) then
  53. local random_step = MakeRandomInt(1, 2)
  54. if random_step == 1 then
  55. SetStepComplete(Spawn, LichaDancingQueen, 2)
  56. elseif random_step == 2 then
  57. SetStepComplete(Spawn, LichaDancingQueen, 1)
  58. end
  59. end
  60. FaceTarget(NPC, Spawn)
  61. local conversation = CreateConversation()
  62. AddConversationOption(conversation, "Good to know.")
  63. StartConversation(conversation, NPC, Spawn, "Great, I haven't had a good laugh all day.")
  64. AddTimer(NPC, 600000, "reset")
  65. end
  66. function reset(NPC, Spawn)
  67. if GetTempVariable(NPC, "QUEST_HAILED") == "true" then
  68. SetTempVariable(NPC, "QUEST_HAILED", "false")
  69. end
  70. end
  71. function respawn(NPC)
  72. spawn(NPC)
  73. end