Page 1 of 1

Attach arbitrary string data to current quest status?

Posted: Fri Mar 29, 2019 2:47 pm
by wiverson
Hi!

I'd like to be able to attach arbitrary string data to the current runtime state of a quest. At first I thought labels might work, but those appear to be static information for the quest definition, not runtime.

One idea I had was not to mess with the quests directly, just maintain an independent dictionary of some kind that matches the quest id to my own private store. Send/receive messages to keep things in sync. I think if I do that and attach a custom saver I'm good to go, but if there is some other idea/recommended strategy I'd love to hear it...

Thanks!

Re: Attach arbitrary string data to current quest status?

Posted: Fri Mar 29, 2019 3:08 pm
by Tony Li
You can use the quest's tagDictionary. This is a string dictionary containing lookup values for tags such as QUESTGIVER. For example, when your quest text contains "Return to {QUESTGIVER}" Quest Machine looks up QUESTGIVER in the tagDictionary and replaces it in the displayed text.

When you save a quest in a saved game, its tagDictionary is saved with it.

Use the methods ContainsTag(), SetTag(), and GetTagValue().

Re: Attach arbitrary string data to current quest status?

Posted: Fri Mar 29, 2019 7:03 pm
by wiverson
Perfect - thanks!

For some reason I thought that tags were only for for UI display... Hmm.

Re: Attach arbitrary string data to current quest status?

Posted: Fri Mar 29, 2019 7:14 pm
by wiverson
Hmm. Should there be a built-in Set Tag Action and Tag Condition?

Re: Attach arbitrary string data to current quest status?

Posted: Fri Mar 29, 2019 9:09 pm
by Tony Li
The original intent of tags is for UI display. When you asked your question in this thread, it occurred to me that you could also use tagDictionary for your own purposes. There's no built-in tag action or condition because they were originally intended to only be used internally, set automatically by the quest giver and used internally when preparing UI content for display. But you could certainly write your own action and condition. There are starter templates for actions and conditions in the Templates folder.