Page 1 of 1

How to add responses via C# code

Posted: Sat Mar 04, 2023 9:31 am
by wolf-mvp
Hello,
I want to add response options via C# code. I already have working Conversation, but just need to add player answers via C# code.

For example: scene have a trader and I want to buy someting.
I need to add array of options via C# code.

For example:
"I want to buy an apple for 10 gold"
"I want to buy sword for 50 gold"
"I want to buy a hat for 30 gold"

and then move to next dialogue entry with saved choice (this can be done with DialogueLua.SetVariable as I know).

I try to find ability to add response options via C# code, but no luck.

Re: How to add responses via C# code

Posted: Sat Mar 04, 2023 11:47 am
by Tony Li
Hi,

The simplest way is probably to create the conversation at runtime. See: How To: Create Dialogue Database At Runtime

Re: How to add responses via C# code

Posted: Mon Mar 13, 2023 6:14 pm
by wolf-mvp
Hi, Thanks for response.

I think is is too complicated for me to changle full logic and create the conversation at runtime.

I make some workaround to copy/paste buttons at runtime with required actions.

I think - issue is solved.

Re: How to add responses via C# code

Posted: Mon Mar 13, 2023 6:47 pm
by Tony Li
Alright. Another approach would be to use variables. If you run into any issues with your solution, let me know and I can write up how you could use variables in response nodes to handle this.