Page 1 of 1
Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Sat Nov 06, 2021 6:04 am
by maxvsthegames
Hi!
I've been having some trouble using the Quest Indicator. The "Offer" indicator would pop back even after I accepted the quest already. After some digging in the code, I figured that it came from this line from QuestIndicatorManager.cs :
It seemed to think that this quest was still "WaitingToStart" even though the quest was already started. After checking, I saw some discrepancies between the current Quest State when I check the quest from the Quest Giver gameobject, and when I check the quest from the Quest Journal gameobject.
When I check the Quest after selecting the Quest Journal object (which is my main character), this is shown in the quest editor, showing that the quest is "Active" and not "WaitingToStart":
But, when I select the quest giver (A character named Molly, in this case) and click on the quest in the Quest Giver component, this is shown in the quest editor, showing the status as "WaitingToStart":
This lead me to think that I was doing something wrong when giving the quest. I've been using two different ways to give quest to the player:
1) Accepting the quest on the Quest Board.
In that case, I create an object called Notice that has the quest as a parameter. I get the quest by using the line :
Quest q = QuestMachine.GetQuestInstance(QuestID);
2) Using LuaAddQuest in Dialogue System when talking to a NPC that is ready to offer the quest.
In this case, I check that the quest is still "WaitingToStart", because the player might have already taken it on the quest board before talking to the NPC.
That's pretty much it.
I think it's probably something simple that I didn't understand about the proper way to give the quest to the player.
Hopefully, you can help me out.
Thanks.
Re: Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Sat Nov 06, 2021 9:25 am
by Tony Li
Hi,
QuestIndicatorManager.RefreshFromAllQuests() loops through all instances of every quest. This includes the instance that's in the quest giver's quest list as well as any instances that might be in players' quest lists.
For each instance associated with the quest giver, it checks if questerID is blank. If questerID is blank, then this is an instance on in the quest giver's list. Otherwise it's an instance in the specified quester's list. If it's in the quest giver's list, it records the state, which is will later translate into an indicator (Offer, Talk, etc.).
At a glance, your code excerpts look good to me. But it is possible that the quest instances in the players' quest journal somehow don't have their quest.questID field set to the player's ID?
Re: Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Sat Nov 06, 2021 12:57 pm
by maxvsthegames
Hi!
I checked on the Quest Journal and took a new screenshot so you can see what is going on here:
As you can see, the Quest Journal ID is "Mint", which is the name of our main character.
I don't see Mint as the questerID anywhere, but this information doesn't seem to be shown in the inspector of the quest editor, so I'm not sure how I'm supposed to check if the QuesterID of the quests are null or correctly changed to Mint.
My game is not a multiplayer game and we only have one quester.
Is the QuesterID supposed to be changed to Mint automatically when we use GiveQuest(), or are we supposed to do something else that I've missed?
Maybe there's something that isn't set up properly.
To be honest, I'm a bit confused as to why there are two instances of the same quest (one in the Quest Journal being active, and one in the Quest Giver that is still being WaitingToStart). If I understand correctly, the one in the Quest Giver should basically remain as WaitingToStart forever since it's basically just a way to give that quest in its original state to a quester. And then, the quest in the Quest Journal is the actual State of the quest for our main character, is that right?
Thanks.
Re: Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Sat Nov 06, 2021 2:11 pm
by Tony Li
Hi,
maxvsthegames wrote: ↑Sat Nov 06, 2021 12:57 pmIs the QuesterID supposed to be changed to Mint automatically when we use GiveQuest(), or are we supposed to do something else that I've missed?
GiveQuest() automatically sets the quest's questerID property. This is an internal property that's not shown in the inspector.
maxvsthegames wrote: ↑Sat Nov 06, 2021 12:57 pmTo be honest, I'm a bit confused as to why there are two instances of the same quest (one in the Quest Journal being active, and one in the Quest Giver that is still being WaitingToStart). If I understand correctly, the one in the Quest Giver should basically remain as WaitingToStart forever since it's basically just a way to give that quest in its original state to a quester. And then, the quest in the Quest Journal is the actual State of the quest for our main character, is that right?
Yes, that's correct. It serves two purposes:
1. If the quest is repeatable, the quest giver retains a copy so it can give a new copy to the player again.
2. For games with multiple players/questers, the quest giver retains a copy so it can give copies to all players who ask for it.
In your project, do the indicators appear to work properly in the Demo scene?
Would it be possible for you send a
reproduction project to tony (at) pixelcrushers.com?
Re: Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Sat Nov 06, 2021 2:34 pm
by maxvsthegames
My project is pretty big (I've been working on it for almost a year) so a reproduction project would be hard.
If there's no other way, I could try to reproduced this issue on a much smaller project with the same scripts, etc.
Is there any way to see if the QuesterID for the quest has been set properly since it's not showing up in the inspector?
Maybe a way to make it show up in the inspector or as a debug in the console?
Re: Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Sat Nov 06, 2021 3:10 pm
by Tony Li
Quest.questerID is a property. It doesn't appear in the inspector.
You could write a script to print its value.
Or you could attach your debugger, add a breakpoint to QuestIndicatorManager.RefreshFromAllQuests, and step through to see what the quest instances' questerIDs are.
Re: Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Sat Nov 06, 2021 3:50 pm
by maxvsthegames
Alright, I just verified with a little debug and confirmed that the Quest instance in Quest Journal is being updated correctly with the QuesterID being set to "Mint".
But, the Quest instance in the Quest Giver remains with an empty QuesterID.
Any suggestions?
If it's necessary, I can try to reproduce this on a smaller project and send it to you.
Thanks.
Re: Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Sat Nov 06, 2021 5:25 pm
by Tony Li
Is your quest repeatable?
If so, is the quest board perhaps showing whatever icon is assigned to its QuestIndicatorManager's Has Quest But Cannot Offer dropdown?
If so, then that makes sense. It has a quest, but it can't offer it because the player is already on the quest.
If not, then would you please put together a small repro project? If you want to send a large project, that's fine, too. We've handled 100 GB projects in support requests before. (All customer files are handled confidentially.)
Re: Quest Current State discrepancies between Quest Journal and Quest Giver
Posted: Mon Nov 08, 2021 7:55 am
by Tony Li
Posting a followup: This issue will be resolved in version 1.2.22. QuestMachineIndicator was making an incorrect assumption that the indicator manager makes in order to support multiplayer games. In 1.2.22+, QuestMachineIndicator will have a checkbox 'Check Single Player Journal' that defaults to ticked. For anyone who's reading who is making a multiplayer game, please untick this checkbox.