How to force QM Journal UI to update?

Announcements, support questions, and discussion for Quest Machine.
Post Reply
mel
Posts: 9
Joined: Thu May 30, 2024 11:43 am

How to force QM Journal UI to update?

Post by mel »

Hi Tony,

I've made a tool that updates my Dialogue System for Unity variables and quest log statuses so that I can more easily test out my game at different checkpoints as I develop.

I'm using both Dialogue System for Unity and Quest Machine together. I'm using DSFU for handling conversations and triggering quest progress while using QM for tracking main and side quests and using the QM journal.

How can I force refresh the QM journal through script? I tried finding my QM journal parent object and looping through its children which have UI Panels to call the RefreshAfterOneFrame() method, but this doesn't seem to be the right way.

Any advice or tips would be greatly appreciated!

Thanks,
Mel
User avatar
Tony Li
Posts: 22871
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to force QM Journal UI to update?

Post by Tony Li »

Hi Mel,

Call QuestMachineMessages.RefreshUIs(). This will send a refresh message to all relevant Quest Machine UIs.
mel
Posts: 9
Joined: Thu May 30, 2024 11:43 am

Re: How to force QM Journal UI to update?

Post by mel »

Hi Tony,

Thank you for the reply. I think my post may have been a little misleading and that the issue is more complex and has to do with the way Dialogue System for Unity and Quest Machine interact.

I tried .RefreshUIs() but I think the issue is actually that my player's Quest Journal component has no quests added. Even if a quest were properly added there, then the UI would automatically update, right?

The tool I made was basically updating Lua variables in the Variables tab and Quest state info in the Quests and Items tab of the Dialogue System Editor, as I frequently use these for condition checking. I am assuming I'm updating the DSFU side of things and not keeping QM in sync.

Here is an example of what my tool does at a checkpoint of the game - it is supposed to be very simple and a quick way for me to check subsequent quests triggers are working fine w/o playing to that point:

Code: Select all

// Sets certain bools
DialogueLua.SetVariable("PoliteToNPC1", true);
DialogueLua.SetVariable("PoliteToNPC2", true);

// Sets quest progress thus far
PixelCrushers.DialogueSystem.QuestLog.SetQuestState("CompleteTask1", PixelCrushers.DialogueSystem.QuestState.Success);
PixelCrushers.DialogueSystem.QuestLog.SetQuestState("CompleteTask2", PixelCrushers.DialogueSystem.QuestState.Active);
It does set this info properly in those tabs and allows me to progress and complete an active quest, however, the quest states don't appear in the Quest Machine Journal UI and it technically isn't synced with the Player's Quest Journal component, which is appearing as empty.

I might be going about this in the wrong way, but any tips on how I manage this better since I am using both assets would be a big help.
User avatar
Tony Li
Posts: 22871
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to force QM Journal UI to update?

Post by Tony Li »

Hi,

Have you created any Quest Machine quests (i.e., in Quest Machine's Quest Editor window)?
mel
Posts: 9
Joined: Thu May 30, 2024 11:43 am

Re: How to force QM Journal UI to update?

Post by mel »

Hi Tony,

Yes, I have. I usually duplicate a quest template I have in my Project and then manually add them to the Quest Database.
Screenshot 2024-11-25 at 2.49.21 PM.png
Screenshot 2024-11-25 at 2.49.21 PM.png (28.19 KiB) Viewed 11363 times
User avatar
Tony Li
Posts: 22871
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to force QM Journal UI to update?

Post by Tony Li »

Hi,

How are you granting quests to the player? Typically, you'll either use the Quest Giver's Quest Machine dialogue UI, or use the GiveQuest() Lua function in a Dialogue System conversation, or give the quest in a script (like here).

For details, please see Quest Machine's Dialogue System integration, which you can import from Assets > Plugins > Pixel Crushers > Quest Machine > Third Party Support > Dialogue System Support.unitypackage.

Make sure your Dialogue Manager GameObject has a DialogueSystemQuestMachineBridge component whose Override Quest Log checkbox is ticked.

Your Quest Machine GameObject should have a DialogueSystemQuestDialogueUI component.
mel
Posts: 9
Joined: Thu May 30, 2024 11:43 am

Re: How to force QM Journal UI to update?

Post by mel »

Hi Tony,

Thank you so much for your replies. I am using GiveQuest() during relevant dialogues. That GiveQuest script is very handy! I double checked my set up and all looks good - I'll check out the integration package for more info if I need.

I changed the way I am going to implement this quick progress feature, since there is a lot outside of the narrative systems I need to worry about saving and loading. Since I am using ES3 save, it's been much cleaner and smarter to use that tool for save/load of custom checkpoints.

Thanks again for all your help. I love both Dialogue System for Unity and Quest Machine dearly.
User avatar
Tony Li
Posts: 22871
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to force QM Journal UI to update?

Post by Tony Li »

Thanks, and glad to help!
Post Reply