IQuestStateListener

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22135
Joined: Thu Jul 18, 2013 1:27 pm

Re: IQuestStateListener

Post by Tony Li »

Hi,
Ultroman wrote: Thu Oct 08, 2020 3:17 pmI have a bunch of delivery quests, so I'll have to change the state of the quest entries between being "active" and "success" depending on whether the player currently has the required items in their inventory. I can set up my own triggers to update those, BUT then I also need to update the Quest Indicators by calling QuestLog.UpdateQuestIndicators("questName") every time I change the state of an entry, right? Since the hand-in condition checks the states of its entries. This is the way?
Yes. Add a script to the Dialogue Manager with an OnQuestStateChange method. Example:

Code: Select all

void OnQuestStateChange(string questName) // Also called if an entry in quest changes.
{
    QuestLog.UpdateQuestIndicators(questName);
}
Ultroman wrote: Thu Oct 08, 2020 3:17 pmSecond problem. This is all fine until you have more than one quest "active" or "grantable" with the NPC. Which one takes priority for the Quest Indicator when there are several QuestStateListener components on the same NPC? Optimally, the Question Mark would have priority, but it looks to me like it's just whichever quest last had its state updated. I think one would have to iterate over all available quests and do checks, in order to really determine which indicator should be shown.
Each QuestStateListener registers its desired indicator with the QuestStateIndicator component.

The QuestStateIndicator component shows the desired indicator that's highest in its list of indicators.

(More info)
Ultroman
Posts: 39
Joined: Thu Sep 17, 2020 7:47 am

Re: IQuestStateListener

Post by Ultroman »

Thanks, this is perfect! You're the best, dude :D
User avatar
Tony Li
Posts: 22135
Joined: Thu Jul 18, 2013 1:27 pm

Re: IQuestStateListener

Post by Tony Li »

Glad to help!

Prettying up the QuestStateListener inspector interface has been on my list since forever. It's hardly the most user-friendly thing right now. I'm afraid it won't make it into the upcoming version 2.2.12, but I'll get to it one of these days. :-)
Ultroman
Posts: 39
Joined: Thu Sep 17, 2020 7:47 am

Re: IQuestStateListener

Post by Ultroman »

Sounds good. The inspector for QuestStateListener is pretty bulky :D

I've run into a problem which I also made a thread about earlier. Now that I want my quests to start out "grantable", I went to set them as such, but as soon as I click here:
2020-10-10 23_36_41-Window.png
2020-10-10 23_36_41-Window.png (24.21 KiB) Viewed 334 times
it sets it to None():
2020-10-10 23_37_58-Window.png
2020-10-10 23_37_58-Window.png (13.08 KiB) Viewed 334 times
It's because the Field doesn't allow that state:
2020-10-10 23_39_03-Window.png
2020-10-10 23_39_03-Window.png (30.57 KiB) Viewed 334 times
User avatar
Tony Li
Posts: 22135
Joined: Thu Jul 18, 2013 1:27 pm

Re: IQuestStateListener

Post by Tony Li »

I added the ability to set the grantable state at design time in version 2.2.12 (coming out on Monday). In its original use case, it was only set at runtime, so I hadn't set up a test case to test it at first.

Here's a patch for now:

DS_QuestStateEditorPatch_2020-10-10.unitypackage
Ultroman
Posts: 39
Joined: Thu Sep 17, 2020 7:47 am

Re: IQuestStateListener

Post by Ultroman »

You are an absolute godsend, sir!
User avatar
Tony Li
Posts: 22135
Joined: Thu Jul 18, 2013 1:27 pm

Re: IQuestStateListener

Post by Tony Li »

Glad to help!
Post Reply