Started mass overhaul of quests and related components like small talk. Fixed some scripts. More fixes required.

This commit is contained in:
Filip Maj 2022-01-24 23:49:10 -05:00
parent df49eefadb
commit 2279ee7017
33 changed files with 1241 additions and 279 deletions

View file

@ -1,61 +1,149 @@
-- Level requirement is 5 on any class. Set to 1 for testing
-- TODO: Reward handling
require ("global")
--Actor Scripts
--unique/fst0Town01a/PopulaceStandard/kinnison
--unique/fst0Town01a/PopulaceStandard/mestonnaux
--unique/fst0Town01a/PopulaceStandard/sybell
--unique/fst0Town01a/PopulaceStandard/khuma_moshroca
--unique/fst0Town01a/PopulaceStandard/lefwyne
--unique/fst0Town01a/PopulaceStandard/nellaure
--[[
Quest Script
--Quest Flags
FLAG_TALKED_MESTONNAUX = 0;
FLAG_TALKED_SYBELL = 1;
FLAG_TALKED_NELLAURE = 2;
FLAG_TALKED_KHUMA_MOSHROCA = 4;
FLAG_TALKED_LEFWYNE = 8;
Name: Seeing the Seers
Code: Etc3g0
Id: 110674
Prereq: Level 5, Any Class
function checkNextPhase(player)
ownedQuest = player:GetQuest("Etc3g0");
if (
ownedQuest:GetQuestFlag(FLAG_TALKED_MESTONNAUX) == true and
ownedQuest:GetQuestFlag(FLAG_TALKED_SYBELL) == true and
ownedQuest:GetQuestFlag(FLAG_TALKED_NELLAURE) == true and
ownedQuest:GetQuestFlag(FLAG_TALKED_KHUMA_MOSHROCA) == true and
ownedQuest:GetQuestFlag(FLAG_TALKED_LEFWYNE) == true
) then
ownedQuest:NextPhase(243);
end
]]
-- Sequence Numbers
SEQ_000 = 0; -- Talk to all the seers.
SEQ_001 = 1; -- Return to Kinnison.
-- Actor Class Ids
KINNISON = 1001430;
SYBELL = 1001437;
KHUMA_MOSHROCA = 1001081;
NELLAURE = 1000821;
MESTONNAUX = 1001103;
LEFWYNE = 1001396;
-- Quest Markers
MRKR_KINNISON = 11080001
MRKR_SYBELL = 11080002
MRKR_KHUMA_MOSHROCA = 11080003
MRKR_NELLAURE = 11080004
MRKR_MESTONNAUX = 11080005
MRKR_LEFWYNE = 11080006
-- Quest Flags
FLAG_TALKED_MESTONNAUX = 0;
FLAG_TALKED_SYBELL = 1;
FLAG_TALKED_NELLAURE = 2;
FLAG_TALKED_KHUMA_MOSHROCA = 3;
FLAG_TALKED_LEFWYNE = 4;
--offerQuestResult = callClientFunction(player, "delegateEvent", player, quest, "processEventOffersStart");
function onStart(player, quest)
quest:StartSequence(SEQ_000);
end
function canAcceptQuest(player)
return (player:HasQuest("Etc3g0") == false and player:IsQuestCompleted("Etc3g0") == false and player:GetHighestLevel() >= 1);
function onFinish(player, quest)
end
function isObjectivesComplete(player, quest)
return (quest:GetPhase() == 243);
end
function onAbandonQuest(player, quest)
kinnison = GetWorldManager():GetActorInWorldByUniqueId("kinnison");
mestonnaux = GetWorldManager():GetActorInWorldByUniqueId("mestonnaux");
sybell = GetWorldManager():GetActorInWorldByUniqueId("sybell");
khuma_moshroca = GetWorldManager():GetActorInWorldByUniqueId("khuma_moshroca");
lefwyne = GetWorldManager():GetActorInWorldByUniqueId("lefwyne");
nellaure = GetWorldManager():GetActorInWorldByUniqueId("nellaure");
function onSequence(player, quest, sequence)
quest:ClearENpcs();
if (kinnison ~= nil and canAcceptQuest(player)) then
kinnison:SetQuestGraphic(player, 0x2);
if (sequence == SEQ_000) then
quest:AddENpc(SYBELL, qflag(quest, FLAG_TALKED_SYBELL));
quest:AddENpc(KHUMA_MOSHROCA, qflag(quest, FLAG_TALKED_KHUMA_MOSHROCA));
quest:AddENpc(NELLAURE, qflag(quest, FLAG_TALKED_NELLAURE));
quest:AddENpc(MESTONNAUX, qflag(quest, FLAG_TALKED_MESTONNAUX));
quest:AddENpc(LEFWYNE, qflag(quest, FLAG_TALKED_LEFWYNE));
elseif (sequence == SEQ_001) then
quest:AddENpc(KINNISON);
end
if (mestonnaux ~= nil) then mestonnaux:SetQuestGraphic(player, 0x0); end
if (sybell ~= nil) then sybell:SetQuestGraphic(player, 0x0); end
if (khuma_moshroca ~= nil) then khuma_moshroca:SetQuestGraphic(player, 0x0); end
if (lefwyne ~= nil) then lefwyne:SetQuestGraphic(player, 0x0); end
if (nellaure ~= nil) then nellaure:SetQuestGraphic(player, 0x0); end
end
function qflag(quest, flag)
return quest:GetFlag(flag) and QFLAG_ALL or QFLAG_NONE;
end
function onTalk(player, quest, npc, eventName)
local npcClassId = npc.GetActorClassId();
local seq = quest:GetSequence();
if (seq == SEQ_000) then
if (npcClassId == SYBELL) then
if (not quest:GetFlag(FLAG_TALKED_SYBELL)) then
callClientFunction(player, "delegateEvent", player, quest, "processEventSybellSpeak");
quest:SetFlag(FLAG_TALKED_SYBELL);
--quest:UpdateENpc(SYBELL, QFLAG_NONE);
else
callClientFunction(player, "delegateEvent", player, quest, "processEventSybellSpeakAfter");
end
elseif (npcClassId == KHUMA_MOSHROCA) then
if (not quest:GetFlag(FLAG_TALKED_KHUMA_MOSHROCA)) then
callClientFunction(player, "delegateEvent", player, quest, "processEventKhumaSpeak");
quest:SetFlag(FLAG_TALKED_KHUMA_MOSHROCA);
--quest:UpdateENpc(KHUMA_MOSHROCA, QFLAG_NONE);
else
callClientFunction(player, "delegateEvent", player, quest, "processEventKhumaSpeakAfter");
end
elseif (npcClassId == NELLAURE) then
if (not quest:GetFlag(FLAG_TALKED_NELLAURE)) then
callClientFunction(player, "delegateEvent", player, quest, "processEventNellaureSpeak");
quest:SetFlag(FLAG_TALKED_NELLAURE);
--quest:UpdateENpc(NELLAURE, QFLAG_NONE);
else
callClientFunction(player, "delegateEvent", player, quest, "processEventNellaureSpeakAfter");
end
elseif (npcClassId == MESTONNAUX) then
if (not quest:GetFlag(FLAG_TALKED_MESTONNAUX)) then
callClientFunction(player, "delegateEvent", player, quest, "processEventMestonnauxSpeak");
quest:SetFlag(FLAG_TALKED_MESTONNAUX);
--quest:UpdateENpc(MESTONNAUX, QFLAG_NONE);
else
callClientFunction(player, "delegateEvent", player, quest, "processEventMestonnauxSpeakAfter");
end
elseif (npcClassId == LEFWYNE) then
if (not quest:GetFlag(FLAG_TALKED_LEFWYNE)) then
callClientFunction(player, "delegateEvent", player, quest, "processEventLefwyneSpeak");
quest:SetFlag(FLAG_TALKED_LEFWYNE);
--quest:UpdateENpc(LEFWYNE, QFLAG_NONE);
else
callClientFunction(player, "delegateEvent", player, quest, "processEventLefwyneSpeakAfter");
end
end
-- Check condition to go to the next sequence
if (seq000_checkCondition(quest)) then
quest:StartSequence(SEQ_001);
end
elseif (seq == SEQ_001) then
--Quest Complete
if (npcClassId == KINNISON) then
callClientFunction(player, "delegateEvent", player, quest, "processEventClear");
callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 200, 1, 1, 9);
end
end
player:EndEvent();
end
-- Check if all seers are talked to
function seq000_checkCondition(quest)
return (quest:GetFlag(FLAG_TALKED_SYBELL) and
quest:GetFlag(FLAG_TALKED_KHUMA_MOSHROCA) and
quest:GetFlag(FLAG_TALKED_NELLAURE) and
quest:GetFlag(FLAG_TALKED_MESTONNAUX) and
quest:GetFlag(FLAG_TALKED_LEFWYNE));
end
-- This is called by the RequestQuestJournalCommand when map markers are request.
-- Check quest_marker for valid values. This should return a table of map markers.
function getJournalMapMarkerList(player, quest)
local seq = quest:GetSequence();
if (seq == SEQ_000) then
return MRKR_SYBELL, MRKR_KHUMA_MOSHROCA, MRKR_NELLAURE, MRKR_MESTONNAUX, MRKR_LEFWYNE;
elseif (seq == SEQ_001) then
return MRKR_KINNISON;
end
end