3D Quest objective marker?
3D Quest objective marker?
Hello, I'm planning to add a feature to our game, which is a Quest objective marker: https://assetstore.unity.com/packages/t ... ors-153472
When you track a quest from your quest log, I want to display a 2d on screen marker, pointing to a specific location
What do you think would be the best way to do approach this system, knowing all my quest are using Dialogue System Quests.
Ideally I would like to have a location for each Quest entry, but Im not sure how and where to store this data (a gameobject from the scene? a "location" ?)
Thanks!
When you track a quest from your quest log, I want to display a 2d on screen marker, pointing to a specific location
What do you think would be the best way to do approach this system, knowing all my quest are using Dialogue System Quests.
Ideally I would like to have a location for each Quest entry, but Im not sure how and where to store this data (a gameobject from the scene? a "location" ?)
Thanks!
Currently working on ->Squeakross: Home Squeak Home<- Using Dialogue System Save System and other features.
Previous game made with Dialogue system ->The Spirit and The mouse<-
Previous game made with Dialogue system ->The Spirit and The mouse<-
Re: 3D Quest objective marker?
Hi,
You could add a script to the GameObject that has dropdowns for the quest and quest entry. Use [QuestPopup] and [QuestEntryPopup] attributes:
In practical terms, you'll probably want to automatically update markers when quest entry states change. Ideally you'd register your markers with a manager script. But a quick-and-dirty first version could be:
You could add a script to the GameObject that has dropdowns for the quest and quest entry. Use [QuestPopup] and [QuestEntryPopup] attributes:
Code: Select all
public class QuestMarker : MonoBehaviour
{
[QuestPopup] public string questName;
[QuestEntryPopup] public int questEntry;
private void Start()
{
UpdateMarker();
}
public void UpdateMarker()
{
if (QuestLog.IsQuestActive(questName) && QuestLog.GetQuestEntryState(questName, questEntry) == Quest.Active)
{
// Show marker
}
else
{
// Hide marker
}
}
}
Code: Select all
public class QuestMarkerManager : MonoBehaviour
{
private void Awake()
{
QuestLog.SetQuestEntryStateOverride = SetQuestEntryStateAndUpdateMarkers;
}
private void SetQuestEntryStateAndUpdateMarkers(string questName, int entryID, string state)
{ // (Would be better for each QuestMarker to register itself in a list instead of FindObjectsOfType.)
foreach (QuestMarker questMarker in FindObjectsOfType<QuestMarker>())
{
questMarker.UpdateMarker();
}
}
}
Re: 3D Quest objective marker?
thanks for this solution, this seems very elegant!
Currently working on ->Squeakross: Home Squeak Home<- Using Dialogue System Save System and other features.
Previous game made with Dialogue system ->The Spirit and The mouse<-
Previous game made with Dialogue system ->The Spirit and The mouse<-
Re: 3D Quest objective marker?
Glad to help! Please let me know how it goes. I've added that asset to my list of things to look at. I might add official integration at some point.
Re: 3D Quest objective marker?
I have question about quest manager - is it some event in Dialogue System telling listeners that any quest change its state?
Like watcher pattern with quests state
Like watcher pattern with quests state
Re: 3D Quest objective marker?
Hi,
Yes. The "OnQuestStateChange" message is sent to the Dialogue Manager GameObject's hierarchy.
You can add a script with an OnQuestStateChange(string questName) method to the Dialogue Manager, or add a Dialogue System Events component and configure its OnQuestStateChange() UnityEvent.
Yes. The "OnQuestStateChange" message is sent to the Dialogue Manager GameObject's hierarchy.
You can add a script with an OnQuestStateChange(string questName) method to the Dialogue Manager, or add a Dialogue System Events component and configure its OnQuestStateChange() UnityEvent.
Re: 3D Quest objective marker?
I have one more question I need to draw mark on map when player starts tracking some quest.
I know about OnQuestTrackingEnabled(string questTitle)
However, I don't want to write additional managers and I decided to extend your QuestStateListener by deriving
Since it is connected to QuestDispatcher and there is no OnQuestTrackingEnable there, I wanted to know how I can know when the player starts tracking the quest (to draw a mark on the map).
I tried (QuestLog.IsQuestTrackingEnabled(questName))
However, either this function just tells me if the quest can be tracked, or starting track quest does not trigger OnQuestStateChange in the dispatcher - nothing happens
I could extend Dispatcher and fix all of it, but then i need to override QuestStateDispatcher property in QuestStateListener, but its not virtual (bc i need to add my dispatcher with OnQuestTrackingEnabled, not yours)
Also i have variant manually add my custom dispatcher to dialogue manager GO, but it seems dirty.
I need tip from experienced developer
I know about OnQuestTrackingEnabled(string questTitle)
However, I don't want to write additional managers and I decided to extend your QuestStateListener by deriving
Since it is connected to QuestDispatcher and there is no OnQuestTrackingEnable there, I wanted to know how I can know when the player starts tracking the quest (to draw a mark on the map).
I tried (QuestLog.IsQuestTrackingEnabled(questName))
However, either this function just tells me if the quest can be tracked, or starting track quest does not trigger OnQuestStateChange in the dispatcher - nothing happens
I could extend Dispatcher and fix all of it, but then i need to override QuestStateDispatcher property in QuestStateListener, but its not virtual (bc i need to add my dispatcher with OnQuestTrackingEnabled, not yours)
Also i have variant manually add my custom dispatcher to dialogue manager GO, but it seems dirty.
I need tip from experienced developer
Re: 3D Quest objective marker?
Hi,
QuestLog.IsQuestTrackingAvailable(questName) tells you if the quest is allowed to be tracked -- that is, if the quest log window shows a Track toggle that the player can turn on and off.
QuestLog.IsQuestTrackingEnabled(questName) tells you if the Track toggle has been turned on.
QuestLog.IsQuestTrackingAvailable(questName) tells you if the quest is allowed to be tracked -- that is, if the quest log window shows a Track toggle that the player can turn on and off.
QuestLog.IsQuestTrackingEnabled(questName) tells you if the Track toggle has been turned on.
Re: 3D Quest objective marker?
As far as I understand OnQuestStateChange() is not called when we start / stop tracking a quest. This is the responsibility of OnQuestTrackingEnabled() method
The only solution I can see is to modify the QuestStateDispatcher component and add the OnQuestTrackingEnabled/Disabled() method there, and also make the m_listeners field protected for deriving, instead of private so that I can send a message to the listeners (i need to know what listeners is). I know that changing your code is bad, but unfortunately with inheritance I can't get the m_listeners field
Or make another dispatcher for listening for OnQuestTrackingEnabled()
The only solution I can see is to modify the QuestStateDispatcher component and add the OnQuestTrackingEnabled/Disabled() method there, and also make the m_listeners field protected for deriving, instead of private so that I can send a message to the listeners (i need to know what listeners is). I know that changing your code is bad, but unfortunately with inheritance I can't get the m_listeners field
Or make another dispatcher for listening for OnQuestTrackingEnabled()
Re: 3D Quest objective marker?
Hi,
This version of QuestStateDispatcher.cs will be in DS version 2.2.41. There is a public listeners property, and all methods are virtual.
DS_QuestStateDispatcherPatch_2023-10-29.unitypackage
This version of QuestStateDispatcher.cs will be in DS version 2.2.41. There is a public listeners property, and all methods are virtual.
DS_QuestStateDispatcherPatch_2023-10-29.unitypackage