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
Script Help How to stop music playing?
Chap Offline
Member

Posts: 99
Threads: 16
Joined: Jul 2012
Reputation: 2
#1
How to stop music playing?

Hey,

I'm having a problem with my script to play music. I have six levels and in the first one, there's a script that starts music. When entering the second level, there is a script to stop music.

The code is as follows:
void OnEnter(){     PlayMusic("02_amb_strange.ogg",true ,0.4f,0.2f,1,false);}


On the next level, I have a statement that should stop the music from playing which is as follows:
void OnEnter(){    StopMusic(2.0f,0);}


However, there is a problem. When I enter the second level, the music continues to play. On the last 3 levels, the music is supposed to stop but it doesn't on any of them. I've tried putting StopMusic statements in 'OnLeave' in addition and that doesn't work.

Is there something I'm missing?

[Image: 20643.png]
07-12-2012, 03:59 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: How to stop music playing?

To stop the music you can just put StopMusic in OnLeave() and also to stop the music you need to have the same priority on both. You have priority 1 on PlayMusic then you also need Priority 1 on StopMusic Smile

07-12-2012, 04:05 PM
Find
Chap Offline
Member

Posts: 99
Threads: 16
Joined: Jul 2012
Reputation: 2
#3
RE: How to stop music playing?

Ah it works both ways now - It was just the priority, haha I can't believe that was all.

Thanks for your help SilentStriker!

[Image: 20643.png]
07-12-2012, 04:25 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: How to stop music playing?

Your welcome Smile

Welcome to the forum Smile

07-12-2012, 08:27 PM
Find




Users browsing this thread: 1 Guest(s)