Custom Say Function/Display Top Bar

Started by chucklas, Tue 01/05/2012 00:30:34

Previous topic - Next topic

chucklas

I am working on a game where some characters have sierra style portraits and others do not.  I want those without portraits (minor characters) to speak using the DisplayTopBar look.  The issue I am having is that the voiced lines for displayTopBar are linked to EGO voice files and I I cannot change the x position of the box.  I would like to either find a way to modify that function or make a custom say function that would put the character's name in a box above the text they are saying.  I currently am using a single transparent pixel for the dialog portrait but would love to get the name above the text box.  Anyone have an idea how I should go about this?  Thanks!

Khris

You can always create your own say function, but you can't replace the built-in one.
In dialog scripts, you'd have to always use:
Code: ags
 player.MySay("blah");

instead of
Code: ags
player: blah


Use this as a starting point:
Code: ags
// add this line to GlobalScript.ash
import void MySay(this Character*, String message);

// top of GlobalScript.asc
void MySay(this Character*, String message) {
  // this.Say(message);  // use parameters like this
  // your custom say code here
}


(In case you're wondering, the function keyword is just a substitute for int, but since the function doesn't return a value, we might as well use void.)

chucklas

I totally get making my own Say function.  What I am unsure of is this, I would imagine that I would need to use the built-in Say function as part of my custom one.  All I would then want to do is to create a black box with the character's name written above the text box that is generated and have it go away when the player clicks or hits a key...etc.  My issue now becomes how can I determine the size and location of the text box generated with the built in say function?  According to the manual, the size is automatically calculated, but I cannot find a way to either find the values that are calculated or how I would calculate them myself in order to determine the size of the bar needed to the placed above the text box.

Khris

I don't think using the built-in Say function is the way to go.
Manually coding Sierra's speech boxes is pretty easy, I'd use a GUI, a label, the GetTextWidth/Height function and WaitMouseKey().

SMF spam blocked by CleanTalk