Unturned

Unturned

Not enough ratings
NPC Dialogue In-Depth Guide
By dark sun gwyndolin
This guide will teach you the functions of the parameters in NPC dialogues, as well as how to use them to create a dialogue.
   
Award
Favorite
Favorited
Unfavorite
Introduction
NPC dialogues are very complex. But in this guide I will explain how to create dialogues by yourself without copying other files from the game. I will explain each and every single parameter in NPC dialogues, and how to use them.
Asset.dat File
The asset file in NPC dialogues is what defines how many messages there are in the dialogue, how many pages belong to each message, how many reponses there are, as well as what happens if the player picks that response.

The first function:
Messages

In the assets file, you will find the word "Messages" and a number beside it. This function defines how many messages there are that the NPC speaks out. An example is shown below.
Messages 5
This means that there are 5 messages that the NPC speaks out in the dialogue section, which is in the English.dat file.


The second function:
Message_n_Pages n

This function defines how many pages there are in a message. "n" stands for the message number. An example is shown below:
Message_2_Pages 1
This means that in message number 2, there is only one page of text. Note that numbers in these files start from 0


The third function:
Responses

This function defines how many responses there are in the English.dat file. An example is shown below:
Responses 4
This means that there are four responses in the English.dat file.

The fourth function:
Response_n_Dialogue n

Again, the "n" substitutes a number which stands for which response, and the second "n" stands for a dialogue ID. An example is shown below.
Response_0_Dialogue 9702
What this means is that if the player picks the first dialogue, which is dialogue 0, the NPC will switch to Dialogue code 9702. This means that this dialogue is inside a different folder, and is a different dialogue section.

The fifth function:
//Hello! What's your name!

The // at the front stands for "comment". The asset file uses HTML coding, and in HTML, "//" means the game does not read it, and it's only for the person that's reading the file at the moment. For example:
//Hello! What's your name? Response_0_Dialogue 9723
You can see here that the code-writer used the "//" function to tell which one "Response 0" is. In this case, "Response 0" is "Hello! What's your name?"

Extras:
"Type"
Type Dialogue
This function tells the game what type of file this is. In this case, it's telling the game that it's a Dialogue file.

"ID"
ID 9723
Obviously, this tells the game what the ID of the Dialogue section is. In this case, the ID is 9723.

Completed dialogue asset file example:
Type Dialogue ID 9723 Messages 2 Message_0_Pages 2 Message_1_Pages 1 Responses 1 //Who are you? Response_0_Dialogue 9724
As you can see, it says that the ID of the file is 9723, and the Type is a Dialogue. There are 2 Messages and in message 0, or the first message, there are 2 Pages, on the second message, or message 1, there is 1 Page. There is only one Response in the dialogue section, and that is "Who are you?" told by the // or comment function. And if the player picks that, it switches over to the dialogue file with ID 9724.
English.dat File
The English.dat file is what the Asset.dat file reads to make sure that it's the correct dialogue file. The data in Asset.dat has to match with the English.dat, so for example if the Asset.dat says
Messages 5
, then there should be 5 messages in the English.dat file.

In Dialogues, the English.dat file contains a few functions:

The first function:
Message_n_Page_n <message>
This function defines what message and what page of that message that the message belongs to. There can be multiple pages in one message. An example is shown below.
Message_0_Page_0 Welcome to the Blue Moon Inn. Message_0_Page_1 How may I help you?
That shows the NPC welcoming the player to the Inn, and then once the player presses "F" it goes on to the next page, which is the NPC asking them "How may is help you?"

The second function:
Response_n <response>
This function defines which one the written response is. An example is shown below:
Response_0 Who are you? Response_1 May I get a reservation please? Response_2 Go away!
You can see that this gives the player a bunch of options to choose from to reply to the NPC.

Completed English.dat File Example:
Message_0_Page_0 Welcome to the Blue Moon Inn. Message_0_Page_1 How may I help you? Response_0 Who are you? Response_1 May I get a reservation please? Response_2 Go away!
You can see here that all you have to do is put the messages section on top and responses on the bottom. It's really this simple for dialogues only.
Combining Asset.dat and English.dat
Combining these two is really simple. Below is an example of two connected ones.

Asset.dat:
Type Dialogue ID 9723 Messages 1 Message_0_Pages 2 Responses 3 //Who are you? Response_0_Dialogue 9724 //May I get a reservation please? Response_1_Dialogue 9725 //Go away! Response_2_Dialogue 9726

English.dat:
Message_0_Page_0 Welcome to the Blue Moon Inn. Message_0_Page_1 How may I help you? Response_0 Who are you? Response_1 May I get a reservation please? Response_2 Go away!

Again, note that the FIRST dialogue, or response is identified as "0" in the dialogue files. This is a working example of Asset.dat and English.dat, and you can basically copy them into your own folders to test and experiment with. That's all for this guide. Thanks for reading.
13 Comments
dark sun gwyndolin  [author] Nov 30, 2017 @ 9:55am 
@Cpt.Adam
Send me a pastebin link to your code.
DareOrBeDared Jan 9, 2017 @ 10:55am 
Alright. I did. I'll wait till you're online.
dark sun gwyndolin  [author] Jan 8, 2017 @ 5:39pm 
@DareOrBeDared

Yeppie. Friend request me and we'll work it out.
DareOrBeDared Jan 8, 2017 @ 7:23am 
I'm still nowhere near what I want to do.. Help?
dark sun gwyndolin  [author] Nov 11, 2016 @ 7:05am 
@Payne_Smith
Haha, np!
Message me any time you need help :)
Payne Smith Nov 11, 2016 @ 7:04am 
It works, I just need to be less of an idiot and put the underlines right and remember that dialogues start with 0, not 1.
Thank you again OP!
dark sun gwyndolin  [author] Nov 11, 2016 @ 6:39am 
@Payne_Smith
It should still work, new files use the same syntax. Check your files for errors.
Payne Smith Nov 11, 2016 @ 6:30am 
Is this no longer working? I cannot get responses to start new dialogues with that syntax.
Sneaky Oct 26, 2016 @ 5:19am 
Already did.
And for a fact, I practically never do it!
dark sun gwyndolin  [author] Oct 26, 2016 @ 5:13am 
@Sneaky
Good to hear that it helps you!
If it's not too much to ask, I'd appreciate if you can rate up and favorite the guide! :)