I can never get sounds to work correctly! help me! - 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 (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: I can never get sounds to work correctly! help me! (/thread-7960.html) |
I can never get sounds to work correctly! help me! - tyranius - 05-12-2011 After a certain event happens I want to play a sound but it's not working at all. If I create a sound in the level editor it will play straight away even if I set it to not active, so I tried another approach and it's not working as well. void OnStart() { SetEntityCallbackFunc("display_1", "MonsterAppear"); AddEntityCollideCallback("servant_grunt_1", "MonsterDisa", "MonsterGone", true, 1); } void MonsterAppear(string &in entity, string &in type) { GiveSanityDamage(30, true); PlaySoundAtEntity("Sound_2", "react_scare4.ogg", "Player", 0.1f, false); SetLightVisible("SpotLight_1", false); SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 2, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 2, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 2, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 2, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 2, ""); AddTimer("Timer1", 60, "MonsterGone"); } void MonsterGone(string &in asTimer) { FadeEnemyToSmoke("servant_grunt_1", false); } Please help! RE: I can never get sounds to work correctly! help me! - Acies - 05-12-2011 Replace: PlaySoundAtEntity("Sound_2", "react_scare4.ogg", "Player", 0.1f, false); With: PlayGuiSound("react_scare.snt", 1.0); RE: I can never get sounds to work correctly! help me! - Roenlond - 05-12-2011 (05-12-2011, 07:55 PM)Acies Wrote: Replace: PlaySoundAtEntity("Sound_2", "react_scare4.ogg", "Player", 0.1f, false); PlayGuiSound can only play .ogg files, no? I might be mistaken. RE: I can never get sounds to work correctly! help me! - Khyrpa - 05-12-2011 If you create a sound into the level editor, it works the same way as lights. Meaning you have to use: StopSound(string& asSoundName, float afFadeTime); at OnStart to mute the sound. Then to start it use: FadeInSound(string& asSoundName, float afFadeTime, bool abPlayStart); RE: I can never get sounds to work correctly! help me! - Acies - 05-12-2011 PlayGuiSound can play .snt files too I actually believe that the react_scare is a meant to be a gui sound and.. erm, a sound played as part of the player interface - such as the fall sounds, breathing, reactions etc. RE: I can never get sounds to work correctly! help me! - tyranius - 05-12-2011 Using PlayGuiSound worked thanks! |