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
Need help with scripting music to areas
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#11
RE: Need help with scripting music to areas

(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.

04-04-2014, 07:56 AM
Find
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#12
RE: Need help with scripting music to areas

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.

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
04-04-2014, 12:03 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#13
RE: Need help with scripting music to areas

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

PHP Code: (Select All)
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.
(This post was last modified: 04-04-2014, 01:29 PM by DnALANGE.)
04-04-2014, 01:16 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#14
RE: Need help with scripting music to areas

(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: (Select All)
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.

04-04-2014, 05:43 PM
Find




Users browsing this thread: 6 Guest(s)