How to define tags from a text table?

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

How to define tags from a text table?

Post by ds2497 »

Hi there,

I was wondering if there is a way for me to define a name for an entity (like a procedurally generated quest) in a regular quest and display it using a text table.

For example, I have a quest centered around a girl who wants to understand how guys perceive her. The girl acts as the quest giver, so I can use {QUESTGIVER} to display her name in the Journal and I want to do the same thing with guys. Is there a method to define {GUY_A}, {GUY_B}, and {GUY_C} in a text table and display their names as tags? Or, are there any other similar approaches that can accomplish this?
User avatar
Tony Li
Posts: 22093
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to define tags from a text table?

Post by Tony Li »

Hi,

Assuming each guy is a quest entity, each guy will have a display name. You can assign a string, a String Asset, or a Text Table field to the display name.

When the girl generates a quest, the generated quest text should include the guy's display name.
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: How to define tags from a text table?

Post by ds2497 »

Hi Tony,

I apologize for the confusion. I wasn't referring to a procedurally generated quest, but rather a designed quest. Is it possible for me to customize my own tags?
User avatar
Tony Li
Posts: 22093
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to define tags from a text table?

Post by Tony Li »

Hi,

Yes, but only in C# using Quest.tagDictionary.SetTag(tag, value). Examples:

Code: Select all

// Assign string value to tag GUY_A:
someQuest.tagDictionary.SetTag("GUY_A", "Adam");

// Assign text table field to GUY_B:
int fieldID = someTextTable.GetFieldID("Bob");
someQuest.tagDictionary.SetTag("GUY_B", new StringField(someTextTable, fieldID));
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: How to define tags from a text table?

Post by ds2497 »

Got it, thanks!
User avatar
Tony Li
Posts: 22093
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to define tags from a text table?

Post by Tony Li »

Glad to help!
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: How to define tags from a text table?

Post by ds2497 »

I'll leave this for anyone who might want to use custom tags or have their terms localized in I2. You can consider overriding the AddBodyContent method in UnityUIQuestJournalUI. I hope this helps!

Image
Post Reply