Frictional Games Forum (read-only)
Walking into sound area issue - 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: Walking into sound area issue (/thread-11515.html)



Walking into sound area issue - Tiiwh - 11-26-2011

Hi Blush
I need some help with my sounds! I am making a custom story in Amnesia and I'm holding on to the old sounds and music that are already inside the game. So thanks to http://www.frictionalgames.com/forum/user-15434.html I can now easily put sounds in the level editor and script it. There is only one small little problem.
When I walk into the area where I placed the sound it starts, but then when the sound should stop and not loop it still loops and I have tried to put it into true and false, but nothing works. Here is the sound script:
void OnStart()
{
AddEntityCollideCallback("Player", "Sound_Area1", "GetSound_Area1", true, 1);
}
void GetSound_Area1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "23_saw3.snt", "Sound_Area1", 0.0f, true);
}
---
I would really appreciate it if someone could lend me a hand with this, I think it might be quite easy to solve, but since I'm a newbie I don't quite get it. Sleepy
Thanks.



RE: Walking into sound area issue - Tanshaydar - 11-26-2011

Seems like that sounds perimeters bound to be a loop sound. In that case you need to manually stop the sound. You can use Timers to stop it.

Give a name to your sound, like PlaySoundAtEntity("ThisIsAName", "23_saw3.snt", "Sound_Area1", 0.0f, true);

And use StopSound("ThisIsAName"); to stop the looping sound.


RE: Walking into sound area issue - Tiiwh - 11-26-2011

Thanks a lot! Smile


RE: Walking into sound area issue - JenniferOrange - 11-27-2011

(11-26-2011, 01:24 PM)Tiiwh Wrote: Hi Blush
I need some help with my sounds! I am making a custom story in Amnesia and I'm holding on to the old sounds and music that are already inside the game. So thanks to http://www.frictionalgames.com/forum/user-15434.html I can now easily put sounds in the level editor and script it. There is only one small little problem.
When I walk into the area where I placed the sound it starts, but then when the sound should stop and not loop it still loops and I have tried to put it into true and false, but nothing works. Here is the sound script:
void OnStart()
{
AddEntityCollideCallback("Player", "Sound_Area1", "GetSound_Area1", true, 1);
}
void GetSound_Area1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "23_saw3.snt", "Sound_Area1", 0.0f, true);
}
---
I would really appreciate it if someone could lend me a hand with this, I think it might be quite easy to solve, but since I'm a newbie I don't quite get it. Sleepy
Thanks.
The mention of me was very nice. XD Thank you. <3