![]() |
sound question - 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: sound question (/thread-17371.html) |
sound question - Soverain - 07-31-2012 Okay guys, I created a script where a head will appear upon picking up a key. My question is how do I make the scream sound? I imagine it would be similar to this... PlaySoundAtEntity("secretkey", "21_scream10.ogg", "player", 1, false); but I am unsure if this is correct. Soundname would be the object the player has to interact with right? RE: sound question - ksnider - 07-31-2012 The sound name is the internal name of the sound. You can name it whatever you want. Also, I think you can remove the .ogg extension. I only use it when I play music. RE: sound question - Soverain - 07-31-2012 (07-31-2012, 01:59 AM)ksnider Wrote: The sound name is the internal name of the sound. You can name it whatever you want.Didn't quite work...to be more clear I want the scream to happen as the head appears if that makes any sense RE: sound question - ksnider - 07-31-2012 (07-31-2012, 02:06 AM)Soverain Wrote: Didn't quite work...to be more clear I want the scream to happen as the head appears if that makes any sense In the function where you set the head active, place: Code: PlaySoundAtEntity("secretkey", "21_scream10", "Player", 1, false); I think forgetting to capitalize "Player" can cause an error. RE: sound question - Soverain - 07-31-2012 (07-31-2012, 02:10 AM)ksnider Wrote:It didn't work=/(07-31-2012, 02:06 AM)Soverain Wrote: Didn't quite work...to be more clear I want the scream to happen as the head appears if that makes any sense RE: sound question - Adny - 07-31-2012 "21_scream10" can't be used in this function. The string used for the sound name must be a .snt (sound configuration) file. The only available .snt file that includes that specific sound (as well as 11 others the .snt chooses at random) is "21_screams". Your function should be: PlaySoundAtEntity("secretkey", "21_screams", "Player", 1, false); Hope that helped. Also, you don't need an internal name unless you intend to use a function like StopSound or FadeInSound (both of which only use the internal name, not the actual name of a .snt file). You can leave it blank ("") if you'd like. RE: sound question - Soverain - 07-31-2012 (07-31-2012, 02:55 AM)andyrockin123 Wrote: "21_scream10" can't be used in this function. The string used for the sound name must be a .snt (sound configuration) file. The only available .snt file that includes that specific sound (as well as 11 others the .snt chooses at random) is "21_screams". Your function should be:I'm afraid the sound is still not working when the head appears... my entire script //////////////////////////// // Run when entering map void OnStart() { AddEntityCollideCallback("smash", "break", "FUNC", true, 0); AddUseItemCallback("", "secretkey", "door1", "UsedKeyOnDoor", true); PlayMusic("25_amb.ogg", true, 1, 1, 0, false); SetEntityCallbackFunc("secretkey", "scream"); SetEntityConnectionStateChangeCallback("shelf", "func_shelf"); } void FUNC(string &in asParent, string &in asChild, int alState) { SetPropHealth("door", 0.0f); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door1", false, true); PlaySoundAtEntity("", "unlock_door", "door1", 0, false); RemoveItem("secretkey"); } void scream(string &in asEntity, string&in type) { PlaySoundAtEntity("", "21_screams", "player", 1, false); SetEntityActive("head",true); } void func_shelf(string &in asEntity, int alState) { if (alState == 1) { SetMoveObjectState("secret",1.0f); PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false); return; } } //////////////////////////// // Run when entering map void OnEnter() { } void LockedDoor(string &in entity) { if(GetSwingDoorLocked("door") == true) { SetMessage("Messages","msg",0); } } void DoorLocked(string &in entity) { if(GetSwingDoorLocked("door1") == true) { SetMessage("Messages","locked",0); } } void obstacle(string &in entity) { if(GetSwingDoorLocked("door2") == true) { SetMessage("Messages","block",0); } } //////////////////////////// // Run when entering map void OnLeave() { } RE: sound question - Adny - 07-31-2012 void scream(string &in asEntity, string&in type) Syntax is wrong, it should be: void scream(string &in asEntity, string &in asType) Also, you still didn't capitalize the first letter of "Player" in the PlaySoundAtEntity function. If you fix that, it should work. RE: sound question - Soverain - 07-31-2012 (07-31-2012, 03:50 AM)andyrockin123 Wrote: void scream(string &in asEntity, string&in type)Thanks, it now works ![]() |