Show active quest name in dialogue text

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
VillVarh
Posts: 23
Joined: Mon Nov 06, 2023 5:19 am

Show active quest name in dialogue text

Post by VillVarh »

Hello. I want NPC to tell me the active quest name in teh dialogue text how can i do this? Ty in advance
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show active quest name in dialogue text

Post by Tony Li »

Hi,

You'll typically write your conversation tree so it checks which quests are active and goes down the appropriate branch. For example, say you have three quests to find the Scepter, Sword, and Crown. Your conversation might look like this:

multiQuestConversation.png
multiQuestConversation.png (24.27 KiB) Viewed 262 times

This is a simplified version. You might want to include conditions to check if the quest hasn't been started yet, in order to offer the quest to the player. Note above that you can use the "..." dropdown wizard to specify the Conditions so you don't have to type anything.

I added a default greeting ("Hello") that the NPC will say if none of the prior nodes' Conditions are true -- that is, if no quest is active.
VillVarh
Posts: 23
Joined: Mon Nov 06, 2023 5:19 am

Re: Show active quest name in dialogue text

Post by VillVarh »

I think you missunderstood me. I want the npc to say me the active quest name in the dialogue. When i talk to the npc it will tell me "You can't go there because (current active quest name here) is not completed". How can i achieve this.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show active quest name in dialogue text

Post by Tony Li »

Hi,

How does the NPC know which quest is the active quest?

In the Dialogue System, multiple quests can be active at the same time. If the NPC knows which possible quests could be active, you could set up your conversation like my example above. Example:

multiQuestConversation2.png
multiQuestConversation2.png (34.51 KiB) Viewed 256 times

If you don't know the quests ahead of time, you can write a C# function to identify the first active quest:

Code: Select all

public string GetActiveQuest()
{
    var quests = QuestLog.GetAllQuests(); // Gets all active quests
    return (quests.Length >= 1) ? quests[0] : string.Empty;
}
Then register this method with Lua.

Finally, set up a conversation like this:

multiQuestConversation3.png
multiQuestConversation3.png (19.26 KiB) Viewed 256 times
VillVarh
Posts: 23
Joined: Mon Nov 06, 2023 5:19 am

Re: Show active quest name in dialogue text

Post by VillVarh »

Thank you this is what i wanted!
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show active quest name in dialogue text

Post by Tony Li »

Glad to help!
Post Reply