Frictional Games Forum (read-only)

Full Version: ** SOLVED ** No sound when unlocking door?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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");

}
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)
(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)
Try this:

PHP Code:
PlaySoundAtEntity("","unlock_door.snt","Player" or "doorname",0.1f,true); 
(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
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