[SOLVED] Selecting a conversation using a popup instead of a string?
Posted: Thu Jun 20, 2019 1:29 am
I have a custom script I use to play conversations that is attached to my Npc's-
It uses StartConversation with a "Conversation" string variable- it all works perfectly- my issue is that my game has a lot of conversations
and some of them have long names like "GLife/SlaveBot_OutsideBossRoom"
Right now I'm typing out or copy pasting the dialog names into my public "Conversation" variable which works but it would be so much easier and cleaner if I could select the conversation name from a popup like the one that appears in the conversation window-
I noticed that the conversation names are stored in a List<Conversation>in the Database object-
I tried to use that to populate a popup in my script using Odin Inspector- it was very flaky and didn't work all the time so I went back to manually inputting the conversation name.
There's probably a way to do it with that List<Conversation> but I'm unable to
Is there a way to load in conversation name strings in our scripts without doing it manually?
Thank you.
Edit: I modified my Odin solution and it does work- but wondering if there's something cleaner...
It uses StartConversation with a "Conversation" string variable- it all works perfectly- my issue is that my game has a lot of conversations

Right now I'm typing out or copy pasting the dialog names into my public "Conversation" variable which works but it would be so much easier and cleaner if I could select the conversation name from a popup like the one that appears in the conversation window-
I noticed that the conversation names are stored in a List<Conversation>in the Database object-
I tried to use that to populate a popup in my script using Odin Inspector- it was very flaky and didn't work all the time so I went back to manually inputting the conversation name.
There's probably a way to do it with that List<Conversation> but I'm unable to

Is there a way to load in conversation name strings in our scripts without doing it manually?
Thank you.
Edit: I modified my Odin solution and it does work- but wondering if there's something cleaner...
Code: Select all
public string Conversation;
[ValueDropdown("DatabaseConversations")]
public string SelectedConversation;
public DialogueDatabase Database;
List<string> DatabaseConversations = new List<string>();
[Button]
void RefreshConversations()
{
DatabaseConversations.Clear();
for (int index = 0; index < Database.conversations.Count; index++)
{
var i = Database.conversations[index];
if (i.Title != "")
{
DatabaseConversations.Add(i.Title);
}
}
}
[Button]
void SetActiveConversation()
{
Conversation = SelectedConversation;
}