FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
** 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 |
|
OriginalUsername
Posting Freak
Posts: 896
Threads: 42
Joined: Feb 2013
Reputation:
34
|
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)
|
|
05-01-2013, 06:13 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
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 |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: ** SOLVED ** No sound when unlocking door?
Try this:
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 |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: ** SOLVED ** No sound when unlocking door?
(05-01-2013, 06:35 PM)Mr Credits Wrote: Try this:
PlaySoundAtEntity("","unlock_door.snt","Player" or "doorname",0.1f,true);
I solved it, but thanks anyway.
|
|
05-01-2013, 06:35 PM |
|
OriginalUsername
Posting Freak
Posts: 896
Threads: 42
Joined: Feb 2013
Reputation:
34
|
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
|
|
05-01-2013, 06:41 PM |
|
|