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-24920.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!

Problem solved!


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

When you launch the first play sound in the first brackets put a name, and in the stopsound put the name you've put in the brackets


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

(03-25-2014, 05:16 AM)triadtimes Wrote: 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.

This came from the identical thread, created by the same user.


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

Yeah I've been helped on the problem and...

well honestly I have no clue on how to close a thread. Tips?


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

A thread will be closed by a moderator, but they often won't unless requested Smile I wouldn't worry about it. You could always put a "Solved" in the title (by editing the Original Post) but it is not required!


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.