I was many times already asked how I did in Ghost in the Sheet the talk window. So I've decided to share the code. Basically it works like this. I have a couple of images with special characters (Larisa, Scott etc.) named approprietly.
when my Talk method is called, it takes 3 parameters: srcString (line to speak), srcActor (which is used to select propper image for the speaking character and xPosition which sets the
start of the talk text block (some images are at the beginning of the window, some at the end).
As most of the lines are spoken by Ghost, the defaults are set to the window so you can call it like
Ghost.Talk("blabla");
if you need reply from Larisa, it would be:
Ghost.Talk("blablabla", "larisa", 500);
method Talk(srcString,srcActor,xPosition
) {
var twin;
if (srcActor == null) twin = "talk"; // basic window with ghost
else
twin = srcActor; // NPC window
Game.
Interactive =
false;
// we save the interactivity state for later and turn it off
var dlgWin =
Game.
LoadWindow("windows\dlgWindow.window");
// load the dialogue window var tString =
Game.
ExpandString(srcString
);
// prepare the localized string to handle formatting var lines =
ToInt(tLength /
300) +
1;
// find out how many lines will we need
dlgWin.
SetImage("windows/"+twin+
".png");
// set the image
// set the caption parameters
talkRobotEnt.SubtitlePosRelative = false;
talkRobotEnt.
SubtitlesPosY =
630 +
15* lines;
// position the caption in the window based on number of lines
talkRobotEnt.
SetFont("fonts\verdana.font");
// set the speech font
talkRobotEnt.
SoundPanning =
false;
// make the sound centered talkRobotEnt.
Talk(srcString,
null,
"",
"",
0);
// say the line
}
Nowadays I'd make it a bit differently, but you get the idea...