Frictional Games Forum (read-only)
[LVL ED] 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: [LVL ED] sounds (/thread-25484.html)



sounds - G510s - 06-16-2014

when i put in a sound into the game it playes the sound as soon i spawn into the map or level...there are 2 circles around the sound icon but idk if tht has anything to do with it.

PLEASE HELP!


RE: sounds - DnALANGE - 06-16-2014

You should try to script it..
Add a timer on OnStart.
""Dont know .. but you might want to use a collide function to activate the sound?""
Then add a scriptarea where you want that sound and that should do the trick.
That function is called : PlaySoundAtEntity("", YOURSOUNDFILEHERE.snt", "THE_NAME_OF_THE_SCRIPTAREA_FOR_YOUR_SOUND_HERE", 1.0f, false);


RE: sounds - Mudbill - 06-16-2014

In a manner that people can understand (no offense Dn), try using scripting instead of the sound objects in your Level Editor. Those are designed mostly for ambient sounds that loop in a certain location (for example fire, rain, critters etc).

You can play sounds easily using the script:
PHP Code:
PlaySoundAtEntity(stringasSoundNamestringasSoundFilestringasEntityfloat afFadeTimebool abSaveSound); 

If you place it within your script file's OnStart function, it will play immediately, just like the sound object. If you want it to play at a certain event, you must call it when that event is executed.

Okay, so let's say you want it to happen when you enter a doorway. First, place a ScriptArea where you want to collide to call it, then add a collision callback in OnStart, like this:

PHP Code:
AddEntityCollideCallback("Player""ScriptArea""PlaySound"true1); 

Player is the first entity, and ScriptArea is the second. Make that name match yours in the editor. The third string is the function name, which you can make whatever you want as long as it matches the name of the block you make:

PHP Code:
void PlaySound(string &in asParentstring &in asChildint alState)
{
    
PlaySoundAtEntity("""SoundFileName.snt""EntityName"0false);


The first string is just the internal name for the sound object. You can leave it blank. The SoundFileName.snt is the file of the sound you want to play. Pick a sound from the sounds folder or make one yourself. EntityName is where you want to play this sound. You can use Player if you want, or asChild to play it at the area they collided with, or just name it any entity you have in the level.