Attach arbitrary string data to current quest status?

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
wiverson
Posts: 22
Joined: Wed Feb 13, 2019 7:49 pm

Attach arbitrary string data to current quest status?

Post 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!
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Attach arbitrary string data to current quest status?

Post 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().
User avatar
wiverson
Posts: 22
Joined: Wed Feb 13, 2019 7:49 pm

Re: Attach arbitrary string data to current quest status?

Post by wiverson »

Perfect - thanks!

For some reason I thought that tags were only for for UI display... Hmm.
User avatar
wiverson
Posts: 22
Joined: Wed Feb 13, 2019 7:49 pm

Re: Attach arbitrary string data to current quest status?

Post by wiverson »

Hmm. Should there be a built-in Set Tag Action and Tag Condition?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Attach arbitrary string data to current quest status?

Post 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.
Post Reply