9
3

aWindstalkerCitizen2.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. local Level = GetLevel(NPC)
  11. local level1 = 16
  12. local level2 = 17
  13. local difficulty1 = 6
  14. local hp1 = 1045
  15. local power1 = 310
  16. local difficulty2 = 6
  17. local hp2 = 1180
  18. local power2 = 360
  19. if Level == level1 then
  20. SpawnSet(NPC, "difficulty", difficulty1)
  21. SpawnSet(NPC, "hp", hp1)
  22. SpawnSet(NPC, "power", power1)
  23. elseif Level == level2
  24. then
  25. SpawnSet(NPC, "difficulty", difficulty2)
  26. SpawnSet(NPC, "hp", hp2)
  27. SpawnSet(NPC, "power", power2)
  28. end
  29. SetTempVariable(NPC, "QUEST_HAILED", "false")
  30. end
  31. function hailed(NPC, Spawn)
  32. FaceTarget(NPC, Spawn)
  33. if HasQuest(Spawn, LichaDancingQueen) and GetTempVariable(NPC, "QUEST_HAILED") == "false" then
  34. local conversation = CreateConversation()
  35. AddConversationOption(conversation, "Licha asked me to tell the villagers that she is going to dance.", "Option3")
  36. AddConversationOption(conversation, "Never mind.")
  37. StartConversation(conversation, NPC, Spawn, "What can I do for you?")
  38. elseif GetTempVariable(NPC, "QUEST_HAILED") == "true" or HasCompletedQuest(Spawn, LichaDancingQueen) then
  39. local choice = MakeRandomInt(1, 2)
  40. if choice == 1 then
  41. PlayFlavor(NPC, "", "I heard you the first time.", "", 0, 0, Spawn)
  42. elseif choice == 2 then
  43. PlayFlavor(NPC, "", "I know, I know. You already told me.", "", 0, 0, Spawn)
  44. end
  45. end
  46. end
  47. function Option3(NPC, Spawn) -- we don't use easy ways to sort.
  48. SetTempVariable(NPC, "QUEST_HAILED", "true")
  49. if QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and QuestStepIsComplete(Spawn, LichaDancingQueen, 2) then
  50. SetStepComplete(Spawn, LichaDancingQueen, 3)
  51. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 2) and QuestStepIsComplete(Spawn, LichaDancingQueen, 3) then
  52. SetStepComplete(Spawn, LichaDancingQueen, 1)
  53. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 3) and QuestStepIsComplete(Spawn, LichaDancingQueen, 1) then
  54. SetStepComplete(Spawn, LichaDancingQueen, 2)
  55. elseif not QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 2) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 3) then
  56. SetStepComplete(Spawn, LichaDancingQueen, 1)
  57. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 2) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 3) then
  58. local random_step = MakeRandomInt(1, 2)
  59. if random_step == 1 then
  60. SetStepComplete(Spawn, LichaDancingQueen, 2)
  61. elseif random_step == 2 then
  62. SetStepComplete(Spawn, LichaDancingQueen, 3)
  63. end
  64. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 2) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 3) then
  65. local random_step = MakeRandomInt(1, 2)
  66. if random_step == 1 then
  67. SetStepComplete(Spawn, LichaDancingQueen, 1)
  68. elseif random_step == 2 then
  69. SetStepComplete(Spawn, LichaDancingQueen, 3)
  70. end
  71. elseif QuestStepIsComplete(Spawn, LichaDancingQueen, 3) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 1) and not QuestStepIsComplete(Spawn, LichaDancingQueen, 2) then
  72. local random_step = MakeRandomInt(1, 2)
  73. if random_step == 1 then
  74. SetStepComplete(Spawn, LichaDancingQueen, 2)
  75. elseif random_step == 2 then
  76. SetStepComplete(Spawn, LichaDancingQueen, 1)
  77. end
  78. end
  79. FaceTarget(NPC, Spawn)
  80. local conversation = CreateConversation()
  81. AddConversationOption(conversation, "Good to know.")
  82. StartConversation(conversation, NPC, Spawn, "Great, I haven't had a good laugh all day.")
  83. AddTimer(NPC, 600000, "reset")
  84. end
  85. function reset(NPC, Spawn)
  86. if GetTempVariable(NPC, "QUEST_HAILED") == "true" then
  87. SetTempVariable(NPC, "QUEST_HAILED", "false")
  88. end
  89. end
  90. function respawn(NPC)
  91. spawn(NPC)
  92. end