From fd3c16dec8a1f13478c0f6a16ada270b0c308ee6 Mon Sep 17 00:00:00 2001 From: scorchedxi <32467511+scorchedxi@users.noreply.github.com> Date: Sun, 3 May 2020 22:55:04 -0700 Subject: [PATCH 1/7] Added intro to teamwork questline Added three quests, intro to teamwork, intermediate teamwork, and advanced teamwork. --- .../zones/West_Ronfaure/npcs/Vilatroire.lua | 211 +++++++++++++++++- 1 file changed, 202 insertions(+), 9 deletions(-) diff --git a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua index bf0387e17df..da5a93ddc0f 100644 --- a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua +++ b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua @@ -5,29 +5,222 @@ -- "Advanced Teamwork" -- !pos -260.361 -70.999 423.420 100 ----------------------------------- -require("scripts/globals/quests") +local ID = require("scripts/zones/West_Ronfaure/IDs"); +require("scripts/globals/quests"); +require("scripts/globals/titles"); +require("scripts/globals/status"); ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) + --player:startEvent(129) -- starts the ready check for all three quests + --player:startEvent(130) -- post third quest dialog --player:startEvent(131) -- Same job + --player:startEvent(132) -- You don't have the requirements to start the second quest --player:startEvent(133) -- Same race - local intermedTmwrk = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK) - local sFame = player:getFameLevel(SANDORIA) + --player:startEvent(134) -- You don't have the requirements to start the first quest + --player:startEvent(135) -- Starts first quest - 6 members same alliance + --player:startEvent(136) -- Default - before quests - if intermedTmwrk == QUEST_AVAILABLE and sFame >= 2 then - player:startEvent(135) -- Starts first quest - 6 members same alliance - elseif intermedTmwrk == QUEST_ACCEPTED then - player:startEvent(134) -- You don't have the requirements to finish + -- get players fame for this quest region + local sandyFame = player:getFameLevel(SANDORIA); + + -- get quest statuses + local questIntroToTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); + local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); + local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK); + + if (questIntroToTeamwork == QUEST_AVAILABLE and sandyFame >= 2) then + -- start the event that starts the quest + player:startEvent(135); + elseif (questIntroToTeamwork == QUEST_AVAILABLE and sandyFame < 2) then + -- don't meet fame requirements + player:startEvent(134); + elseif (questIntroToTeamwork == QUEST_ACCEPTED) then + -- start the event that asks them if they are ready to check + player:startEvent(129, 0, 1); + elseif (questIntroToTeamwork == QUEST_COMPLETED and questIntermediateTeamwork == QUEST_AVAILABLE and sandyFame >= 3 and player:getMainLvl() >= 10) then + -- they've completed the first quest, the second quest is available, and they have thee required fame, + -- start event that starts the next quest + player:startEvent(133); + elseif (questIntroToTeamwork == QUEST_COMPLETED and questIntermediateTeamwork == QUEST_AVAILABLE and sandyFame < 3 and player:getMainLvl() < 10) then + -- don't meet fame requirements + player:startEvent(132); + elseif (questIntermediateTeamwork == QUEST_ACCEPTED) then + -- start the event that asks them if they are ready to check + player:startEvent(129, 0, 2); + elseif (questIntermediateTeamwork == QUEST_COMPLETED and questAdvancedTeamwork == QUEST_AVAILABLE and sandyFame >= 4 and player:getMainLvl() >= 10) then + -- they've completed the second quest, the third quest is available, and they have thee required fame, + -- start event that starts the next quest + player:startEvent(131); + elseif (questIntermediateTeamwork == QUEST_COMPLETED and questAdvancedTeamwork == QUEST_AVAILABLE and sandyFame < 4 and player:getMainLvl() < 10) then + -- don't meet fame requirements + player:startEvent(130); + elseif (questAdvancedTeamwork == QUEST_ACCEPTED) then + -- start the event that asks them if they are ready to check + player:startEvent(129, 0, 3); + elseif (questAdvancedTeamwork == QUEST_COMPLETED) then + player:startEvent(130); else - player:startEvent(136) -- Default - before quests + player:startEvent(136); end end function onEventUpdate(player, csid, option) + -- csid 129 happens for both quests + if (csid == 129) then + local questIntroToTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); + local questIntermediateTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); + local questAdvancedTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK); + + -- newer versions of these quests only require a party of 2. + -- older versions require all 6 + local partySizeRequirement = 2; + + -- get party + local party = player:getParty(); + + -- since we loop through the party to check zone and distance, may as well check these in the same loop + local partySameNationCount = 0; + local partySameRaceCount = 0; + local partySameJobCount = 0; + + -- make sure the party is at least the right partySizeRequirement + if (#party >= partySizeRequirement) then + + -- make sure everyone in the party is in the same zone and nearby + for key, member in pairs(party) do + if (member:getZoneID() ~= player:getZoneID() or member:checkDistance(player) > 50) then + -- member not in zone or range + player:updateEvent(1); + + return; + else + -- check nation for first quest + if (member:getNation() == player:getNation()) then + partySameNationCount = partySameNationCount + 1; + end + + -- check race for second + if (player:getRace() == tpz.race.HUME_M and member:getRace() == tpz.race.HUME_M or member:getRace() == tpz.race.HUME_F) then + partySameRaceCount = partySameRaceCount + 1; + elseif (player:getRace() == tpz.race.HUME_F and member:getRace() == tpz.race.HUME_M or member:getRace() == tpz.race.HUME_F) then + partySameRaceCount = partySameRaceCount + 1; + elseif (player:getRace() == tpz.race.ELVAAN_M and member:getRace() == tpz.race.ELVAAN_M or member:getRace() == tpz.race.ELVAAN_F) then + partySameRaceCount = partySameRaceCount + 1; + elseif (player:getRace() == tpz.race.ELVAAN_F and member:getRace() == tpz.race.ELVAAN_M or member:getRace() == tpz.race.ELVAAN_F) then + partySameRaceCount = partySameRaceCount + 1; + elseif (player:getRace() == tpz.race.TARU_M and member:getRace() == tpz.race.TARU_M or member:getRace() == tpz.race.TARU_F) then + partySameRaceCount = partySameRaceCount + 1; + elseif (player:getRace() == tpz.race.TARU_F and member:getRace() == tpz.race.TARU_M or member:getRace() == tpz.race.TARU_F) then + partySameRaceCount = partySameRaceCount + 1; + elseif (player:getRace() == tpz.race.GALKA and member:getRace() == tpz.race.GALKA) then + partySameRaceCount = partySameRaceCount + 1; + elseif (player:getRace() == tpz.race.MITHRA and member:getRace() == tpz.race.MITHRA) then + partySameRaceCount = partySameRaceCount + 1; + end + + -- job for third + if (member:getMainJob() == player:getMainJob()) then + partySameJobCount = partySameJobCount + 1; + end + end + end + + if (questIntroToTeamwork == QUEST_ACCEPTED) then + -- https://www.bg-wiki.com/bg/Introduction_to_Teamwork + if (partySameNationCount == partySizeRequirement) then + -- nation requirements met + player:setCharVar("introToTmwrk_pass", 1); + player:updateEvent(15, 1); + else + -- not met + player:updateEvent(3); + end + elseif (questIntermediateTeamwork == QUEST_ACCEPTED) then + -- https://www.bg-wiki.com/bg/Intermediate_Teamwork + if (partySameRaceCount == partySizeRequirement) then + -- race requirements met + player:setCharVar("intermedTmwrk_pass", 1); + player:updateEvent(15, 2); + else + -- not met + player:updateEvent(4); + end + elseif (questAdvancedTeamwork == QUEST_ACCEPTED) then + -- https://www.bg-wiki.com/bg/Advanced_Teamwork + if (partySameJobCount == partySameJobCount) then + -- race requirements met + player:setCharVar("advTmwrk_pass", 1); + player:updateEvent(15, 3); + else + -- not met + -- UPDATE ME -- + player:updateEvent(5); + end + end + else + -- need more party members + player:updateEvent(1); + end + end end function onEventFinish(player, csid, option) -end + -- csid 129 is the event for when they have selected ready/not ready + + if (csid == 129 and option == 0) then + local questIntroToTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); + local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); + local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK); + + if (questIntroToTeamwork == QUEST_ACCEPTED and player:getCharVar("introToTmwrk_pass") == 1) then + -- check their inventory + if (player:getFreeSlotsCount() == 0) then + player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, 13442); + else + player:completeQuest(SANDORIA,tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); + player:addFame(SANDORIA, 80); -- unsure of actual fame value + player:addTitle(tpz.title.THIRDRATE_ORGANIZER); + player:addItem(13442); -- shell ring + player:messageSpecial(ID.text.ITEM_OBTAINED, 13442); -- shell ring + player:setCharVar("introToTmwrk_pass", 0) -- Delete charVar from memory + end + elseif (questIntermediateTeamwork == QUEST_ACCEPTED and player:getCharVar("intermedTmwrk_pass") == 1) then + -- check their inventory + if (player:getFreeSlotsCount() == 0) then + player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, 4994); + else + player:completeQuest(SANDORIA,tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); + player:addFame(SANDORIA, 80);-- unsure of actual fame value + player:addTitle(tpz.title.SECONDRATE_ORGANIZER); + player:addItem(4994); -- mage's ballad + player:messageSpecial(ID.text.ITEM_OBTAINED, 4994); -- mage's ballad + player:setCharVar("intermedTmwrk_pass", 0) -- Delete charVar from memory + end + elseif (questAdvancedTeamwork == QUEST_ACCEPTED and player:getCharVar("advTmwrk_pass") == 1) then + -- check their inventory + if (player:getFreeSlotsCount() == 0) then + player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, 13459); + else + player:completeQuest(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK); + player:addFame(SANDORIA, 80);-- unsure of actual fame value + player:addTitle(tpz.title.FIRSTRATE_ORGANIZER); + player:addItem(13459); -- horn ring + player:messageSpecial(ID.text.ITEM_OBTAINED, 13459); -- horn + player:setCharVar("advTmwrk_pass", 0) -- Delete charVar from memory + end + end + elseif (csid == 131 and option == 1) then + -- 131 is the third and last quest + player:addQuest(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK); + elseif (csid == 133 and option == 1) then + -- 133 is the second quest + player:addQuest(SANDORIA,tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); + elseif (csid == 135 and option == 1) then + -- 135 is the first quest + player:addQuest(SANDORIA,tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); + end +end \ No newline at end of file From 6f01614156e39efc8db54211c5e7ef9b1a760e44 Mon Sep 17 00:00:00 2001 From: scorchedxi <32467511+scorchedxi@users.noreply.github.com> Date: Mon, 4 May 2020 16:36:17 -0700 Subject: [PATCH 2/7] Intro To Teamwork added fixed lua style and cleaned up code --- .../zones/West_Ronfaure/npcs/Vilatroire.lua | 223 ++++++++---------- 1 file changed, 102 insertions(+), 121 deletions(-) diff --git a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua index da5a93ddc0f..a826187d7fb 100644 --- a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua +++ b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua @@ -5,10 +5,11 @@ -- "Advanced Teamwork" -- !pos -260.361 -70.999 423.420 100 ----------------------------------- -local ID = require("scripts/zones/West_Ronfaure/IDs"); -require("scripts/globals/quests"); -require("scripts/globals/titles"); -require("scripts/globals/status"); +local ID = require("scripts/zones/West_Ronfaure/IDs") +require("scripts/globals/quests") +require("scripts/globals/titles") +require("scripts/globals/status") +require("scripts/globals/npc_util") ----------------------------------- function onTrade(player, npc, trade) @@ -25,145 +26,137 @@ function onTrigger(player, npc) --player:startEvent(136) -- Default - before quests -- get players fame for this quest region - local sandyFame = player:getFameLevel(SANDORIA); + local sandyFame = player:getFameLevel(SANDORIA) -- get quest statuses - local questIntroToTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); - local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); - local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK); + local questIntroToTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK) + local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK) + local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK) - if (questIntroToTeamwork == QUEST_AVAILABLE and sandyFame >= 2) then + if questIntroToTeamwork == QUEST_AVAILABLE and sandyFame >= 2 then -- start the event that starts the quest - player:startEvent(135); - elseif (questIntroToTeamwork == QUEST_AVAILABLE and sandyFame < 2) then + player:startEvent(135) + elseif questIntroToTeamwork == QUEST_AVAILABLE and sandyFame < 2 then -- don't meet fame requirements - player:startEvent(134); - elseif (questIntroToTeamwork == QUEST_ACCEPTED) then + player:startEvent(134) + elseif questIntroToTeamwork == QUEST_ACCEPTED then -- start the event that asks them if they are ready to check - player:startEvent(129, 0, 1); - elseif (questIntroToTeamwork == QUEST_COMPLETED and questIntermediateTeamwork == QUEST_AVAILABLE and sandyFame >= 3 and player:getMainLvl() >= 10) then + player:startEvent(129, 0, 1) + elseif questIntroToTeamwork == QUEST_COMPLETED and questIntermediateTeamwork == QUEST_AVAILABLE and sandyFame >= 3 and player:getMainLvl() >= 10 then -- they've completed the first quest, the second quest is available, and they have thee required fame, -- start event that starts the next quest - player:startEvent(133); - elseif (questIntroToTeamwork == QUEST_COMPLETED and questIntermediateTeamwork == QUEST_AVAILABLE and sandyFame < 3 and player:getMainLvl() < 10) then + player:startEvent(133) + elseif questIntroToTeamwork == QUEST_COMPLETED and questIntermediateTeamwork == QUEST_AVAILABLE and sandyFame < 3 and player:getMainLvl() < 10 then -- don't meet fame requirements - player:startEvent(132); - elseif (questIntermediateTeamwork == QUEST_ACCEPTED) then + player:startEvent(132) + elseif questIntermediateTeamwork == QUEST_ACCEPTED then -- start the event that asks them if they are ready to check - player:startEvent(129, 0, 2); - elseif (questIntermediateTeamwork == QUEST_COMPLETED and questAdvancedTeamwork == QUEST_AVAILABLE and sandyFame >= 4 and player:getMainLvl() >= 10) then + player:startEvent(129, 0, 2) + elseif questIntermediateTeamwork == QUEST_COMPLETED and questAdvancedTeamwork == QUEST_AVAILABLE and sandyFame >= 4 and player:getMainLvl() >= 10 then -- they've completed the second quest, the third quest is available, and they have thee required fame, -- start event that starts the next quest - player:startEvent(131); - elseif (questIntermediateTeamwork == QUEST_COMPLETED and questAdvancedTeamwork == QUEST_AVAILABLE and sandyFame < 4 and player:getMainLvl() < 10) then + player:startEvent(131) + elseif questIntermediateTeamwork == QUEST_COMPLETED and questAdvancedTeamwork == QUEST_AVAILABLE and sandyFame < 4 and player:getMainLvl() < 10 then -- don't meet fame requirements - player:startEvent(130); - elseif (questAdvancedTeamwork == QUEST_ACCEPTED) then + player:startEvent(130) + elseif questAdvancedTeamwork == QUEST_ACCEPTED then -- start the event that asks them if they are ready to check - player:startEvent(129, 0, 3); - elseif (questAdvancedTeamwork == QUEST_COMPLETED) then - player:startEvent(130); + player:startEvent(129, 0, 3) + elseif questAdvancedTeamwork == QUEST_COMPLETED then + player:startEvent(130) else - player:startEvent(136); + player:startEvent(136) end end function onEventUpdate(player, csid, option) -- csid 129 happens for both quests - if (csid == 129) then - local questIntroToTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); - local questIntermediateTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); - local questAdvancedTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK); + if csid == 129 then + local questIntroToTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK) + local questIntermediateTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK) + local questAdvancedTeamwork = player:getQuestStatus(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK) -- newer versions of these quests only require a party of 2. -- older versions require all 6 - local partySizeRequirement = 2; + local partySizeRequirement = 1 -- get party - local party = player:getParty(); + local party = player:getParty() -- since we loop through the party to check zone and distance, may as well check these in the same loop - local partySameNationCount = 0; - local partySameRaceCount = 0; - local partySameJobCount = 0; + local partySameNationCount = 0 + local partySameRaceCount = 0 + local partySameJobCount = 0 -- make sure the party is at least the right partySizeRequirement - if (#party >= partySizeRequirement) then + if #party >= partySizeRequirement then -- make sure everyone in the party is in the same zone and nearby for key, member in pairs(party) do - if (member:getZoneID() ~= player:getZoneID() or member:checkDistance(player) > 50) then + if member:getZoneID() ~= player:getZoneID() or member:checkDistance(player) > 15 then -- member not in zone or range - player:updateEvent(1); - - return; + player:updateEvent(1) + return else -- check nation for first quest - if (member:getNation() == player:getNation()) then - partySameNationCount = partySameNationCount + 1; + if member:getNation() == player:getNation() then + partySameNationCount = partySameNationCount + 1 end -- check race for second - if (player:getRace() == tpz.race.HUME_M and member:getRace() == tpz.race.HUME_M or member:getRace() == tpz.race.HUME_F) then - partySameRaceCount = partySameRaceCount + 1; - elseif (player:getRace() == tpz.race.HUME_F and member:getRace() == tpz.race.HUME_M or member:getRace() == tpz.race.HUME_F) then - partySameRaceCount = partySameRaceCount + 1; - elseif (player:getRace() == tpz.race.ELVAAN_M and member:getRace() == tpz.race.ELVAAN_M or member:getRace() == tpz.race.ELVAAN_F) then - partySameRaceCount = partySameRaceCount + 1; - elseif (player:getRace() == tpz.race.ELVAAN_F and member:getRace() == tpz.race.ELVAAN_M or member:getRace() == tpz.race.ELVAAN_F) then - partySameRaceCount = partySameRaceCount + 1; - elseif (player:getRace() == tpz.race.TARU_M and member:getRace() == tpz.race.TARU_M or member:getRace() == tpz.race.TARU_F) then - partySameRaceCount = partySameRaceCount + 1; - elseif (player:getRace() == tpz.race.TARU_F and member:getRace() == tpz.race.TARU_M or member:getRace() == tpz.race.TARU_F) then - partySameRaceCount = partySameRaceCount + 1; - elseif (player:getRace() == tpz.race.GALKA and member:getRace() == tpz.race.GALKA) then - partySameRaceCount = partySameRaceCount + 1; - elseif (player:getRace() == tpz.race.MITHRA and member:getRace() == tpz.race.MITHRA) then - partySameRaceCount = partySameRaceCount + 1; + if (player:getRace() == tpz.race.HUME_M or player:getRace() == tpz.race.HUME_F) and (member:getRace() == tpz.race.HUME_M or member:getRace() == tpz.race.HUME_F) then + partySameRaceCount = partySameRaceCount + 1 + elseif (player:getRace() == tpz.race.ELVAAN_M or player:getRace() == tpz.race.ELVAAN_F) and (member:getRace() == tpz.race.ELVAAN_M or member:getRace() == tpz.race.ELVAAN_F) then + partySameRaceCount = partySameRaceCount + 1 + elseif (player:getRace() == tpz.race.TARU_M or player:getRace() == tpz.race.TARU_F) and (member:getRace() == tpz.race.TARU_M or member:getRace() == tpz.race.TARU_F) then + partySameRaceCount = partySameRaceCount + 1 + elseif player:getRace() == tpz.race.GALKA and member:getRace() == tpz.race.GALKA then + partySameRaceCount = partySameRaceCount + 1 + elseif player:getRace() == tpz.race.MITHRA and member:getRace() == tpz.race.MITHRA then + partySameRaceCount = partySameRaceCount + 1 end -- job for third - if (member:getMainJob() == player:getMainJob()) then - partySameJobCount = partySameJobCount + 1; + if member:getMainJob() == player:getMainJob() then + partySameJobCount = partySameJobCount + 1 end end end - if (questIntroToTeamwork == QUEST_ACCEPTED) then + if questIntroToTeamwork == QUEST_ACCEPTED then -- https://www.bg-wiki.com/bg/Introduction_to_Teamwork if (partySameNationCount == partySizeRequirement) then -- nation requirements met - player:setCharVar("introToTmwrk_pass", 1); - player:updateEvent(15, 1); + player:setCharVar("introToTmwrk_pass", 1) + player:updateEvent(15, 1) else - -- not met - player:updateEvent(3); + -- not the same nation + player:updateEvent(3) end - elseif (questIntermediateTeamwork == QUEST_ACCEPTED) then + elseif questIntermediateTeamwork == QUEST_ACCEPTED then -- https://www.bg-wiki.com/bg/Intermediate_Teamwork if (partySameRaceCount == partySizeRequirement) then -- race requirements met - player:setCharVar("intermedTmwrk_pass", 1); - player:updateEvent(15, 2); + player:setCharVar("intermedTmwrk_pass", 1) + player:updateEvent(15, 2) else - -- not met - player:updateEvent(4); + -- not the same race + player:updateEvent(4) end - elseif (questAdvancedTeamwork == QUEST_ACCEPTED) then + elseif questAdvancedTeamwork == QUEST_ACCEPTED then -- https://www.bg-wiki.com/bg/Advanced_Teamwork - if (partySameJobCount == partySameJobCount) then + if partySameJobCount == partySameJobCount then -- race requirements met - player:setCharVar("advTmwrk_pass", 1); - player:updateEvent(15, 3); + player:setCharVar("advTmwrk_pass", 1) + player:updateEvent(15, 3) else - -- not met - -- UPDATE ME -- - player:updateEvent(5); + -- not the same job + player:updateEvent(5) end end else -- need more party members - player:updateEvent(1); + player:updateEvent(1) end end end @@ -171,56 +164,44 @@ end function onEventFinish(player, csid, option) -- csid 129 is the event for when they have selected ready/not ready - if (csid == 129 and option == 0) then + if csid == 129 and option == 0 then local questIntroToTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK); - if (questIntroToTeamwork == QUEST_ACCEPTED and player:getCharVar("introToTmwrk_pass") == 1) then + if questIntroToTeamwork == QUEST_ACCEPTED and player:getCharVar("introToTmwrk_pass") == 1 then -- check their inventory - if (player:getFreeSlotsCount() == 0) then - player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, 13442); - else - player:completeQuest(SANDORIA,tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); - player:addFame(SANDORIA, 80); -- unsure of actual fame value - player:addTitle(tpz.title.THIRDRATE_ORGANIZER); - player:addItem(13442); -- shell ring - player:messageSpecial(ID.text.ITEM_OBTAINED, 13442); -- shell ring - player:setCharVar("introToTmwrk_pass", 0) -- Delete charVar from memory - end - elseif (questIntermediateTeamwork == QUEST_ACCEPTED and player:getCharVar("intermedTmwrk_pass") == 1) then + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK, { + item = 13442, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.THIRDRATE_ORGANIZER, + var = "introToTmwrk_pass" + }) + elseif questIntermediateTeamwork == QUEST_ACCEPTED and player:getCharVar("intermedTmwrk_pass") == 1 then -- check their inventory - if (player:getFreeSlotsCount() == 0) then - player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, 4994); - else - player:completeQuest(SANDORIA,tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); - player:addFame(SANDORIA, 80);-- unsure of actual fame value - player:addTitle(tpz.title.SECONDRATE_ORGANIZER); - player:addItem(4994); -- mage's ballad - player:messageSpecial(ID.text.ITEM_OBTAINED, 4994); -- mage's ballad - player:setCharVar("intermedTmwrk_pass", 0) -- Delete charVar from memory - end - elseif (questAdvancedTeamwork == QUEST_ACCEPTED and player:getCharVar("advTmwrk_pass") == 1) then + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK, { + item = 4994, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.SECONDRATE_ORGANIZER, + var = "intermedTmwrk_pass" + }) + elseif questAdvancedTeamwork == QUEST_ACCEPTED and player:getCharVar("advTmwrk_pass") == 1 then -- check their inventory - if (player:getFreeSlotsCount() == 0) then - player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, 13459); - else - player:completeQuest(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK); - player:addFame(SANDORIA, 80);-- unsure of actual fame value - player:addTitle(tpz.title.FIRSTRATE_ORGANIZER); - player:addItem(13459); -- horn ring - player:messageSpecial(ID.text.ITEM_OBTAINED, 13459); -- horn - player:setCharVar("advTmwrk_pass", 0) -- Delete charVar from memory - end + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK, { + item = 13459, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.FIRSTRATE_ORGANIZER, + var = "advTmwrk_pass" + }) end - elseif (csid == 131 and option == 1) then + elseif csid == 131 and option == 1 then -- 131 is the third and last quest - player:addQuest(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK); - elseif (csid == 133 and option == 1) then + player:addQuest(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK) + elseif csid == 133 and option == 1 then -- 133 is the second quest - player:addQuest(SANDORIA,tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); - elseif (csid == 135 and option == 1) then + player:addQuest(SANDORIA,tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK) + elseif csid == 135 and option == 1 then -- 135 is the first quest - player:addQuest(SANDORIA,tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); + player:addQuest(SANDORIA,tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK) end end \ No newline at end of file From ad80e5bb5c75e9afac2ac97e4a0b54a5a0269ecd Mon Sep 17 00:00:00 2001 From: scorchedxi <32467511+scorchedxi@users.noreply.github.com> Date: Mon, 4 May 2020 16:42:43 -0700 Subject: [PATCH 3/7] Update Vilatroire.lua changed charVar to localVar --- scripts/zones/West_Ronfaure/npcs/Vilatroire.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua index a826187d7fb..c6b302dd1c3 100644 --- a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua +++ b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua @@ -127,7 +127,7 @@ function onEventUpdate(player, csid, option) -- https://www.bg-wiki.com/bg/Introduction_to_Teamwork if (partySameNationCount == partySizeRequirement) then -- nation requirements met - player:setCharVar("introToTmwrk_pass", 1) + player:setLocalVar("introToTmwrk_pass", 1) player:updateEvent(15, 1) else -- not the same nation @@ -137,7 +137,7 @@ function onEventUpdate(player, csid, option) -- https://www.bg-wiki.com/bg/Intermediate_Teamwork if (partySameRaceCount == partySizeRequirement) then -- race requirements met - player:setCharVar("intermedTmwrk_pass", 1) + player:setLocalVar("intermedTmwrk_pass", 1) player:updateEvent(15, 2) else -- not the same race @@ -147,7 +147,7 @@ function onEventUpdate(player, csid, option) -- https://www.bg-wiki.com/bg/Advanced_Teamwork if partySameJobCount == partySameJobCount then -- race requirements met - player:setCharVar("advTmwrk_pass", 1) + player:setLocalVar("advTmwrk_pass", 1) player:updateEvent(15, 3) else -- not the same job From 10272b554ca04c935563ee5af29c41ccb5806fa3 Mon Sep 17 00:00:00 2001 From: scorchedxi <32467511+scorchedxi@users.noreply.github.com> Date: Mon, 4 May 2020 16:46:59 -0700 Subject: [PATCH 4/7] Update Vilatroire.lua changed getCharVar to getLocalVar --- scripts/zones/West_Ronfaure/npcs/Vilatroire.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua index c6b302dd1c3..a0860191865 100644 --- a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua +++ b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua @@ -169,7 +169,7 @@ function onEventFinish(player, csid, option) local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK); - if questIntroToTeamwork == QUEST_ACCEPTED and player:getCharVar("introToTmwrk_pass") == 1 then + if questIntroToTeamwork == QUEST_ACCEPTED and player:getLocalVar("introToTmwrk_pass") == 1 then -- check their inventory npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK, { item = 13442, @@ -177,7 +177,7 @@ function onEventFinish(player, csid, option) title = tpz.title.THIRDRATE_ORGANIZER, var = "introToTmwrk_pass" }) - elseif questIntermediateTeamwork == QUEST_ACCEPTED and player:getCharVar("intermedTmwrk_pass") == 1 then + elseif questIntermediateTeamwork == QUEST_ACCEPTED and player:getLocalVar("intermedTmwrk_pass") == 1 then -- check their inventory npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK, { item = 4994, @@ -185,7 +185,7 @@ function onEventFinish(player, csid, option) title = tpz.title.SECONDRATE_ORGANIZER, var = "intermedTmwrk_pass" }) - elseif questAdvancedTeamwork == QUEST_ACCEPTED and player:getCharVar("advTmwrk_pass") == 1 then + elseif questAdvancedTeamwork == QUEST_ACCEPTED and player:getLocalVar("advTmwrk_pass") == 1 then -- check their inventory npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK, { item = 13459, From 1a9d958177149a29e98be664056c1969b3274e51 Mon Sep 17 00:00:00 2001 From: scorchedxi <32467511+scorchedxi@users.noreply.github.com> Date: Mon, 4 May 2020 16:48:04 -0700 Subject: [PATCH 5/7] Update Vilatroire.lua fixed party member requirements --- scripts/zones/West_Ronfaure/npcs/Vilatroire.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua index a0860191865..8200600bcdc 100644 --- a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua +++ b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua @@ -78,7 +78,7 @@ function onEventUpdate(player, csid, option) -- newer versions of these quests only require a party of 2. -- older versions require all 6 - local partySizeRequirement = 1 + local partySizeRequirement = 2 -- get party local party = player:getParty() From 2fd226fe112f2ed729c0f433f66b505e290f9f83 Mon Sep 17 00:00:00 2001 From: scorchedxi <32467511+scorchedxi@users.noreply.github.com> Date: Mon, 4 May 2020 19:57:38 -0700 Subject: [PATCH 6/7] Update Vilatroire.lua fixed party member requirements --- .../zones/West_Ronfaure/npcs/Vilatroire.lua | 51 +++++++++---------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua index a0860191865..3d309c4f69a 100644 --- a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua +++ b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua @@ -78,7 +78,7 @@ function onEventUpdate(player, csid, option) -- newer versions of these quests only require a party of 2. -- older versions require all 6 - local partySizeRequirement = 1 + local partySizeRequirement = 2 -- get party local party = player:getParty() @@ -125,7 +125,7 @@ function onEventUpdate(player, csid, option) if questIntroToTeamwork == QUEST_ACCEPTED then -- https://www.bg-wiki.com/bg/Introduction_to_Teamwork - if (partySameNationCount == partySizeRequirement) then + if partySameNationCount == partySizeRequirement then -- nation requirements met player:setLocalVar("introToTmwrk_pass", 1) player:updateEvent(15, 1) @@ -135,7 +135,7 @@ function onEventUpdate(player, csid, option) end elseif questIntermediateTeamwork == QUEST_ACCEPTED then -- https://www.bg-wiki.com/bg/Intermediate_Teamwork - if (partySameRaceCount == partySizeRequirement) then + if partySameRaceCount == partySizeRequirement then -- race requirements met player:setLocalVar("intermedTmwrk_pass", 1) player:updateEvent(15, 2) @@ -169,30 +169,27 @@ function onEventFinish(player, csid, option) local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK); - if questIntroToTeamwork == QUEST_ACCEPTED and player:getLocalVar("introToTmwrk_pass") == 1 then - -- check their inventory - npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK, { - item = 13442, - fame = 80, -- fame defaults to 30 if not set - title = tpz.title.THIRDRATE_ORGANIZER, - var = "introToTmwrk_pass" - }) - elseif questIntermediateTeamwork == QUEST_ACCEPTED and player:getLocalVar("intermedTmwrk_pass") == 1 then - -- check their inventory - npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK, { - item = 4994, - fame = 80, -- fame defaults to 30 if not set - title = tpz.title.SECONDRATE_ORGANIZER, - var = "intermedTmwrk_pass" - }) - elseif questAdvancedTeamwork == QUEST_ACCEPTED and player:getLocalVar("advTmwrk_pass") == 1 then - -- check their inventory - npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK, { - item = 13459, - fame = 80, -- fame defaults to 30 if not set - title = tpz.title.FIRSTRATE_ORGANIZER, - var = "advTmwrk_pass" - }) + if questIntroToTeamwork == QUEST_ACCEPTED and player:getLocalVar("introToTmwrk_pass") == 1 then + -- check their inventory + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK, { + item = 13442, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.THIRDRATE_ORGANIZER, + }) + elseif questIntermediateTeamwork == QUEST_ACCEPTED and player:getLocalVar("intermedTmwrk_pass") == 1 then + -- check their inventory + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK, { + item = 4994, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.SECONDRATE_ORGANIZER, + }) + elseif questAdvancedTeamwork == QUEST_ACCEPTED and player:getLocalVar("advTmwrk_pass") == 1 then + -- check their inventory + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK, { + item = 13459, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.FIRSTRATE_ORGANIZER, + }) end elseif csid == 131 and option == 1 then -- 131 is the third and last quest From f6450030fc16fb9c5e915b69ee8d975c90ef178c Mon Sep 17 00:00:00 2001 From: scorchedxi <32467511+scorchedxi@users.noreply.github.com> Date: Sun, 10 May 2020 01:03:18 -0700 Subject: [PATCH 7/7] Update Vilatroire.lua Fixed spacing and comments --- .../zones/West_Ronfaure/npcs/Vilatroire.lua | 142 +++++++----------- 1 file changed, 51 insertions(+), 91 deletions(-) diff --git a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua index 3d309c4f69a..c09cba488da 100644 --- a/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua +++ b/scripts/zones/West_Ronfaure/npcs/Vilatroire.lua @@ -1,6 +1,6 @@ ----------------------------------- -- Area: West Ronfaure --- NPC: Vilatroire +-- NPC: Vilatroire -- Involved in Quests: "Introduction To Teamwork", "Intermediate Teamwork", -- "Advanced Teamwork" -- !pos -260.361 -70.999 423.420 100 @@ -16,56 +16,34 @@ function onTrade(player, npc, trade) end function onTrigger(player, npc) - --player:startEvent(129) -- starts the ready check for all three quests - --player:startEvent(130) -- post third quest dialog - --player:startEvent(131) -- Same job - --player:startEvent(132) -- You don't have the requirements to start the second quest - --player:startEvent(133) -- Same race - --player:startEvent(134) -- You don't have the requirements to start the first quest - --player:startEvent(135) -- Starts first quest - 6 members same alliance - --player:startEvent(136) -- Default - before quests - - -- get players fame for this quest region local sandyFame = player:getFameLevel(SANDORIA) - -- get quest statuses local questIntroToTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK) local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK) local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK) if questIntroToTeamwork == QUEST_AVAILABLE and sandyFame >= 2 then - -- start the event that starts the quest - player:startEvent(135) + player:startEvent(135) -- Starts first quest - 6 members same alliance elseif questIntroToTeamwork == QUEST_AVAILABLE and sandyFame < 2 then - -- don't meet fame requirements - player:startEvent(134) + player:startEvent(134) -- You don't have the requirements to start the first quest elseif questIntroToTeamwork == QUEST_ACCEPTED then - -- start the event that asks them if they are ready to check - player:startEvent(129, 0, 1) + player:startEvent(129, 0, 1) -- starts the ready check for all three quests elseif questIntroToTeamwork == QUEST_COMPLETED and questIntermediateTeamwork == QUEST_AVAILABLE and sandyFame >= 3 and player:getMainLvl() >= 10 then - -- they've completed the first quest, the second quest is available, and they have thee required fame, - -- start event that starts the next quest - player:startEvent(133) + player:startEvent(133) -- Same race elseif questIntroToTeamwork == QUEST_COMPLETED and questIntermediateTeamwork == QUEST_AVAILABLE and sandyFame < 3 and player:getMainLvl() < 10 then - -- don't meet fame requirements - player:startEvent(132) + player:startEvent(132) -- You don't have the requirements to start the second quest elseif questIntermediateTeamwork == QUEST_ACCEPTED then - -- start the event that asks them if they are ready to check - player:startEvent(129, 0, 2) + player:startEvent(129, 0, 2) -- starts the ready check for all three quests elseif questIntermediateTeamwork == QUEST_COMPLETED and questAdvancedTeamwork == QUEST_AVAILABLE and sandyFame >= 4 and player:getMainLvl() >= 10 then - -- they've completed the second quest, the third quest is available, and they have thee required fame, - -- start event that starts the next quest - player:startEvent(131) + player:startEvent(131) -- Same job elseif questIntermediateTeamwork == QUEST_COMPLETED and questAdvancedTeamwork == QUEST_AVAILABLE and sandyFame < 4 and player:getMainLvl() < 10 then - -- don't meet fame requirements - player:startEvent(130) + player:startEvent(130) -- post second and third quest dialog elseif questAdvancedTeamwork == QUEST_ACCEPTED then - -- start the event that asks them if they are ready to check - player:startEvent(129, 0, 3) + player:startEvent(129, 0, 3) -- starts the ready check for all three quests elseif questAdvancedTeamwork == QUEST_COMPLETED then - player:startEvent(130) + player:startEvent(130) -- post second and third quest dialog else - player:startEvent(136) + player:startEvent(136) --player:startEvent(136) -- Default - before quests end end @@ -80,43 +58,38 @@ function onEventUpdate(player, csid, option) -- older versions require all 6 local partySizeRequirement = 2 - -- get party local party = player:getParty() + local pRace = player:getRace() - -- since we loop through the party to check zone and distance, may as well check these in the same loop local partySameNationCount = 0 local partySameRaceCount = 0 local partySameJobCount = 0 - -- make sure the party is at least the right partySizeRequirement if #party >= partySizeRequirement then - -- make sure everyone in the party is in the same zone and nearby for key, member in pairs(party) do + local mRace = member:getRace() + if member:getZoneID() ~= player:getZoneID() or member:checkDistance(player) > 15 then - -- member not in zone or range - player:updateEvent(1) + player:updateEvent(1) -- member not in zone or range return else - -- check nation for first quest if member:getNation() == player:getNation() then partySameNationCount = partySameNationCount + 1 end - -- check race for second - if (player:getRace() == tpz.race.HUME_M or player:getRace() == tpz.race.HUME_F) and (member:getRace() == tpz.race.HUME_M or member:getRace() == tpz.race.HUME_F) then + if (pRace == tpz.race.HUME_M or pRace == tpz.race.HUME_F) and (mRace == tpz.race.HUME_M or mRace == tpz.race.HUME_F) then partySameRaceCount = partySameRaceCount + 1 - elseif (player:getRace() == tpz.race.ELVAAN_M or player:getRace() == tpz.race.ELVAAN_F) and (member:getRace() == tpz.race.ELVAAN_M or member:getRace() == tpz.race.ELVAAN_F) then + elseif (pRace == tpz.race.ELVAAN_M or pRace == tpz.race.ELVAAN_F) and (mRace == tpz.race.ELVAAN_M or mRace == tpz.race.ELVAAN_F) then partySameRaceCount = partySameRaceCount + 1 - elseif (player:getRace() == tpz.race.TARU_M or player:getRace() == tpz.race.TARU_F) and (member:getRace() == tpz.race.TARU_M or member:getRace() == tpz.race.TARU_F) then + elseif (pRace == tpz.race.TARU_M or pRace == tpz.race.TARU_F) and (mRace == tpz.race.TARU_M or mRace == tpz.race.TARU_F) then partySameRaceCount = partySameRaceCount + 1 - elseif player:getRace() == tpz.race.GALKA and member:getRace() == tpz.race.GALKA then + elseif pRace == tpz.race.GALKA and mRace == tpz.race.GALKA then partySameRaceCount = partySameRaceCount + 1 - elseif player:getRace() == tpz.race.MITHRA and member:getRace() == tpz.race.MITHRA then + elseif pRace == tpz.race.MITHRA and mRace == tpz.race.MITHRA then partySameRaceCount = partySameRaceCount + 1 end - -- job for third if member:getMainJob() == player:getMainJob() then partySameJobCount = partySameJobCount + 1 end @@ -124,73 +97,60 @@ function onEventUpdate(player, csid, option) end if questIntroToTeamwork == QUEST_ACCEPTED then - -- https://www.bg-wiki.com/bg/Introduction_to_Teamwork - if partySameNationCount == partySizeRequirement then - -- nation requirements met - player:setLocalVar("introToTmwrk_pass", 1) + if (partySameNationCount == partySizeRequirement) then + player:setLocalVar("introToTmwrk_pass", 1) -- nation requirements met player:updateEvent(15, 1) else - -- not the same nation - player:updateEvent(3) + player:updateEvent(3) -- not the same nation end elseif questIntermediateTeamwork == QUEST_ACCEPTED then - -- https://www.bg-wiki.com/bg/Intermediate_Teamwork - if partySameRaceCount == partySizeRequirement then - -- race requirements met + if (partySameRaceCount == partySizeRequirement) then player:setLocalVar("intermedTmwrk_pass", 1) - player:updateEvent(15, 2) + player:updateEvent(15, 2) -- race requirements met else - -- not the same race - player:updateEvent(4) + + player:updateEvent(4) -- not the same race end elseif questAdvancedTeamwork == QUEST_ACCEPTED then - -- https://www.bg-wiki.com/bg/Advanced_Teamwork if partySameJobCount == partySameJobCount then - -- race requirements met player:setLocalVar("advTmwrk_pass", 1) - player:updateEvent(15, 3) + player:updateEvent(15, 3) -- race requirements met else - -- not the same job - player:updateEvent(5) + player:updateEvent(5) -- not the same job end end else - -- need more party members - player:updateEvent(1) + player:updateEvent(1) -- need more party members end end end function onEventFinish(player, csid, option) - -- csid 129 is the event for when they have selected ready/not ready - + -- csid 129 is the event for when they have selected ready/not ready option is always 0 if csid == 129 and option == 0 then local questIntroToTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK); local questIntermediateTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK); local questAdvancedTeamwork = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK); - if questIntroToTeamwork == QUEST_ACCEPTED and player:getLocalVar("introToTmwrk_pass") == 1 then - -- check their inventory - npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK, { - item = 13442, - fame = 80, -- fame defaults to 30 if not set - title = tpz.title.THIRDRATE_ORGANIZER, - }) - elseif questIntermediateTeamwork == QUEST_ACCEPTED and player:getLocalVar("intermedTmwrk_pass") == 1 then - -- check their inventory - npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK, { - item = 4994, - fame = 80, -- fame defaults to 30 if not set - title = tpz.title.SECONDRATE_ORGANIZER, - }) - elseif questAdvancedTeamwork == QUEST_ACCEPTED and player:getLocalVar("advTmwrk_pass") == 1 then - -- check their inventory - npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK, { - item = 13459, - fame = 80, -- fame defaults to 30 if not set - title = tpz.title.FIRSTRATE_ORGANIZER, - }) - end + if questIntroToTeamwork == QUEST_ACCEPTED and player:getLocalVar("introToTmwrk_pass") == 1 then + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK, { + item = 13442, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.THIRDRATE_ORGANIZER, + }) + elseif questIntermediateTeamwork == QUEST_ACCEPTED and player:getLocalVar("intermedTmwrk_pass") == 1 then + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.INTERMEDIATE_TEAMWORK, { + item = 4994, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.SECONDRATE_ORGANIZER, + }) + elseif questAdvancedTeamwork == QUEST_ACCEPTED and player:getLocalVar("advTmwrk_pass") == 1 then + npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.ADVANCED_TEAMWORK, { + item = 13459, + fame = 80, -- fame defaults to 30 if not set + title = tpz.title.FIRSTRATE_ORGANIZER, + }) + end elseif csid == 131 and option == 1 then -- 131 is the third and last quest player:addQuest(SANDORIA,tpz.quest.id.sandoria.ADVANCED_TEAMWORK)