Frictional Games Forum (read-only)
Creating sounds? - 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: Creating sounds? (/thread-16796.html)



Creating sounds? - Lizard - 07-06-2012

Hey guys, yep it's me again.

It is my first time creating a map and my first time im working with scripting.
My second map of my cs is almost done.

All i need is an area that, when the player walks into it, starts the sound of a grunt and lets the sound run for about 10 seconds and then fades out again.


I've been looking around on the script site, i found two voids that might do the trick, but before doing anything i would like know from you guys if i have found the right voids.

The two i found was:

void FadeInSound(string& asSoundName, float afFadeTime, bool abPlayStart);


and

void StopSound(string& asSoundName, float afFadeTime);

I like to know if it are those two i have to use, and if it is how to set them up.
I would really appriciate your help


RE: Greating sounds? - Cruzore - 07-06-2012

You should use:

AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

and:

PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

FadeInSound could work too, but you don't want the grunt sound to be faded in, don't you?

If you need help at making a grunt sound only(normally it will choose the brute) refer to this page where I cleared it up:
http://www.frictionalgames.com/forum/thread-16326-page-7.html
(first post at that page is explanation + PlayMusic, and second post is for PlaySoundAtEntity)


RE: Greating sounds? - Lizard - 07-06-2012

(07-06-2012, 11:14 PM)FastHunteR Wrote: You should use:

AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

and:

PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

FadeInSound could work too, but you don't want the grunt sound to be faded in, don't you?

If you need help at making a grunt sound only(normally it will choose the brute) refer to this page where I cleared it up:
http://www.frictionalgames.com/forum/thread-16326-page-7.html
(first post at that page is explanation + PlayMusic, and second post is for PlaySoundAtEntity)
____________________________________________________________________________________

Yeah i guess the sound should be there instantly and not just be faded in, i see your point on that one.

So as understand, i just need an entity to combine the sound with?


RE: Creating sounds? - Cruzore - 07-06-2012

the entity is the thing you play the sound on. If you, for example, want to hear the sound at the end of a corridor, then you choose something there as the Entity. If you just want to hear it good, like if it could be anywhere, you can use "Player".


RE: Creating sounds? - Lizard - 07-06-2012

(07-06-2012, 11:25 PM)FastHunteR Wrote: the entity is the thing you play the sound on. If you, for example, want to hear the sound at the end of a corridor, then you choose something there as the Entity. If you just want to hear it good, like if it could be anywhere, you can use "Player".
I see your point.

I know it might be frustraiting, but this is just so im sure.

In this script: AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

"string& asParentName" could be "player" and "string& asChildName" could be "SoundArea_1" and
"bool abDeleteOnCollide" is if "SoundArea_!" should be deleted after the collide and int alState is if should when i enter or leave the area?

AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);


RE: Creating sounds? - Cruzore - 07-06-2012

You will have to place the callback inside OnEnter() or OnStart(), depends.
For the DeleteOnCollide, if the callback is called, the callback will be removed. That means it only activates once.


RE: Creating sounds? - Lizard - 07-06-2012

(07-06-2012, 11:41 PM)FastHunteR Wrote: You will have to place the callback inside OnEnter() or OnStart(), depends.
For the DeleteOnCollide, if the callback is called, the callback will be removed. That means it only activates once.
Okay, thanks man, this really helped me

One last thing, what script should i use to stop the sound, or will it stop by it self?