Frictional Games Forum (read-only)
** SOLVED ** No sound when unlocking door? - 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: ** SOLVED ** No sound when unlocking door? (/thread-21355.html)



** SOLVED ** No sound when unlocking door? - FurtherGames - 05-01-2013

Hello. Everything inside my first map is working perfectly, apart from the sound that is supposed to play when I insert a key into a swing door. The door does unlock, but no sound is heard.

HPS File:

void OnStart()
{
AddUseItemCallback("", "Key1", "masion_Door", "DoorUnlockKey", true);
}

void OnEnter()
{

}

void OnLeave()
{

}
void DoorUnlockKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("masion_Door", false, true);
PlaySoundAtEntity("unlock.door.snt", "unlock_door", "masion_Door", 150, false);
RemoveItem("Key1");

}



RE: No sound when unlocking door? - OriginalUsername - 05-01-2013

the playsoundatentity is wrong, it should be more like this:

PlaySoundAtEntity("", "unlock_door", "Doorname", 0, true);

The number is the time the sound takes to fade. The file isn't even 150 seconds long, so that's a problem.
The boolean is whether the sound should remember itself when it's looping and you're leaving/entering. It also won't attach to an entity when false. (I believe)


RE: No sound when unlocking door? - FurtherGames - 05-01-2013

(05-01-2013, 06:13 PM)Smoke Wrote: the playsoundatentity is wrong, it should be more like this:

PlaySoundAtEntity("", "unlock_door", "Doorname", 0, true);

The number is the time the sound takes to fade. The file isn't even 150 seconds long, so that's a problem.
The boolean is whether the sound should remember itself when it's looping and you're leaving/entering. It also won't attach to an entity when false. (I believe)


I was told the number (150) is how loud the sound plays. Where do I put the "unlock_door.snt" (That is the sound file)


RE: ** SOLVED ** No sound when unlocking door? - Tomato Cat - 05-01-2013

Try this:

PHP Code:
PlaySoundAtEntity("","unlock_door.snt","Player" or "doorname",0.1f,true); 



RE: ** SOLVED ** No sound when unlocking door? - FurtherGames - 05-01-2013

(05-01-2013, 06:35 PM)Mr Credits Wrote: Try this:

PHP Code:
PlaySoundAtEntity("","unlock_door.snt","Player" or "doorname",0.1f,true); 

I solved it, but thanks anyway. Smile


RE: ** SOLVED ** No sound when unlocking door? - OriginalUsername - 05-01-2013

asSoundName - internal name
asSoundFile - the sound to use + extension .snt
asEntity - the entity to create the sound at, can be “Player”
afFadeTime - time in seconds the sound needs to fade. Avoids enemies hearing the sound if afFadeTime is at least 0.1f
abSaveSound - if true, a looping sound will “remember” its playback state (currently playing/stopped), and that state will be restored the next time the level is entered. If true, the sound is never attached to the entity! Note that saving should only be used on looping sounds!

And you don't need the .snt after unlock_door.snt You do need it for other sounds though. And it wouldn't harm if you did, you just don't need it.

Edit: oops, a little too late