Loading Ink dialogue at runtime

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
djdanlib
Posts: 2
Joined: Tue Jul 19, 2022 2:51 pm

Loading Ink dialogue at runtime

Post by djdanlib »

I'd like to load an Ink story JSON string from an external source at runtime, give it a title, and then be able to trigger that conversation later by title, and get/set some of its variables from C# code. You know, kind of a modular streaming assets thing. I intend to load several stories this way, once I get it to do one successfully.

I'm loading the JSON string and giving it a title via the DialogueSystemInkIntegration instance's AddStory(title, json) function which appears to load it into the integration code's runtime-auto-created Ink database just fine. I see it in that specific database when I set a breakpoint in AddStoryToDatabase.

There is an issue though. It's unable to find the story later on when I call DialogueManager.StartConversation with that title. It doesn't appear that auto-created Ink database is "in" the database that ConversationModel is looking at, as supplied by StartConversation.

If I first issue a DialogueController instance databaseManager.Reset(DatabaseResetOptions.KeepAllLoaded) the fake conversation is then populated into the master database, but this seems like it would clobber other state information.

It also appears inkJSONAssets must contain the story in the DialogueSystemInkIntegration LookupStory function, which does not happen when you call AddStory. This means LookupStory returns null for the story I loaded with AddStory, which is still in the Ink database. This means I can't look up the story and get/set its variables. I don't see another way to get the added story when I call AddStory.

Are these bugs, or should I be doing it differently, and if so how would you recommend proceeding?
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Ink dialogue at runtime

Post by Tony Li »

Hi,

That was indeed a bug. You can download the updated integration package from the Dialogue System Extras page.
(direct download)
djdanlib
Posts: 2
Joined: Tue Jul 19, 2022 2:51 pm

Re: Loading Ink dialogue at runtime

Post by djdanlib »

Hey, sorry for the late follow-up -- you fixed it perfectly. Thanks!
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Ink dialogue at runtime

Post by Tony Li »

Glad to help!
Post Reply