Frictional Games Forum (read-only)
Need help with scripting music to areas - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Need help with scripting music to areas (/thread-24989.html)

Pages: 1 2


RE: Need help with scripting music to areas - Mudbill - 04-04-2014

(04-04-2014, 02:18 AM)Amn Wrote: .ogg may be called via .snt, as well as the rest of music/sounds in Amnesia.

Smile

Yeah, but the thing is that music was not originally called through an .snt file, so why use one? If it's just going to be simple background music it has no need to be more advanced than normal.

The reason I don't think background music would work well as an area effect is simply because it would fade away as you walked further away from the center. Music should be played as an ambient sound, that is if you don't want to do something really special with it. You CAN use area effects and probably make it work really well, but that is not the casual way of doing so, therefore I don't see why someone, especially a beginner, should make use of such.


RE: Need help with scripting music to areas - Wapez - 04-04-2014

Sound objects in the editor also has its range limit in the shape of a sphere, which rarely is the case for the shape of a room.


RE: Need help with scripting music to areas - DnALANGE - 04-04-2014

PHP Code:
AddEntityCollideCallback("Player""YOURAREAINTHEEDITOR""SoundatGarden"false0); 

PHP Code:
void SoundatGarden(string &in asParentstring &in asChildint alState)
{
if(
alState == 1)
{
PlaySoundAtEntity("STOPGARDENSOUNDS""YOUR.snt""Player"0false);
}

if(
alState == -1)
{
StopSound("STOPGARDENSOUNDS"3);// the number 3 is 3 seconds to fade out to no sounds.
}

Quote:*-*-* You should play a little bit around for the loops and loudness, this is just one of my examples i show to you.
---
What this does is :
IF you are INSIDE the scriptarea (in your editor) the music {Playsoundatentity} will be played.
then..
IF you are NOT inside the area anymore the sound will stop playing .. after the 3 seconds of fadeout.

THIS is a very heplfull thing, remeber this, you can do a lot with this function.

Good luck with your story.


RE: Need help with scripting music to areas - Daemian - 04-04-2014

(04-04-2014, 07:56 AM)Mudbill Wrote: The reason I don't think background music would work well as an area effect is simply because it would fade away as you walked further away from the center. Music should be played as an ambient sound, that is if you don't want to do something really special with it. You CAN use area effects and probably make it work really well, but that is not the casual way of doing so, therefore I don't see why someone, especially a beginner, should make use of such.
Cause it's easier for him to place a simple sound object than write a function.
Also, inside the .snt you can set the sound to Use3D=False. It stops the fade.
That's how Amnesia uses the ambient sounds.

(04-04-2014, 12:03 PM)Wapez Wrote: Sound objects in the editor also has its range limit in the shape of a sphere, which rarely is the case for the shape of a room.
Then set its range to cover the whole room?
If it leaks to another location like a hallway or another room and it's not what the guy wants then yeah, he should use another method.
But that doesn't mean sound objects don't work or can't play music.

(04-04-2014, 01:16 PM)DnALANGE Wrote:
PHP Code:
void SoundatGarden(string &in asParentstring &in asChildint alState)
{
if(
alState == 1)
{
PlaySoundAtEntity("STOPGARDENSOUNDS""YOUR.snt""Player"0false);

Great. I'd use PlayMusic but your way seems to do the same.