How to show specific Quest entry in UI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
allisonrose
Posts: 32
Joined: Wed Nov 14, 2018 8:27 pm

How to show specific Quest entry in UI

Post by allisonrose »

Hi again!

I'm wondering if it is possible to show a specific quest entry in a UI window.

I've looked over the Basic Standard UI Quest Log prefab, which loads a list of all quests dynamically, but I'd like to create an alternate UI menu to display a specific quest entry (or small group of specific quest entries I can call by name) in a specific order in the design.

So essentially I'd need a way to call a specific quest's name/description/etc and display that in a UI panel.

Would this be terribly complicated to do?

Below is an example of something I am trying to achieve. (Quests are displayed as icons, and quest information is displayed in the box when the user mouses over the icon)
Image
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to show specific Quest entry in UI

Post by Tony Li »

Hi,

You can do a lot with the existing StandardUIQuestLogWindow script. Here's a quick and dirty rendition using the Basic Standard Quest Log Window prefab, just moving some UI elements around and changing their appearance:

CouncilUExample_2019-11-02.unitypackage

It looks like this:

Image

The important methods are virtual so you can override their behavior to change things up as necessary. For example, you might want to keep the quest details panel hidden except for when the player is mousing over a quest title.

If you want to write your own script instead, use the QuestLog class.

Some examples:

Code: Select all

using PixelCrushers.DialogueSystem;

// Get a list of all active quests:
string[] questNames = QuestLog.GetAllQuests(QuestState.Active);

// Get a quest's title and description (localization-aware, based on the current language):
string title = QuestLog.GetQuestTitle("Ur-nammu");
string description = QuestLog.GetQuestDescription("Ur-nammu");
allisonrose
Posts: 32
Joined: Wed Nov 14, 2018 8:27 pm

How to show specific Quest entry in UI

Post by allisonrose »

Thank you for the example!
So I should be editing the StandardQuestLogWindow.cs to manipulate it how I want?
I'll have to dig into it to truly undestand how it works.
Tony Li wrote: Sat Nov 02, 2019 4:44 pm For example, you might want to keep the quest details panel hidden except for when the player is mousing over a quest title.
This is exactly what I'd like to do. Just hover over each quest title to see the details.

I found this part of the script that I THINK is what makes details appear on mouse over, so if so - would I just add an PointerExit after this bit? Is there a HideDetailsOnSelect?

Code: Select all

       // On cursor hover:
            entry = new UnityEngine.EventSystems.EventTrigger.Entry();
            entry.eventID = UnityEngine.EventSystems.EventTriggerType.PointerEnter;
            entry.callback.AddListener((eventData) => { ShowDetailsOnSelect(target); });
            eventTrigger.triggers.Add(entry);
            
Sorry, I have just been having trouble wrapping my head around this code in particular. I managed to customize all my other UI no problem, but this one is giving me more issues.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to show specific Quest entry in UI

Post by Tony Li »

Now that I think about it, that doesn't need any code. Here's an updated example:

CouncilUExample2_2019-11-02.unitypackage

It's the same as the previous one except I added these events:

1. On the StandardUIQuestLogWindow component:

Image

2. On the Active Quests Button and Completed Quests Button GameObjects:

Image

These events keep the details panel hidden unless the player is mousing over an Active Quest Button or Completed Quest Button.
allisonrose
Posts: 32
Joined: Wed Nov 14, 2018 8:27 pm

Re: How to show specific Quest entry in UI

Post by allisonrose »

Thanks Tony!
I can work with this :)
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to show specific Quest entry in UI

Post by Tony Li »

Great! If you have questions about implementing any other features, just let me know.
Post Reply