Page 1 of 1

[SOLVED] Couldn't Find A Quest with ID

Posted: Tue Dec 22, 2020 9:04 am
by mschoenhals
Hi,

I get a warning message when entering a scene:
Quest Machine: GetQuestState(rescueEzmore): Couldn't find a quest with ID 'rescueEzmore'.

RescueEzmore occurs in a later scene. There are 2 references to rescueEzmore in the scene with the error, one in a Lua dialogue and the other in a custom script. The custom script did get a patch sent out earlier, but I'm wondering if it's a similar issue to my previous post:
https://www.pixelcrushers.com/phpbb/vie ... f=9&t=3814

I believe the warning message happens because I'm checking to see if rescueEzmore is Successful (not unassigned) and Quest Machine isn't seeing any quest yet for rescueEzmore. Here's the updated script:

Code: Select all

using UnityEngine;

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

        GameObject player;

        // Start is called before the first frame update
        void Start()
        {
            player = GameObject.FindWithTag("Player");
            var playerQuestJournal = player.GetComponent<QuestJournal>();
            //if (QuestMachine.GetQuestState(questID) == requiredState)
            if (QuestMachine.GetQuestJournal().FindQuest(questID) != null && QuestMachine.GetQuestState(questID) == requiredState)
            {
                Instantiate(prefabToSpawn);
            }
        }

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

        }
    }
}
Any ideas why I get this message?

Thank you in advance.

Re: [HELP] Couldn't Find A Quest with ID

Posted: Tue Dec 22, 2020 10:24 am
by Tony Li
Hi,

Is the rescueEzmore quest assigned to the Quest Machine GameObject's quest database? I'll assume so and move on.

Does your SpawnOnStart script generate the warning message?

Please click on the message in the Console, press Ctrl+C (Cmd+C on Mac) to copy its details to the clipboard, then paste it into a reply. I suspect it's another instance of Quest Machine crying wolf when it doesn't really need to report the warning. If so, I'll fix it in the next update.

Re: [HELP] Couldn't Find A Quest with ID

Posted: Wed Dec 23, 2020 8:17 am
by mschoenhals
K, I double checked and rescueEzmore is in the Database.

QuestMachine.cs is generating the message (GetQuestState).

Here's the details on the warning:

Quest Machine: GetQuestState(rescueEzmore): Couldn't find a quest with ID 'rescueEzmore'.
UnityEngine.Debug:LogWarning(Object)
PixelCrushers.QuestMachine.QuestMachine:GetQuestState(String, String) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest Machine/QuestMachine.cs:575)
<ActivateNPC>d__2:MoveNext() (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/CheckQuestState.cs:19)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Re: [HELP] Couldn't Find A Quest with ID

Posted: Wed Dec 23, 2020 3:30 pm
by Tony Li
Hi,

It looks like you have a custom script named CheckQuestState.cs in Quest Machine's Scripts folder. I recommend moving it out of Quest Machine's folder structure. That way if you delete Quest Machine at some point to import a fresh, updated copy, you won't lose your custom script. Normally you can just import Quest Machine updates right on top of the existing installation. But you never know when you might want to clear it out for some reason, so this just helps prevent confusion with your own scripts.

If everything else is working fine, you can ignore that warning message. It's a case of Quest Machine showing a warning when it really doesn't need to. I've removed the warning in the next update, which is due for release on Monday.

Re: [HELP] Couldn't Find A Quest with ID

Posted: Wed Dec 23, 2020 5:28 pm
by mschoenhals
Ok, good to know, thank you for your help.

Re: [SOLVED] Couldn't Find A Quest with ID

Posted: Wed Dec 23, 2020 6:02 pm
by Tony Li
Happy to help! If you notice any issues (I don't expect you will), please let me know ASAP as I'm working on the next Quest Machine update now. Thanks!