Frictional Games Forum (read-only)
Stopping a playing phonograph mid-piece - 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: Stopping a playing phonograph mid-piece (/thread-24919.html)



Stopping a playing phonograph mid-piece - THomura - 03-25-2014

I am trying to find a script that will stop whatever sound a phonograph is playing in the middle of said sound when a lever is pulled. I have tried using the StopSound and StopMusic scripts but they unfortunately do not work. When I pull the lever every other script functions perfectly but the phonograph still plays!

Here is the script I am using:

void PlayHorrorNoise(string &in asEntity, int alState)
{
if(alState == 1)
{
PlaySoundAtEntity("", "mors_praematura.snt", asEntity, 0, false);
}
}

/////the script that is activated when the phonograph is wound, and

void GalleryLights(string &in asEntity, int alState)
{
if (alState == 1)
{
StopSound("mors_praematura.snt", 1);
FadeLightTo("GalleryLight", 0.5, 0.395, 0.1, 1, -1, 6);
SetLeverStuckState("GalleryLever", 1, false);
SetLampLit("lamp_1", true, true);
SetLampLit("lamp_2", true, true);
}
}

/////the script that is activated when the lever is pulled.

I hope I did a decent job of explaining my conundrum. I'd be happy to provide any other information should it be needed and I welcome any and all suggestions. Thanks!


RE: Stopping a playing phonograph mid-piece - CarnivorousJelly - 03-25-2014

I seem to be the first person to reply :D Unfortunately, I am not the person to ask about scripting :s

Your explanation was great - I understood exactly what you're asking for help with :D we need more people like you asking for help :p However, I think your post would get the attention and help it deserves if you were to put it in the Development Support Section. All the smart people hang out there :D

Anyways, apologies for not being able to help. I hope someone else can answer your question c:

Edit:
Oh! Welcome to the forum! o/


RE: Stopping a playing phonograph mid-piece - THomura - 03-25-2014

Thank you! And thanks for the suggestion! It's a little disorienting getting used to a forum so I'm kind of stumbling around right now. Thanks for the help! I'll see if I can get a good response there.


RE: Stopping a playing phonograph mid-piece - Daemian - 03-25-2014

PlaySound ("Rabbit", blahblah
StopSound ("Rabbit" blahblah


RE: Stopping a playing phonograph mid-piece - THomura - 03-25-2014

Like I stated earlier, the StopSound script does not seem to be working in this situation.


RE: Stopping a playing phonograph mid-piece - triadtimes - 03-25-2014

StopSound works by using the internal name of a sound file. In your example
Code:
PlaySoundAtEntity("", "mors_praematura.snt", asEntity, 0, false);
you do not have an internal name set.

In the first pair of quotes you have to give it a name (ex. Rabbit, as Amn said).
Code:
PlaySoundAtEntity("Rabbit", "mors_praematura.snt", asEntity, 0, false);

Then, when you call StopSound you use the same internal name (ex. Rabbit again).
Code:
StopSound("Rabbit", 1);

I hope this helps.


RE: Stopping a playing phonograph mid-piece - THomura - 03-25-2014

OH! WHOOPS I didn't realize. I'm sorry!

And it totally worked!! Thank you so much!


RE: Stopping a playing phonograph mid-piece - Kreekakon - 03-25-2014

Problem is solved so closing this! Remember not to make multiple threads for a same situation.