I do not actively use C2 (Have a business license though), but this method should be easy to port over to C2.
Basically, I store dialogue in a JSON file and load the files (Via a 'GET' request) into memory when a new level is loaded. The JSON base structure is like so:
http://aurava.com/labs/code/dialogueTree/dialogue.txt
the "messages" array stores the dialogue the NPC says. The "setState" property tells the script which index of "messages" to go to when the player advances through the dialogueTree. The "responseIndex" property tells the script which response text to display, stored in the "responses" array, with -1 meaning their are no player responses for that message.
The "responses" array works the exact same as the "messages" array. It has a setState property and a "message" property. The "message" property is the actual text to display. The setState property sets the message index to that value, advancing the dialogue.
Here is a (very) rough example of it in action: http://aurava.com/labs/dialogueTree/
Once you have the basic structure down, then you can expand the JSON file and have advanced things, such as showing certain responses depending on a global variable or anything really.
It is also very simple to implement, this is the draw text code, located in my update() function:
this.font.draw( this.data.messages[this.currentIndex].message, x, y );
// Draw responses, if applicable
if(this.data.messages[this.currentIndex].responseIndex.length > 1 || this.data.messages[this.currentIndex].responseIndex[0] >=1 ){
for (var i = 0; i < this.data.messages[this.currentIndex].responseIndex.length; i++){
var response = this.data.messages[this.currentIndex].responseIndex[i]
this.font.draw(this.data.responses[response].message, 80, 10 *i);
}
}
Where: this.data is the parsed JSON file. this.currentIndex is the location within the dialogueTree file (Keeping track of which message to display)
and here is the code for moving around within the dialogueTree file, not including the actual movement code which should be self explanatory anyway (Push down, add one to this.index. Push up, subtract one from this.index.)
this.response = this.data.messages[this.currentIndex].responseIndex[this.index];
this.currentIndex = this.data.responses[this.response].setState;
this.index = 0;
Where: this.index = the location of the cursor and this.response = the index value of the response the player chose.
I believe Construct 2 comes with a simple AJAX plugin out of the box that has 'GET.' You can use that to download your JSON file. I am not sure if it has built-in compatibility to parse the JSON file out of the box, but I'm sure something exists.
I'm sure someone could convert this into a Construct 2 plugin quite easily.
Best,
Ty.
EDIT: I just realized this was posted in the Construct Classic section (Whoops :D). The post above still applies, but instead of using 'GET' you can use XML or something and then just load the file directly.