Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved]Playing sound after exiting letter
Omenapuu Offline
Junior Member

Posts: 31
Threads: 8
Joined: Oct 2013
Reputation: 1
#1
[Solved]Playing sound after exiting letter

Hello! So basically I want to play this sound after the player closes the letter after opening and reading it. Right now it plays immediately after opening it, since it's set to do so when the player interacts with the letter. I don't see a smart way of using timers here, since people have different reading speeds etc.

ATTENTION: I noticed that it plays after closing when using the "PlaySoundAtEntity" instead of "PlayGuiSound". The problem here is that the sound plays too quietly which is why I would like to use "PlayGuiSound".
(This post was last modified: 10-02-2016, 10:32 AM by Omenapuu.)
09-30-2016, 09:26 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Playing sound after exiting letter

Have you actually tried using timers? As in, AddTimer("", 0.01f, "TimerPlaySound");

I think timers freeze up during GUI interaction like a note, so adding a very short one should trigger as soon they exit the note.

(This post was last modified: 10-01-2016, 12:54 AM by Mudbill.)
10-01-2016, 12:54 AM
Find
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#3
RE: Playing sound after exiting letter

Unfortunately, the whole point of GUI sound is that it is played along with the GUI layer.

Using PlaySoundAtEntity is your best bet.
You can modify the volume in your .snt file
or perhaps even edit the source .ogg file with some software like Audacity.

You can also play the sound at "Player" instead of an entity to make it as loud as GUI sound. (if the .snt file doesn't cap it)

Now, Mudbill's solution DOES work. But I would argue that it's not the cleanest way. Consider using PlaySoundAtEntity with your sound tweaked a little in a single line instead of timers.
(This post was last modified: 10-01-2016, 08:45 AM by Spelos.)
10-01-2016, 08:43 AM
Find
Omenapuu Offline
Junior Member

Posts: 31
Threads: 8
Joined: Oct 2013
Reputation: 1
#4
RE: Playing sound after exiting letter

Thanks both of you!
I already played the sound at "Player" but I guess I'll just modify the volume of it by placing it down in the map, if that's what you meant?
(This post was last modified: 10-01-2016, 12:49 PM by Omenapuu.)
10-01-2016, 12:46 PM
Find
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#5
RE: Playing sound after exiting letter

Not really,
since PlaySoundAtEntity() supports only .snt files, you can take a look into the .snt file you want to be played and there are values like "Volume=0.8", those can be changed. You can open it with any text editor.

If the .snt file is from original Amnesia, you can just create a copy, name it differently,
(for example 01_door_creak_custom.snt instead of 01_door_creak.snt)
and you are free to make changes. Just remember to call your custom .snt file instead of the original one in the PlaySoundAtEntity function.
10-01-2016, 04:44 PM
Find
Omenapuu Offline
Junior Member

Posts: 31
Threads: 8
Joined: Oct 2013
Reputation: 1
#6
RE: Playing sound after exiting letter

(10-01-2016, 04:44 PM)Spelos Wrote: Not really,
since PlaySoundAtEntity() supports only .snt files, you can take a look into the .snt file you want to be played and there are values like "Volume=0.8", those can be changed. You can open it with any text editor.

If the .snt file is from original Amnesia, you can just create a copy, name it differently,
(for example 01_door_creak_custom.snt instead of 01_door_creak.snt)
and you are free to make changes. Just remember to call your custom .snt file instead of the original one in the PlaySoundAtEntity function.

Ohhhhh! Thought I needed some kind of a program to do that instead of it being that easy :o Thanks again man!
10-02-2016, 10:31 AM
Find




Users browsing this thread: 2 Guest(s)