Page 1 of 2

[SOLVED]Quest ID warning message

Posted: Fri Nov 20, 2020 8:56 am
by mschoenhals
Hi,

I have a quest that starts in one scene but the return node is an NPC in another scene. To track the spawn on the NPC, I found a post on your forum with this code:

Code: Select all

using UnityEngine;

namespace PixelCrushers.QuestMachine
{
    public class SpawnOnStart : MonoBehaviour
    {
        public StringField questID;
        public QuestState requiredState = QuestState.Active;
        public GameObject prefabToSpawn;

        // Start is called before the first frame update
        void Start()
        {
            if (QuestMachine.GetQuestState(questID) == requiredState)
            {
                Instantiate(prefabToSpawn);
            }
        }

        // Update is called once per frame
        void Update()
        {

        }
    }
}
However, if the player enters the NPC scene prior to the start of the quest, I get this warning message:

Code: Select all

Quest Machine: GetQuestState(findDan): Couldn't find a quest with ID 'findDan'.
Any ideas on what I should do to fix it?

Thank you in advance.

Re: Quest ID warning message

Posted: Fri Nov 20, 2020 10:27 am
by Tony Li
Hi,

You can check if the player has the quest first. Change the 'if' line to:

Code: Select all

if (QuestMachine.GetQuestJournal().FindQuest(questID) != null && QuestMachine.GetQuestState(questID) == requiredState)

Re: Quest ID warning message

Posted: Sat Nov 21, 2020 9:27 am
by mschoenhals
Hi Tony,

Thank you for your reply.
GetQuestJournal does not appear to work - I get an error stating:
"QuestMachine.GetQuestJournal(string)" is a method, which is not valid in the given context.

I tried pointing to the player QuestJournal but that's just a wrapper, so that didn't work either. I'm in the correct namespace:

Code: Select all

namespace PixelCrushers.QuestMachine

Re: Quest ID warning message

Posted: Sat Nov 21, 2020 9:38 am
by Tony Li
Hi,

There was a typo -- missing "()" in GetQuestJournal(). I just fixed it. Wrappers don't matter; a wrapper is a subclass of the original class, so you can use it interchangeably.

Re: Quest ID warning message

Posted: Sat Nov 21, 2020 10:02 am
by mschoenhals
Thanks for the quick reply! :D
That did it, works great.

While looking into this issue I realized that my player Quest Journal is not updating. I went back to the video tutorials and ensured that the player has the Quest Journal attached and that the Quest Machine prefab is in the scene.

The quests work (and that's probably why I didn't pick up on this earlier). The HUD updates and the player is able to progress through quests - even the ones that depend on the completion of other quests. When I run the game, the player Quest Journal Component shows the current quest under "Quests".

In the player, the Quest Journal UI under UI Settings is blank but that should default to the Quest Machine Journal UI under the Quest Machine prefab (as stated in the video tutorial). When I try to drag the Quest Journal UI canvas to the Quest Journal UI, it won't accept it.

Any ideas on what might be going on?

Re: Quest ID warning message

Posted: Sat Nov 21, 2020 10:07 am
by Tony Li
Leaving the Quest Journal's UI field blank is fine, as you said, because it will use the one assigned to the Quest Machine GameObject.

However, to assign a UI, please see page 46 of the manual or this FAQ that I just posted: How To: Assign Quest Machine UIs.

Re: Quest ID warning message

Posted: Sat Nov 21, 2020 10:33 am
by mschoenhals
I was able to follow the linked post and did drag the component Quest Journal UI into the field (although it was already there). Please note, I'm using the default journal UI.

The journal does not update - it's completely blank at all stages of a quest.

What else should I try?

Re: Quest ID warning message

Posted: Sat Nov 21, 2020 10:53 am
by Tony Li
If you open the Quest Editor window during play and click on the player, does it show the quest? Are the nodes in the correct states? (If the HUD is still showing its content and you're able to progress through the quests, I assume the nodes are in the correct state.)

To confirm: Everything except for the quest journal UI appears to be working correctly?

Is the Journal Text set correctly for the quest's and nodes' current states?

Are there any warnings or errors in the Console?

Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?

Re: Quest ID warning message

Posted: Sat Nov 21, 2020 11:05 am
by mschoenhals
Yes, during game play I can see the correct state for the player in the quest and the Quest Journal component is showing the quest under "Quests".

Everything else appears to be working. The HUD updates, the player progresses through the nodes, the dialogue system triggers correctly.

I configured the Journal Text quite a while ago when the journal was working.

I just tried dragging the Quest Journal UI component of QuestMachine into the player Quest Journal UI Settings field - it accepted the entry in the field, but the journal still doesn't update (or show any of the text fields).

There are no errors in the console.

I'm putting a reproduction together now.

Re: Quest ID warning message

Posted: Sat Nov 21, 2020 11:28 am
by mschoenhals
I just sent out the reproduction file. Approach the guard, get the quest, then hit "I" and then click Journal.