As title of this topic says I want to use external text files to store dialouge lines for my heroes and NPCs instead
using default Show Text... event. And I've already made it working so no technical issues here, but my question is
How much this would cause potential issues with game?
And here it is I've made:
First I made a js file containing following functions:
And in event editor instead using Show Text event i just call script (function) SayMessage(); Like This
I decided to use that method to use dialouges because everyone who played demo tells the same - Dialouges needs to be improved (grammatic errors / mistakes) since my english is a little bit rusty and twisted by watching anime with fan-made subtitles.
using default Show Text... event. And I've already made it working so no technical issues here, but my question is
How much this would cause potential issues with game?
And here it is I've made:
First I made a js file containing following functions:
Code:
/* obtain text from a file */
readTextFile = function(filename)
{
var xhr = new XMLHttpRequest();
xhr.open("GET",filename,false);
xhr.send(null);
var fileContent = xhr.responseText;
return fileContent;
}
/* split it into array by new line */
splitMessage = function(txt){
var source = txt.split("\n");
return source;
}
/* display that line in game */
SayMessage = function(actorFace, faceIndex, type, pos, dialougeFile, lineNum){
var msg = readTextFile('./data/dialouges/'+dialougeFile);
var line = splitMessage(msg);
$gameMessage.setFaceImage(actorFace, faceIndex);
$gameMessage.setBackground(type);
$gameMessage.setPositionType(pos);
$gameMessage.add(line[lineNum]);
}
And in event editor instead using Show Text event i just call script (function) SayMessage(); Like This
I decided to use that method to use dialouges because everyone who played demo tells the same - Dialouges needs to be improved (grammatic errors / mistakes) since my english is a little bit rusty and twisted by watching anime with fan-made subtitles.