[SOLVED] Creating a fixed speech/dialog/think gui using Lucasarts style speech

Started by shaun9991, Wed 13/05/2015 14:35:17

Previous topic - Next topic

shaun9991

Hi guys,

I've spent a lot of timing today trawling the forums but I don't think I've quite found the answer, so I'm wondering if anybody can help me -

Is it possible to keep LucasArts style animated speech and dialog (for Player.Say and Player.Think, and for NPCs), but have the actual text displayed in a constant place on the screen, with a fixed semi transparent background GUI behind the text? Like how dialog appears in an RPG game, minus the typewriter effect?

Any help would be much appreciated. I've done thousands of lines of dialog already before realising I should probably change this now, before it becomes too big a job to go back to!

Thanks,

Shaun
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Snarky

Obvious question, perhaps, but have you tried Character.SayAt()?

shaun9991

Hi Snarky!

Yes, I'm aware of that - it's more about having a background behind the text to make it easier to read.

For example - in the General Settings, I've added a custom thought bubble GUI - which makes Player.Think look like this:



Would it be possible for a similar Text GUI to display the text when SAY command happens (and speech animation continues)?

This could appear above the head of the person talking, like this picture, not necessarily at a constant fixed position as I said in my first post.

Any help much appreciated,

Thanks
Shaun
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Snarky

Hmmm... It's a little bit tricky, I think.

You can't make LucasArts-style speech display with a background, so you'll have to add that yourself. So you'll need a helper function, probably an extender function, something along the lines of Character.SayBackdrop(). But the problem is that you can't get the dimension of the displayed Say()-text from AGS, so you won't know what size to give it.

The best workaround I can think of is that you display the text yourself in a GUI with a label, which gets displayed whenever a character is speaking (using a helper function, again), while making the automatic LucasArts-style text invisible. You might be able to do that by setting SayAt() to some coordinates way off-screen, but if that doesn't work you could also create a blank font and set it as the speech font, so that the text is invisible. (Or as yet another alternative, you could not use the built-in Say() function at all, but in that case you have to handle animation, text timing and text progression yourself.)

PS: I sent you a PM a while back. It would be great if you could fill in the (short!) survey I linked to.

shaun9991

Thanks for the tips Snarky, they helped me manage to work it out :) (Sorry for the delay with the survey too, I did that as soon as I saw your message today :) )

I used this, and it works well!

Code: ags
void Saying(this Character*, String message) {
  lSaying.Text = message;
  gSaying.Visible = true;
  lSaying.TextColor = 65535;
  this.Say(message); 
  gSaying.Visible = false;
}


I created a few variants with different text colours to use for NPCs, to help differentiate who is talking.

Thanks,
Shaun
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Snarky

Great and great! To get different text colors I'd personally just use the value of the Character.SpeechColor property; that way you can simply set it in the editor. Or you could make it a parameter of the function. I don't think creating separate functions for different colors is a good idea, unless they have some significantly different semantic meaning (e.g. a different color for thoughts vs. speech).

shaun9991

Thanks for the tip! It doesn't seem to work though, as the character speech is essentially made invisible, with the text now showing in the GUI on a label. Do you think there is anyway of setting a function for each character in the game, which defines what colour the labeltext would be if they are speaking?

Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

geork

Wouldn't this work?
Code: ags
lSaying.TextColor = this.SpeechColor;
I think that's what Snarky meant - Setting the color (or colour, if spelled correctly ;) ) of the label's text to that of the relevant Character's speech colour?

If not, for whatever label you need to have the color changed for, the same principle applies.

shaun9991

Ahh, I see :) I'm a bit slow sometimes.

Massive thanks to Snarky and Geork!!! - this now works perfectly :)

Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

SMF spam blocked by CleanTalk