Frictional Games Forum (read-only)
[SCRIPT] How to play sound and area? - 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: [SCRIPT] How to play sound and area? (/thread-29501.html)



How to play sound and area? - MaksoPL - 01-15-2015

I want to play sound, when player goes to area. How I can do that?


RE: How to play sound and area? - Mudbill - 01-15-2015

Where do you want to play this sound? Is it ambient or on the player? If it's a sound on the player, like a gasp or reaction, you usually play it on the player using PlayGuiSound. Otherwise, if the sound has a source in the level, use PlaySoundAtEntity. Use either one along with a collision callback to trigger it when the player enters an area.

PHP Code:
AddEntityCollideCallback("Player""AreaName""FuncName"true1);
PlaySoundAtEntity("SoundName""SoundFile.snt""EntityName"0false); 



RE: How to play sound and area? - DnALANGE - 01-15-2015

PlaySoundAtEntity("12_girl_scream", "12_girl_scream.snt", "GirlScream01", 1.0f, true);
Why not just as above...
Entity is also an area...
THink it could become a bit confucing for starters Mud, don't you think?
I think its best to keep starters on the PlaySoundAtEntity function.. Always works!


RE: How to play sound and area? - Mudbill - 01-15-2015

My bad, I typo'ed Area instead of Entity. Slipped my mind. The correct function is called PlaySoundAtEntity, not PlaySoundAtArea, but it works just like I explained above.

Edited my post.