Quote from: Trademark on Tue 19/10/2010 16:13:19
After a bit more digging I made a text window box, but those seem to only apply to text that uses Display, not Say, nor does it take effect on dialog. Using Lucasarts like I said before. How do I make it apply to text that uses Say to display as well?
You will probably have to create a custom function to replace Say. This sounds hard, but once you've written the function it will be just as easy to implement as Say.
I have sort of the same thing in one of my projects. I have Sierra speech, but I wanted this frog character to speak Lucas-Arts style, so I had to do the speech manually. I wrote this function in my global script, exported it, and imported it to all other scripts through the .ash script header:
function frogtalk (String frogsays){ //the String frogsays replaces the string in Char.Say ("...")
short frogwords = frogsays.Length; // a variable that records the length, in characters, of what the frog will say
short textposition; //where will the text be on the screen (y value)?
short text_x; //how far the box should migrate to stay close to the talking frog
short textwidth; //how wide will the box be?
if (frogsays.Length < 40) { //i.e. it's a short statement less than 40 characters long
textposition =280; //the height, above the character
textwidth =frogsays.Length *10; //multiply number of characters by 10 (10 pixels per letter -seems to work) to get adquate text box width
text_x = 400 - textwidth; //moves the box over by a an amount dependent on how long the speech is, so that it stays next to the character's head.
}
else { //if what the frog says is more than 40 characters long...
textwidth =400; // effectively the maximum textbox width
text_x =0; // the box doesn't have to move sideways (in my game), but it's still at 200 (see below)
textposition = 280 - (frogsays.Length/4); //a formula for determining how far up to move it above frog's head.
}
cFrog.LockView (5);
cFrog.Animate (0, 0, eRepeat, eNoBlock); //a talking animation, without the talking
cFrog.SayAt (200 + text_x, textposition, textwidth, frogsays); //get string length +20...? //moves the INVISIBLE speaking portrait (remember Sierra style!) to next to visible character on screen.
cFrog.UnlockView (); //stops frog from animating mouth after speech is over
}
Now I just write frogtalk ("I talk like a frog!"); and it looks just like the frog character is talking in place.
Now I'm no expert coder so this is just to give you ideas. Obviously if you wanted to implement a multi-character text-box style talking bubble system you'd have to make this code more flexible (another variable at the top that relates character name or number and then reference it throughout the code so different characters can be called). You'll need to dynamically change the textbox corners into speech arrows. Also, moving characters would have to be taken into account with coordinates relative to character's positions (cFrog.x -150 instead of the absolute coordinates I could get away with), and you'll probably have to have several different scenarios depending on the speaking characters' locations on the screen (i.e. if they are too high on the screen you'll need to put the bubble below them, or if they are too far to the right the bubble will have to go the left, etc.). But once you get that all into the function it will work much as char.Say when you need to call it from your scripts.