Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stopping a playing phonograph mid-piece
THomura Offline
Junior Member

Posts: 7
Threads: 2
Joined: Mar 2014
Reputation: 0
#1
Stopping a playing phonograph mid-piece

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!
(This post was last modified: 03-25-2014, 05:20 AM by THomura.)
03-25-2014, 04:47 AM
Find
Nikson. Offline
Member

Posts: 134
Threads: 22
Joined: Feb 2013
Reputation: 4
#2
RE: Stopping a playing phonograph mid-piece

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
03-25-2014, 06:28 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#3
RE: Stopping a playing phonograph mid-piece

(03-25-2014, 05:16 AM)triadtimes Wrote: StopSound works by using the internal name of a sound file. In your example
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).
PlaySoundAtEntity("Rabbit", "mors_praematura.snt", asEntity, 0, false);

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

I hope this helps.

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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 03-25-2014, 07:05 AM by Romulator.)
03-25-2014, 07:05 AM
Find
THomura Offline
Junior Member

Posts: 7
Threads: 2
Joined: Mar 2014
Reputation: 0
#4
RE: Stopping a playing phonograph mid-piece

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

well honestly I have no clue on how to close a thread. Tips?
03-25-2014, 08:01 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#5
RE: Stopping a playing phonograph mid-piece

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!

Discord: Romulator#0001
[Image: 3f6f01a904.png]
03-25-2014, 08:48 AM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#6
RE: Stopping a playing phonograph mid-piece

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

[Image: Tv0YgQb.gif]
Image by BandyGrass
03-25-2014, 09:01 AM
Find




Users browsing this thread: 1 Guest(s)