Run something when .Say() is called

Started by Gurok, Mon 29/09/2014 03:52:02

Previous topic - Next topic

Gurok

Hello,

In my game, I have a small overlay that appears whenever the player scores a point. After a while, the overlay fades out, but I'd like it to fade out immediately if the player starts talking to someone. I don't want to write a custom Say method because I don't want to break the Create Voice Acting Script feature. For the moment, I've resorted to an extra function call before any .Say() commands:

Code: ags
Dialog.StartConversation(); // Special method to see if the overlay is visible and fade it out.
cShelly.Say("Good morning, how are you today?");
cJeanette.Say("Grumpy as always.");
cShelly.Say("Gosh!");


Unfortunately, this is prone to error. It's really easy to miss a conversation and it's rather hard to search the source for the start of a conversation. Is there something like an "on_say" event in AGS that I could use instead? Is there another way I could do this without breaking Create Voice Acting Script?
[img]http://7d4iqnx.gif;rWRLUuw.gi

Cassiebsg

Calling yourself a beginner sounds kind of weird...
Anyway, if what I'm writing is redundant, just ignore me.

But maybe you could just handle all dialog in dialog script and use no Say commands?
Don't know if it would solve your problem, or just add to more work thought... Just a thought.
There are those who believe that life here began out there...

Khris

The only thing that comes to mind: in rep_exe_always, if the overlay is visible, iterate through the current room's characters and check if any of them is .Speaking

monkey0506

Agreed with Khris. That's essentially what a built-in event would be doing anyway, but no, there isn't one built-in.

Alternately you could pair what Cassie said with custom dialog rendering. It looks like what you're doing (calling Say before starting the dialog) could probably be moved into the dialog's starting point (in the dialog script) and then you could check in dialog_options_get_dimensions to fade the overlay out before displaying the options.

Gurok

Okay, this is probably not the most generally applicable solution. I ended up handling it with my version of the GotThere module. As most dialogues occur on interactions, I was able to cover maybe 99% of cases by hiding the overlay immediately before running an interaction for the second time. For the other cases, I guess I'm happy to call the function directly for now.

Thanks for the ideas, particularly about the custom dialog rendering. That got me thinking and ultimately led to a better result. I tried the repeatedly_execute_always method, but I wasn't satisfied with the results. I needed to run it in a blocking function so that it disappeared before the conversation started.
[img]http://7d4iqnx.gif;rWRLUuw.gi

RickJ

Quote
I don't want to write a custom Say method because I don't want to break the Create Voice Acting Script feature
Have you considered a custom say method that fades out the overlay and then calls the standard Say method? Wouldn't this preserve the voice acting feature?

monkey0506

Rick, the voice acting system doesn't work with custom say functions (including extender methods). Any time the Character* in front of the Say method is variable, the voice acting system ignores those lines AFAIK. It only works with the predefined (in the editor, at design-time) script names:

Code: ags
cEgo.Say(...); // voice acting sees this

void SayStuff(this Character*)
{
  this.Say("STUFF"); // voice acting ignores this! :(
}

cEgo.SayStuff(); // voice acting doesn't see this either :(

RickJ

Thanks for the explanation Monkey.  Gurok had very likely considered and rejected such an obvious solution but I don't have much experience using the voice acting thing and was curious about the details.   

SMF spam blocked by CleanTalk