Page 1 of 1
QuestIndicatorManager with singleton QuestGiver
Posted: Sun Sep 11, 2022 7:33 pm
by PopQuizHotshot
I’d like to attach a QuestGiver script to my QuestMachine prefab singleton, and use it as the sole source for giving quests. There’s a couple reasons for this:
1. Simplifies how we give quests. GiveQuest(“global”, “questName”), instead of having to put down the NPC name directly.
2.Only two places where data needs to be saved. The player, and the QuestGiver on the QuestMachine prefab (instead of having to save each QuestGiver NPC)
Of course there are several downsides to this system, but the one I want to address is that using this pattern disables my ability to use the QuestIndicatorManager/QuestIndicatorUI to highlight NPCs of interest. Is there any good way of getting this functionality back while using the singleton QuestGiver?
Re: QuestIndicatorManager with singleton QuestGiver
Posted: Sun Sep 11, 2022 7:37 pm
by Tony Li
Hi,
You can still use Quest Indicator Managers on NPCs of interest. You just need to use Set Indicator quest actions manually to tell those NPCs to show indicators.
Re: QuestIndicatorManager with singleton QuestGiver
Posted: Wed Sep 14, 2022 9:08 pm
by PopQuizHotshot
Hi Tony,
I have a quest with a WaitingToStart SetIndicator action, but I think it's being intercepted when the scene starts by this line in MessageSystem.cs
Code: Select all
if (x.frameAdded == Time.frameCount) continue;
Re: QuestIndicatorManager with singleton QuestGiver
Posted: Thu Sep 15, 2022 3:12 pm
by PopQuizHotshot
I... kind of gave up on trying to do the single QuestGiver instance implementation, so I added a QuestGiver component to the applicable NPCs, and everything works except for one thing.
I'm using EasySave3, and quest indicators seem like they always load to their initial state when returning to the scene (like it's our first time visiting). The save system seems to be working because the NPC no longer has quests to offer. The indicator does goes away after talking to the NPC.
Edit: Occasionally it won't happen. possible race condition somewhere...
Re: QuestIndicatorManager with singleton QuestGiver
Posted: Thu Sep 15, 2022 3:16 pm
by Tony Li
Hi,
Sorry I haven't had a chance to reply. I'm working on a patch that makes that line no longer necessary. I'll try to post it here by the end of the day.
Re: QuestIndicatorManager with singleton QuestGiver
Posted: Thu Sep 15, 2022 3:49 pm
by PopQuizHotshot
PopQuizHotshot wrote: ↑Thu Sep 15, 2022 3:12 pm
I... kind of gave up on trying to do the single QuestGiver instance implementation, so I added a QuestGiver component to the applicable NPCs, and everything works except for one thing.
I'm using EasySave3, and quest indicators seem like they always load to their initial state when returning to the scene (like it's our first time visiting). The save system seems to be working because the NPC no longer has quests to offer. The indicator does goes away after talking to the NPC.
Edit: Occasionally it won't happen. possible race condition somewhere...
I'm now preventing this from happening with a CustomQuestIndicatorManager subclass:
Code: Select all
private IEnumerator DelayedRepaintCoroutine() {
yield return null;
Repaint();
}
protected override void OnDestroy() {
StopAllCoroutines();
base.OnDestroy();
}
Starting the DelayedRepaintCoroutine in Start() works, but the indicator will still flash for a split second when the scene loads.
Re: QuestIndicatorManager with singleton QuestGiver
Posted: Thu Sep 15, 2022 9:05 pm
by Tony Li
Hi,
Are you using a QuestIndicatorSaver component on your QuestIndicatorManager? (And changing scenes using the save system?)
The
Dialogue System Extras page has a
SaveSystemPrefabs package that also works with Quest Machine, since they use the same save system. It has a preconfigured Save System prefab that handles scene transitions with a fade out -> loading screen -> fade in if that's any help.
Re: QuestIndicatorManager with singleton QuestGiver
Posted: Thu Sep 15, 2022 9:49 pm
by PopQuizHotshot
Oh, I wasn't aware of the QuestIndicatorSaver! I'm currently on QuestMachine v1.2.17. Sorry, I probably should've started off with that.
Re: QuestIndicatorManager with singleton QuestGiver
Posted: Thu Sep 15, 2022 9:58 pm
by Tony Li
Hi,
Please try backing up your project (just to be on the safe side) and then updating to the latest Quest Machine version so you can get QuestIndicatorSaver and all of the other improvements to Quest Machine. If that doesn't resolve the issue, let me know.