Page 1 of 1

How To Set Conversation Fields

Posted: Tue Dec 05, 2023 10:43 pm
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 10601 times
Right now, I can get that information and put it into the conversation no problem.
pirateEncounter.JPG
pirateEncounter.JPG (47.82 KiB) Viewed 10601 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 10601 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.

Re: How To Set Conversation Fields

Posted: Wed Dec 06, 2023 9:20 am
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

Re: How To Set Conversation Fields

Posted: Thu Dec 07, 2023 11:23 am
by Voltage3000
Thanks Tony! Working great now

Re: How To Set Conversation Fields

Posted: Thu Dec 07, 2023 11:44 am
by Tony Li
Glad to help!