THomura
Junior Member
Posts: 7
Threads: 2
Joined: Mar 2014
Reputation:
0
|
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!
|
|
03-25-2014, 04:21 AM |
|
CarnivorousJelly
Posting Freak
Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation:
80
|
RE: Stopping a playing phonograph mid-piece
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/
|
|
03-25-2014, 04:41 AM |
|
THomura
Junior Member
Posts: 7
Threads: 2
Joined: Mar 2014
Reputation:
0
|
RE: Stopping a playing phonograph mid-piece
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.
|
|
03-25-2014, 04:46 AM |
|
Daemian
Posting Freak
Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation:
49
|
RE: Stopping a playing phonograph mid-piece
PlaySound ("Rabbit", blahblah
StopSound ("Rabbit" blahblah
|
|
03-25-2014, 05:02 AM |
|
THomura
Junior Member
Posts: 7
Threads: 2
Joined: Mar 2014
Reputation:
0
|
RE: Stopping a playing phonograph mid-piece
Like I stated earlier, the StopSound script does not seem to be working in this situation.
|
|
03-25-2014, 05:11 AM |
|
triadtimes
Senior Member
Posts: 508
Threads: 16
Joined: Jan 2011
Reputation:
21
|
RE: Stopping a playing phonograph mid-piece
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).
I hope this helps.
|
|
03-25-2014, 05:16 AM |
|
THomura
Junior Member
Posts: 7
Threads: 2
Joined: Mar 2014
Reputation:
0
|
RE: Stopping a playing phonograph mid-piece
OH! WHOOPS I didn't realize. I'm sorry!
And it totally worked!! Thank you so much!
|
|
03-25-2014, 05:19 AM |
|
Kreekakon
Pick a god and pray!
Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation:
124
|
RE: Stopping a playing phonograph mid-piece
Problem is solved so closing this! Remember not to make multiple threads for a same situation.
|
|
03-25-2014, 09:01 AM |
|
|