== How to use interactive dialogs in level files ==
This tutorial will show you how to implement dialog boxes in a level file.
Example: DialogShowcase.oxw
== Create an event & trigger ==
First open the xml file of the level you want your dialog to appear in.
In order to start a dialog you will need an event which is triggered. You can for example create a distance trigger (plus a light so that you see where it actually is) that you fly through like this:
{{{
}}}
You should now see a violet light appearing in the game when loading empty level.
== Basis Dialog Structure ==
But when flying through it doesn't do anything yet, so let's add a first dialog. The basic structure looks like this:
Name should be the name of the person you want the player to talk to and currentQuestionId will be the starting point of the conversation
{{{
}}}
The Questions and Answers part will be explained below.
The event part enables the dialog to be executed once the trigger is activated. Multitrigger does not work yet, because the dialog is not reset on leaving.
== Adding Text to your Dialog ==
A dialog without text would be prettey boring so we now will add text for the npc you are talking to and some replies.
In the interface a question is always some text the npc says and an answer is one possible option for the player to reply.
By linking the answers to a next question you can define how the npc reacts to the player saying someting. For the player you simply give the question all ids of the possible answers he could give.
You need to give each question and each answer a unique id but multiple answers can lead to the same question and multiple questions can give the same answer as an option.
Structure of question section:
{{{
...
... list all questions in this area with the template from above
...
}}}
By giving no answerIds you can end the Dialog with a npc text.
Structure of answer section:
{{{
...
... list all answers in this area with the template from above
...
}}}
If you want to end the dialog on a player response simply chose a nextQuestionId that does not exist, best would be to always use the same (for example "end") but any string that is not a questionId will do.
For both Question and Answer class it is possible to rearange the arguments but for readability and ease of use i recomend always defining ids befor text.
== Example of a simple dialog ==
This is a simple example how everything together could look like but there are many more possibilities to use this structure.
(And probably more creative texts for those too) This can also be found in the DialogShowcase level to test it directly.
{{{
}}}
Now you know all the basics and can try it for your self, go have fun with it!