is it somehow possible to change the order of choices in the MultipleChoice node of DialogueTrees?
I often have several choices in my dialogue trees that are ordered “logically” based on their tone. But when I want to add a choice at a later stage it automatically gets added to the bottom of the list and I can’t find a way to change its position other then deleting all choices that are “above” it.
Usually the choices are ordered in the way the outgoing connections are ordered. Did you try moving the outgoing nodes? That should reorder the choices, too.
how do I reorder the outgoing connections? All I can achive is to change which choice leads to which answer, but the order of the choices stays the same (#8 allways stays at the top in the gif and is also the first choice in game no matter what).
Ah I see, from my experience it’s not possible to reorder the actual list of choices on the multiple-choice node. But from looking at MultipleChoiceNode.cs it should be relatively easy to implement reorder up/down buttons, as the availableChoices list just needs to be reordered.
Edit: It actually is very easy. Open up MultipleChoiceNode.cs and after
1
2
3
4
5
6
7
8
9
if(GUILayout.Button("X",GUILayout.Width(20)))
{
availableChoices.RemoveAt(i);
if(i<outConnections.Count)
{
graph.RemoveConnection(outConnections[i]);
}
}
add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
GUI.enabled=i>0;
if(GUILayout.Button("UP",GUILayout.Width(30)))
{
varprevious=availableChoices[i-1];
availableChoices[i-1]=availableChoices[i];
availableChoices[i]=previous;
}
GUI.enabled=i<availableChoices.Count-1;
if(GUILayout.Button("DN",GUILayout.Width(30)))
{
varprevious=availableChoices[i+1];
availableChoices[i+1]=availableChoices[i];
availableChoices[i]=previous;
}
GUI.enabled=true;
That does allow you to reorder the choices with two buttons, moving the choice up or down. I haven’t tested the behaviour at runtime though, maybe the connections and the attached conditions won’t get reordered properly, even though in the graph editor it all seems to be correct.
Thanks for the code.
It still isn’t the most user friendly approach but it does the trick.
@GAVALAKIS it would be nice if you could add something like this into the next release.
And I’ve noticed that the X button (and the added “UP” and “DN” buttons) do not show if the statement of a choice is too long.
So I’ve added this for now: