How To Set Conversation Fields

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Voltage3000
Posts: 14
Joined: Mon Nov 27, 2023 8:28 pm

How To Set Conversation Fields

Post by Voltage3000 »

Hi Tony, I'm trying to figure out the best way to dynamically change values like rewards for encounters in my game.

We thought giving the conversations a field for specific values would be a good way to house that information.
convoAttributes.JPG
convoAttributes.JPG (36.81 KiB) Viewed 10599 times
Right now, I can get that information and put it into the conversation no problem.
pirateEncounter.JPG
pirateEncounter.JPG (47.82 KiB) Viewed 10599 times
However, I'm struggling to set the value.

Just for testing I'm trying to set this value to 999.

I initally tried to use this code:

Code: Select all

DialogueLua.SetConversationField(4, "Civillian Bid", 999);
However, this returns this error
debugLogs.JPG
debugLogs.JPG (57.17 KiB) Viewed 10599 times
I've been looking around the forums and tried to ape the LUA implementation

Code: Select all

        string luaCode = string.Format("Conversation[{0}].{1} = {2}\n", 4, "Civillian Bid", 999); 
        Lua.Run(luaCode, true, true);
This one doesn't throw any errors; however, this appears to have no effect.

I'm not super familiar with Lua code. I'm not sure what's going on with the syntax errors. Any push in the right direction would be greatly appreciated.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: How To Set Conversation Fields

Post by Tony Li »

Hi,

You weren't doing anything wrong. That's a bug in DialogueLua that's been fixed for version 2.2.42. Here's a patch:

DS_SetConversationFieldPatch_2023-12-06.unitypackage
Voltage3000
Posts: 14
Joined: Mon Nov 27, 2023 8:28 pm

Re: How To Set Conversation Fields

Post by Voltage3000 »

Thanks Tony! Working great now
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: How To Set Conversation Fields

Post by Tony Li »

Glad to help!
Post Reply