Page 2 of 2
Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation
Posted: Sat Nov 13, 2021 2:38 pm
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.
Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation
Posted: Sun Nov 14, 2021 11:11 am
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
Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation
Posted: Sun Nov 14, 2021 11:34 am
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");
Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation
Posted: Tue Nov 16, 2021 4:42 am
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
Re: Set "IsPlayer" at runtime, and how to have more than 2 participants in a conversation
Posted: Tue Nov 16, 2021 7:48 am
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.