From edd06486a1035a74df9870385e2336e2fc22ca3c Mon Sep 17 00:00:00 2001 From: Flibe <85970456+Flibe-XI@users.noreply.github.com> Date: Wed, 31 Jan 2024 06:11:14 -0500 Subject: [PATCH] [AMK, Lua] Mission 13 puzzle 1 - Beaucedine Glacier runaround (#5045) * Add beauc glac puzzle npc logic Structure for cutscenes handled by lonely evergreen and goblin grenadier, as well as the structure of the pips. * puzzle pips complete, map bug fixed The cutscene event for the goblin grenadier requires two sets of args, first is for the hint and win/lose mechanic, the second from the eventUpdate section is to relabel an pips on the map if you wanted to. Setting the pip args to 0 makes it so the map isn't changed accidentally --- .../13_A_Challenge_You_Could_Be_a_Winner.lua | 345 +++++++++++++++++- scripts/missions/amk/helpers.lua | 80 ++++ .../Beaucedine_Glacier/DefaultActions.lua | 9 +- scripts/zones/Beaucedine_Glacier/IDs.lua | 2 + .../npcs/Goblin_Grenadier.lua | 1 - 5 files changed, 425 insertions(+), 12 deletions(-) diff --git a/scripts/missions/amk/13_A_Challenge_You_Could_Be_a_Winner.lua b/scripts/missions/amk/13_A_Challenge_You_Could_Be_a_Winner.lua index 87679723b57..f93bff51b18 100644 --- a/scripts/missions/amk/13_A_Challenge_You_Could_Be_a_Winner.lua +++ b/scripts/missions/amk/13_A_Challenge_You_Could_Be_a_Winner.lua @@ -2,7 +2,13 @@ -- A Challenge! You Could Be a Winner -- A Moogle Kupo d'Etat M13 -- !addmission 10 12 --- Inconspicuous Door : !pos -15 1.300 68 244 +-- Shadowy Pillar : !pos 374 -12 -15 +-- Lonely Evergreen : !pos -162 -80 178 +-- Goblin Grenadier : !pos -26 -59 -76 +----------------------------------- +-- This mission can be repeated by losing the bncm battle in the subsequent mission +-- Therefore to remove possible conflicts, the mission progress will be handled +-- using a variable stored as a CharVar ----------------------------------- require('scripts/globals/missions') require('scripts/globals/interaction/mission') @@ -17,28 +23,353 @@ mission.reward = mission.sections = { + -- Part 1: Castle Zvahl Baileys { check = function(player, currentMission, missionStatus, vars) - return currentMission == mission.missionId + return currentMission >= mission.missionId and + not player:hasKeyItem(xi.ki.GAUNTLET_CHALLENGE_KUPON) end, - [xi.zone.UPPER_JEUNO] = + [xi.zone.CASTLE_ZVAHL_BAILEYS] = { - ['Inconspicuous_Door'] = + ['Shadowy_Pillar'] = { onTrigger = function(player, npc) - return mission:progressEvent(10185) + return mission:progressEvent(100, 3) end, }, onEventFinish = { - [10185] = function(player, csid, option, npc) - mission:complete(player) + [100] = function(player, csid, option, npc) + player:setCharVar('Mission[10][12]progress', 1) end, }, }, }, + + -- Part 2-a: Beaucedine Glacier + { + check = function(player, currentMission, missionStatus, vars) + return currentMission >= mission.missionId and + player:getCharVar('Mission[10][12]progress') == 1 and + not player:hasKeyItem(xi.ki.POCKET_MOGBOMB) and + not player:hasKeyItem(xi.ki.TRIVIA_CHALLENGE_KUPON) and + player:needToZone() == false + end, + + [xi.zone.BEAUCEDINE_GLACIER] = + { + ['Lonely_Evergreen'] = + { + onTrigger = function(player, npc) + return mission:progressEvent(504) + end, + }, + + onEventFinish = + { + [504] = function(player, csid, option, npc) + if option == 1 then + player:needToZone(true) + end + end, + } + }, + }, + + -- Part 2-b: Beaucedine Glacier + { + check = function(player, currentMission, missionStatus, vars) + return currentMission >= mission.missionId and + player:getCharVar('Mission[10][12]progress') == 1 and + not player:hasKeyItem(xi.ki.POCKET_MOGBOMB) and + not player:hasKeyItem(xi.ki.TRIVIA_CHALLENGE_KUPON) and + player:needToZone() == true + end, + + [xi.zone.BEAUCEDINE_GLACIER] = + { + ['Lonely_Evergreen'] = + { + onTrigger = function(player, npc) + return mission:progressEvent(503) + end, + }, + + ['Goblin_Grenadier'] = + { + onTrigger = function(player, npc) + local answer = player:getLocalVar('Mission[10][12]pipSet') - 1 + + if answer < 0 then + return mission:progressEvent(508, xi.ki.MAP_OF_THE_NORTHLANDS_AREA) + else + local today = VanadielDayOfTheWeek() + local tomorrow = (today + 1) % 8 + local hintsUsed = player:getLocalVar('Mission[10][12]hintsUsed') + + player:messageSpecial(zones[player:getZoneID()].text.GRENADIER_DAY_HINT, today, tomorrow) + + return mission:progressEvent( + 507, + hintsUsed + 2, + answer, + xi.ki.MAP_OF_THE_NORTHLANDS_AREA, + xi.ki.POCKET_MOGBOMB, + xi.ki.MAP_OF_THE_NORTHLANDS_AREA + ) + end + end, + }, + + ['Northwestern_Pip'] = + { + onTrigger = function(player, npc) + local pipSet = player:getLocalVar('Mission[10][12]pipSet') - 1 + local pos = npc:getPos() + local element = xi.amk.helpers.pipSets[pipSet][1] + + return mission:progressEvent( + 510, + pos.x * 1000, + pos.z * 1000, + pos.y * 1000, + element, + xi.ki.MAP_OF_THE_NORTHLANDS_AREA + ) + end, + }, + + ['Western_Pip'] = + { + onTrigger = function(player, npc) + local pipSet = player:getLocalVar('Mission[10][12]pipSet') - 1 + local pos = npc:getPos() + local element = xi.amk.helpers.pipSets[pipSet][2] + + return mission:progressEvent( + 511, + pos.x * 1000, + pos.z * 1000, + pos.y * 1000, + element, + xi.ki.MAP_OF_THE_NORTHLANDS_AREA + ) + end, + }, + + ['Southwestern_Pip'] = + { + onTrigger = function(player, npc) + local pipSet = player:getLocalVar('Mission[10][12]pipSet') - 1 + local pos = npc:getPos() + local element = xi.amk.helpers.pipSets[pipSet][3] + + return mission:progressEvent( + 512, + pos.x * 1000, + pos.z * 1000, + pos.y * 1000, + element, + xi.ki.MAP_OF_THE_NORTHLANDS_AREA + ) + end, + }, + + ['Northeastern_Pip'] = + { + onTrigger = function(player, npc) + local pipSet = player:getLocalVar('Mission[10][12]pipSet') - 1 + local pos = npc:getPos() + local element = xi.amk.helpers.pipSets[pipSet][4] + + return mission:progressEvent( + 513, + pos.x * 1000, + pos.z * 1000, + pos.y * 1000, + element, + xi.ki.MAP_OF_THE_NORTHLANDS_AREA + ) + end, + }, + + ['Eastern_Pip'] = + { + onTrigger = function(player, npc) + local pipSet = player:getLocalVar('Mission[10][12]pipSet') - 1 + local pos = npc:getPos() + local element = xi.amk.helpers.pipSets[pipSet][5] + + return mission:progressEvent( + 514, + pos.x * 1000, + pos.z * 1000, + pos.y * 1000, + element, + xi.ki.MAP_OF_THE_NORTHLANDS_AREA + ) + end, + }, + + ['Southeastern_Pip'] = + { + onTrigger = function(player, npc) + local pipSet = player:getLocalVar('Mission[10][12]pipSet') - 1 + local pos = npc:getPos() + local element = xi.amk.helpers.pipSets[pipSet][6] + + return mission:progressEvent( + 515, + pos.x * 1000, + pos.z * 1000, + pos.y * 1000, + element, + xi.ki.MAP_OF_THE_NORTHLANDS_AREA + ) + end, + }, + + onEventUpdate = + { + [507] = function(player, csid, option, npc) + -- This updateEvent updates the markers on the map to track which pips have already been found, + -- and can alter what the map shows when a pip is checked. If not called here, the args + -- for hints used and answer get input as markers and erroneously show incorrect pips + -- All zeros = only show what have been found so far + player:updateEvent(0, 0, 0, 0, 0, 0) + end, + }, + + onEventFinish = + { + [507] = function(player, csid, option, npc) + if + option == 1 or -- Used first hint + option == 2 -- Used second hint + then + local hintsUsed = player:getLocalVar('Mission[10][12]hintsUsed') + player:setLocalVar('Mission[10][12]hintsUsed', hintsUsed + 1) + elseif option == 3 then + -- wrong answer, reset puzzle + player:needToZone(false) + -- elseif option == 4 then + -- Player chooses to exit the chat, or tries to get a third hint, + -- which doesn't exist. Two hints max + elseif + option == 5 or -- Correct answer, no hints used + option == 6 or -- Correct answer, one hint used + option == 7 -- Correct answer, two hints used + then + player:needToZone(false) + npcUtil.giveKeyItem(player, xi.ki.POCKET_MOGBOMB) + + -- Add flee affect, base 5 minutes for no hints used, 3 for 1 hint, no flee for 2 hints + local fleeDuration = + { + [5] = 300, + [6] = 180, + } + + if option == 5 or option == 6 then + player:addStatusEffect(xi.effect.FLEE, 100, 0, fleeDuration[option]) + end + end + end, + + [508] = function(player, csid, option, npc) + -- Pipset offset by 1 to account for saving 0 as a variable. When retrieving, subtract 1 + player:setLocalVar('Mission[10][12]pipSet', math.random(1, 10)) -- range: 0 - 9 + end, + }, + }, + }, + + -- Part 2-c: Beaucedine Glacier + { + check = function(player, currentMission, missionStatus, vars) + return currentMission >= mission.missionId and + player:getCharVar('Mission[10][12]progress') == 1 and + player:hasKeyItem(xi.ki.POCKET_MOGBOMB) + end, + + [xi.zone.BEAUCEDINE_GLACIER] = + { + ['Lonely_Evergreen'] = + { + onTrigger = function(player, npc) + return mission:progressEvent(502, xi.ki.POCKET_MOGBOMB, xi.ki.TRIVIA_CHALLENGE_KUPON) + end, + }, + + ['Goblin_Grenadier'] = + { + onTrigger = function(player, npc) + -- Reminder to take mogbomb to lonely evergreen moogle + player:messageSpecial(zones[player:getZoneID()].text.GRENADIER_TAKE_PRIZE, xi.ki.POCKET_MOGBOMB) + end, + }, + + onEventFinish = + { + [502] = function(player, csid, option, npc) + player:delKeyItem(xi.ki.POCKET_MOGBOMB) + npcUtil.giveKeyItem(player, xi.ki.TRIVIA_CHALLENGE_KUPON) + player:setCharVar('Mission[10][12]progress', 2) + end, + }, + }, + }, + + -- Part 3: Xarcabard + { + check = function(player, currentMission, missionStatus, vars) + return currentMission == mission.missionId and + player:getCharVar('Mission[10][12]progress') == 2 and + player:hasKeyItem(xi.ki.TRIVIA_CHALLENGE_KUPON) + end, + + [xi.zone.BEAUCEDINE_GLACIER] = + { + ['Lonely_Evergreen'] = + { + onTrigger = function(player, npc) + -- Reminder text + return mission:progressEvent(501, xi.ki.TRIVIA_CHALLENGE_KUPON) + end, + }, + }, + + [xi.zone.XARCABARD] = + { + + }, + }, + + -- Part 4: Castle Zvahl Baileys + { + check = function(player, currentMission, missionStatus, vars) + return currentMission == mission.missionId + end, + + [xi.zone.CASTLE_ZVAHL_BAILEYS] = + { + + }, + }, + + -- Part 5: Castle Zvahl Keep + { + check = function(player, currentMission, missionStatus, vars) + return currentMission == mission.missionId + end, + + [xi.zone.CASTLE_ZVAHL_KEEP] = + { + + }, + }, } return mission diff --git a/scripts/missions/amk/helpers.lua b/scripts/missions/amk/helpers.lua index d3d2eedcc72..0815a0c3e41 100644 --- a/scripts/missions/amk/helpers.lua +++ b/scripts/missions/amk/helpers.lua @@ -430,3 +430,83 @@ xi.amk.helpers.chocoboDig = function(player, zoneId, text) return false end + +-- Mission 13 (index 12) - Puzzles!!! +-- Puzzle 1 +xi.amk.helpers.pipSets = +{ + -- [Answer]: 0-9 { + -- [1] = NW, [4] = NE, + -- [2] = W, [5] = E, + -- [3] = SW, [6] = SE, + -- }, + [0] = + { + [1] = 4, [4] = 3, + [2] = 5, [5] = 2, + [3] = 4, [6] = 3, + }, + + [1] = + { + [1] = 1, [4] = 3, + [2] = 1, [5] = 4, + [3] = 1, [6] = 3, + }, + + [2] = + { + [1] = 0, [4] = 7, + [2] = 5, [5] = 6, + [3] = 4, [6] = 3, + }, + + [3] = + { + [1] = 2, [4] = 3, + [2] = 5, [5] = 4, + [3] = 2, [6] = 3, + }, + + [4] = + { + [1] = 6, [4] = 3, + [2] = 5, [5] = 4, + [3] = 1, [6] = 3, + }, + + [5] = + { + [1] = 1, [4] = 0, + [2] = 2, [5] = 3, + [3] = 5, [6] = 4, + }, + + [6] = + { + [1] = 1, [4] = 0, + [2] = 2, [5] = 3, + [3] = 3, [6] = 4, + }, + + [7] = + { + [1] = 4, [4] = 3, + [2] = 1, [5] = 4, + [3] = 1, [6] = 3, + }, + + [8] = + { + [1] = 4, [4] = 3, + [2] = 5, [5] = 4, + [3] = 4, [6] = 3, + }, + + [9] = + { + [1] = 4, [4] = 3, + [2] = 5, [5] = 4, + [3] = 1, [6] = 3, + }, +} diff --git a/scripts/zones/Beaucedine_Glacier/DefaultActions.lua b/scripts/zones/Beaucedine_Glacier/DefaultActions.lua index 89f70842392..979cc9fce6f 100644 --- a/scripts/zones/Beaucedine_Glacier/DefaultActions.lua +++ b/scripts/zones/Beaucedine_Glacier/DefaultActions.lua @@ -1,8 +1,9 @@ local ID = zones[xi.zone.BEAUCEDINE_GLACIER] return { - ['Leigon-Moigon'] = { event = 103 }, - ['Luck_Rune'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, - ['Potete'] = { event = 102 }, - ['Torino-Samarino'] = { event = 101 }, + ['Leigon-Moigon'] = { event = 103 }, + ['Luck_Rune'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, + ['Potete'] = { event = 102 }, + ['Torino-Samarino'] = { event = 101 }, + ['Goblin_Grenadier'] = { event = 509 }, } diff --git a/scripts/zones/Beaucedine_Glacier/IDs.lua b/scripts/zones/Beaucedine_Glacier/IDs.lua index c83fa8a816b..1d7a73233fd 100644 --- a/scripts/zones/Beaucedine_Glacier/IDs.lua +++ b/scripts/zones/Beaucedine_Glacier/IDs.lua @@ -23,6 +23,8 @@ zones[xi.zone.BEAUCEDINE_GLACIER] = LOGIN_NUMBER = 7184, -- In celebration of your most recent login (login no. ), we have provided you with points! You currently have a total of points. MEMBERS_LEVELS_ARE_RESTRICTED = 7204, -- Your party is unable to participate because certain members' levels are restricted. FISHING_MESSAGE_OFFSET = 7242, -- You can't fish here. + GRENADIER_DAY_HINT = 7410, -- What d-d-day was it again? Oh yeah, today's [Firesday/Earthsday/Watersday/Windsday/Iceday/Lightningday/Lightsday/Darksday]... And t-t-tomorrow's [Firesday/Earthsday/Watersday/Windsday/Iceday/Lightningday/Lightsday/Darksday]... ...Hmm? + GRENADIER_TAKE_PRIZE = 7426, -- T-t-take this here %, and bring it back to the moogle for your hard earned r-r-reward! And let's give [him/her] a r-r-rousing round of applause! CONQUEST = 7495, -- You've earned conquest points! YOU_CANNOT_ENTER_DYNAMIS = 7875, -- You cannot enter Dynamis - [Dummy/San d'Oria/Bastok/Windurst/Jeuno/Beaucedine/Xarcabard/Valkurm/Buburimu/Qufim/Tavnazia] for [day/days] (Vana'diel time). PLAYERS_HAVE_NOT_REACHED_LEVEL = 7877, -- Players who have not reached level are prohibited from entering Dynamis. diff --git a/scripts/zones/Beaucedine_Glacier/npcs/Goblin_Grenadier.lua b/scripts/zones/Beaucedine_Glacier/npcs/Goblin_Grenadier.lua index bd15cbd256e..57b4c583313 100644 --- a/scripts/zones/Beaucedine_Glacier/npcs/Goblin_Grenadier.lua +++ b/scripts/zones/Beaucedine_Glacier/npcs/Goblin_Grenadier.lua @@ -10,7 +10,6 @@ entity.onTrade = function(player, npc, trade) end entity.onTrigger = function(player, npc) - player:startEvent(509) end entity.onEventUpdate = function(player, csid, option, npc)