Quest Node became True while the conditions not true

Announcements, support questions, and discussion for Quest Machine.
Post Reply
bitmore
Posts: 11
Joined: Mon Nov 08, 2021 3:16 am

Quest Node became True while the conditions not true

Post by bitmore »

Hi,
I'm using QM+DS and Opsive UCC+UIS.
I have a quest which has two counters:Kill(value mode is message) and Shinning Crystal(value mode is Data sync).
And there is a quest node which will become true after player kill 11 enemies and pick up 2 crystals. The conditions count mode is ALL.
The player accept the quest in SceneA, and the problem occurs when scene changes:
1: If player accept the quest in SceneA and don't do anything then change to SceneB, everything works well.
2: If player accept the quest in SceneA and pick up 2 crystals(didn't kill any enemy), jump to SceneB, then the quest node became true(even the counter Kill is 0).

After some tests, I found that this happens when the Quest Node has only 2 conditions and one of the conditions(my test is UIS Item Amount) is true.
Attachments
02.png
02.png (215.13 KiB) Viewed 772 times
01.png
01.png (161.8 KiB) Viewed 772 times
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Node became True while the conditions not true

Post by Tony Li »

Hi,

How are you sending the kill message?

Is it possible that the kill message is being sent when you change scenes? If you've configured the enemies to send the message when their GameObjects are deactivated or destroyed, they may be sending the message when Unity destroys them to unload the scene.

If so, and if you're using a Quest Machine component to send the message, how are you changing scenes? Are you using any of the ways listed here?
bitmore
Posts: 11
Joined: Mon Nov 08, 2021 3:16 am

Re: Quest Node became True while the conditions not true

Post by bitmore »

Hi Tony,
Thanks for your response.
UCC attribute manager has a death event and the kill message was send after the enemy dead. I don't think that's the Kill message problem, after chaning the scene, the Kill counter is still 0.

Code: Select all

public void OnDeathEvent(Vector3 position, Vector3 force, GameObject attacker){
        MessageSystem.SendMessage(this, "EnemyKilled", "Total");
        if(GetComponent<QuestEntity>() != null && GetComponent<QuestEntity>().entityType != null){
            MessageSystem.SendMessage(this, "EnemyKilled", GetComponent<QuestEntity>().entityType.name);
        }
        // m_QuestControl.SendToMessageSystem("EnemyKilled:Count:" + 1);
    }
I'm not using the ways listed, but I add these code before LoadScene:

Code: Select all

//PixelCrushers
        PixelCrushers.SaveSystem.BeforeSceneChange();
        PixelCrushers.SaveSystem.RecordSavedGameData();
        StartCoroutine(StartLoading(sceneIndex));
And after changing scene I called:

Code: Select all

PixelCrushers.SaveSystem.ApplySavedGameData();
And I also tested with two UIS Item Amount conditions, let's say 2 Crystals and 2 Wood, then the player pick up 2 crystals and change to another scene, the quest node will become true.

As I said above, this happens when the Quest Node has only 2 conditions and one of the conditions(UIS Item Amount) is true.
If there are 3 conditions then it works well.
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Node became True while the conditions not true

Post by Tony Li »

Hi,

If you tick the Quest Machine GameObject's Debug Settings > Debug checkbox, it will log a lot of activity to the Console. This may help you identify why the quest node is going to the True state.

Also feel free to send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look directly and try to identify the issue. Any size project (even large projects) is fine, and all customer files are handled confidentially.
bitmore
Posts: 11
Joined: Mon Nov 08, 2021 3:16 am

Re: Quest Node became True while the conditions not true

Post by bitmore »

It's my fault, I didn't follow the first step in Integration document:Untick the Inventory System Manager component's Dont Destroy On Load checkbox. This will prevent duplicate copies when loading saved games.
Untick the option and it works as expected.
Thanks Tony.
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Node became True while the conditions not true

Post by Tony Li »

Hi,

I'm glad you found the issue! :-)
Post Reply