Quest is not shown in journal
-
- Posts: 39
- Joined: Sat Apr 20, 2024 7:03 pm
Quest is not shown in journal
Hello,
I followed the video guide and setup a handwritten quest.
The whole flow seems to work. I setup a quest giver that gives the player a quest that the player accepts and I can go to the "circle" and complete the quest and all HUD and other UI elements are showing the progress, the problem is that there are nothing in the journal about the quest (I have added text to all parts of the setup which belongs to journal and so on).
I have also added a Quest Journal to the Player. But nothing shows up in the Journal UI component.
I followed the video guide and setup a handwritten quest.
The whole flow seems to work. I setup a quest giver that gives the player a quest that the player accepts and I can go to the "circle" and complete the quest and all HUD and other UI elements are showing the progress, the problem is that there are nothing in the journal about the quest (I have added text to all parts of the setup which belongs to journal and so on).
I have also added a Quest Journal to the Player. But nothing shows up in the Journal UI component.
Re: Quest is not shown in journal
Hi,
Are there any errors or warnings in the Console window?
When you pick up the quest while playing the scene in the Unity editor's play mode, inspect the player's Quest Journal component. Does its Quests list contain the quest?
Make sure to leave the Quest Journal component's UI Settings > Quest Journal UI field UNassigned. This way it will use the quest journal UI assigned to the Quest Machine GameObject, which is the easiest way to set things up.
Are there any errors or warnings in the Console window?
When you pick up the quest while playing the scene in the Unity editor's play mode, inspect the player's Quest Journal component. Does its Quests list contain the quest?
Make sure to leave the Quest Journal component's UI Settings > Quest Journal UI field UNassigned. This way it will use the quest journal UI assigned to the Quest Machine GameObject, which is the easiest way to set things up.
-
- Posts: 39
- Joined: Sat Apr 20, 2024 7:03 pm
Re: Quest is not shown in journal
No errors.
The quest is listed in the player's Quest Journal component.
Quest Journal component's UI Settings > Quest Journal UI field is Unassigned.
Is there a way to access the journal programmatically? Like you showed me here:
https://www.pixelcrushers.com/phpbb/vie ... php?t=8094
The quest is listed in the player's Quest Journal component.
Quest Journal component's UI Settings > Quest Journal UI field is Unassigned.
Is there a way to access the journal programmatically? Like you showed me here:
https://www.pixelcrushers.com/phpbb/vie ... php?t=8094
- Attachments
-
- Screenshot 2024-04-22 at 17.40.59.png (10.98 KiB) Viewed 1296 times
Re: Quest is not shown in journal
Hi,
Yes, you can access the player's journal like this:
It sounds like you're following the video tutorials. If you download and import the tutorial assets and play the completed scene, does everything show up as expected in the UIs? If so please compare the quests to yours. Maybe the text ended up in the wrong place, such as the quest nodes' Inactive states instead of the Active or True states.
Yes, you can access the player's journal like this:
Code: Select all
QuestJournal journal = QuestMachine.GetQuestJournal();
foreach (Quest quest in journal.questList)
{
Debug.Log($"quest {quest.id} state: {quest.GetState()}");
}
-
- Posts: 39
- Joined: Sat Apr 20, 2024 7:03 pm
Re: Quest is not shown in journal
I tried your code and it displays the quests in the journal if I use the below code.
What else can I get from quest in the loop? DisplayName? Something else?
Code: Select all
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
using PixelCrushers.QuestMachine;
public class UIQuestsList : MonoBehaviour
{
[SerializeField] private GameObject itemPrefab;
[SerializeField] private Transform listParent;
private void OnEnable()
{
ClearList();
GenerateReport();
}
private void GenerateReport()
{
QuestJournal journal = QuestMachine.GetQuestJournal();
foreach (Quest quest in journal.questList)
{
Debug.Log($"quest {quest.id} state: {quest.GetState()}");
GameObject itemRow = Instantiate(factionMemberPrefab, listParent);
itemRow.transform.Find("ItemName").GetComponent<Text>().text = $"{quest.id}";
itemRow.transform.Find("Status").GetComponent<Text>().text = $"{quest.GetState()}";
}
}
private void ClearList()
{
foreach (Transform child in listParent)
{
Destroy(child.gameObject);
}
}
}
-
- Posts: 39
- Joined: Sat Apr 20, 2024 7:03 pm
Re: Quest is not shown in journal
Ah great, that will be handy.
I am trying to get quest giver object, how can I get that?
I am trying to get quest giver object, how can I get that?
Re: Quest is not shown in journal
Hi,
Use QuestMachineMessages.FindGameObjectWithID():
Use QuestMachineMessages.FindGameObjectWithID():
Code: Select all
GameObject npc = QuestMachineMessages.FindGameObjectWithID(quest.questGiverID);
-
- Posts: 39
- Joined: Sat Apr 20, 2024 7:03 pm
Re: Quest is not shown in journal
A brilliant, will try it out.
Thank you!
Thank you!
Re: Quest is not shown in journal
Glad to help!
You can use the same QuestMachineMessages.FindGameObjectByID() method to find a GameObject by the ID assigned to the Quest Journal component, Quest Giver component, Quest Entity component (for procedural quest generation), or Quest Machine ID (a simple component that just adds an ID to the GameObject.)
You can use the same QuestMachineMessages.FindGameObjectByID() method to find a GameObject by the ID assigned to the Quest Journal component, Quest Giver component, Quest Entity component (for procedural quest generation), or Quest Machine ID (a simple component that just adds an ID to the GameObject.)