Page 1 of 1

Playing a SFX on a Conversation Node

Posted: Thu May 11, 2017 3:33 pm
by HawkX
Hi again! :)

I am trying to figure out the easiest way to play a single SFX on a specific conversation node without affecting timing of my subtitles or anything...

I went through viewtopic.php?f=3&t=840&hilit=sound but that one was for a 3d game with actual characters gameobject...

Since you played my game i imagine you have a pretty good understanding of how it could be possible ;)

I already have a SFX manager which has 2 audiosource and is in charge of playing every SFX in the game... whenever I need to play something i simply call :
FindObjectOfType<SFXManager> ().SFX_SelectStage ();

while replacing SFX_SelectStage by the one containing the appropriate SFX ;)

I have done Lua when I was Cinematics Designer at Funcom but it was mostly for creating cinematics, moving camera and characters, etc... so i dont really know how that would fit in...

As always, thanks infinitely for your time!! :)

Re: Playing a SFX on a Conversation Node

Posted: Thu May 11, 2017 4:15 pm
by Tony Li
You can use the SendMessage() sequencer command to invoke methods on a GameObject. For example, let's say your SFXManager script is on a GameObject named "SFX Manager". Set the node's Sequence to something like:

Code: Select all

SendMessage(SFX_SelectStage,,SFX Manager);
Delay({{end}})
The Dialogue Manager's Default Sequence defaults to Delay({{end}}). If your Default Sequence is different, replace the line above.

The SendMessage() command above finds the GameObject named "SFX Manager" and calls its SFX_SelectStage() method. Note that there are three parameters. The middle parameter is blank. This is an optional string that you can pass to a method. For example:

Code: Select all

SendMessage(SFX_PronounceName,George,SFX Manager)
would call SFXManager.SFX_PronounceName("George").

If you don't want to use SendMessage(), you could write a custom sequencer command. They're really easy to write, and the Dialogue System includes a starter template file that you can copy.

Re: Playing a SFX on a Conversation Node

Posted: Fri May 12, 2017 4:28 pm
by HawkX
Hi again! :)

Havent had time to test it until now... insane day (as are often most friday's somehow) :P

I actually came here to ask a followup... but instead of asking, i tried it first...

since my SFXManager script is on a super huge "dont destroy on load" gameobject which has ALL of my managers (sfx, music, combat, daily rewards, inventory, etc...) had to call DND instead in the sequence... and i added the bottom part with my "default sequence"

AND IT WORKS!! :D

SendMessage(SFX_WinGame,,DND);
Delay([var=finalDelay])@{{end}}

That is seriously amazing! :) The stuff I can do with that now!! :)

Thanks a lot! as always!

Re: Playing a SFX on a Conversation Node

Posted: Sat May 13, 2017 12:13 am
by Tony Li
Awesome! :-)