Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation

Post by Tony Li »

Happy to help! I skipped over some things (but tried to remember to add comments about what to add) and may have glossed over some code without commenting it, so if you have questions, just let me know and/or check the API. It's the same as the manual, so just type a class name or method name into the search bar on the manual page to find an API reference.
Nightkin
Posts: 14
Joined: Fri Sep 10, 2021 6:28 am

Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation

Post by Nightkin »

I've spent some time studying the code in your example package (thank you again for that), and I think I understand what it does well enough now. And to reiterate what I said above, I could never have come up with this solution myself, definitely! :)

I have a last question though. What does this piece of code do?

Code: Select all

// Add empty Dialog[] table to Lua:
Lua.Run($"Conversation[{conversationID}] = {{ Dialog = {{}} }}");
I mean, I can read the comment but I have no idea what it actually does nor how it does it... and more importantly, how can I reverse that change in the OnConversationEnd() callback?

PS: I realize that my questions sound a bit like "Hi, I'm a newbie with your product and I want to do <very_advanced_stuff> with it, how do I do that?"... I have customers who come up to me with such questions on my own products as well, so my apologies and thank you again for your help and patience :)
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation

Post by Tony Li »

Hi,

It's a stub in case SimStatus gets turned on.

When using SimStatus, the Dialogue System maintains a table (array) in Lua with an entry for every dialogue entry in every conversation. If you're not using SimStatus, this can just be an empty table. That piece of code creates the empty table to prevent an otherwise harmless warning message so you'll get clean Console log output.

You don't have to undo it. But if you want to, you can use this code:

Code: Select all

// Remove Dialog[] table:
Lua.Run($"Conversation[{conversationID}] = nil");
Nightkin
Posts: 14
Joined: Fri Sep 10, 2021 6:28 am

Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation

Post by Nightkin »

Aha, I understand. SimStatus is something I hadn't looked into yet but it will probably be useful for me too, so thank you for the additional bit of code :)
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation

Post by Tony Li »

I recommend against SimStatus for instantiated conversations. You probably don't need to track the state of every node in every copy of every instantiated conversation. Instead, set and check DS variables in Script and Conditions fields as you need them.
Post Reply