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
** SOLVED ** No sound when unlocking door?
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#1
Wink  ** SOLVED ** No sound when unlocking door?

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");

}
(This post was last modified: 05-01-2013, 06:32 PM by FurtherGames.)
05-01-2013, 05:53 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#2
RE: No sound when unlocking door?

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)
(This post was last modified: 05-01-2013, 06:15 PM by OriginalUsername.)
05-01-2013, 06:13 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#3
RE: No sound when unlocking door?

(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)
05-01-2013, 06:24 PM
Find
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#4
RE: ** SOLVED ** No sound when unlocking door?

Try this:

PHP Code: (Select All)
PlaySoundAtEntity("","unlock_door.snt","Player" or "doorname",0.1f,true); 
(This post was last modified: 05-01-2013, 06:35 PM by Tomato Cat.)
05-01-2013, 06:35 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#5
RE: ** SOLVED ** No sound when unlocking door?

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

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

I solved it, but thanks anyway. Smile
05-01-2013, 06:35 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#6
RE: ** SOLVED ** No sound when unlocking door?

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
(This post was last modified: 05-06-2013, 02:13 AM by OriginalUsername.)
05-01-2013, 06:41 PM
Find




Users browsing this thread: 2 Guest(s)