Frictional Games Forum (read-only)

Full Version: Music Replaying In Different Levels?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been recently trying to test out my custom story, and I have music in one certain level that plays just fine in the level that I put it in, but when I try going to different maps, the music continues playing in that level. I don't know if it's my computer or not, but I don't want that happening when I release it, Pleas help?
In every level's script add this function:

PHP Code:
void OnEnter()

The first three lines stops the music of priority 0,1 and 2.
StopPlayerLookAt() stops the camera in case the previous level called a StartPlayerLookAt() and couldn't end it.
Then, ChangePlayerStateToNormal(); resets some stats, but I don't remember why I put this here, but it stops strange behavior brought from the previous level.
...That depends on if you want to stop certain things.

At least, StopMusic stops the music in OnEnter.
If you don't want it to stop in a certain level just remove StopMusic.
Why do it like this ?
I always do this:
StartMusic(yaddda yadda, 1) <---priority of music is important

StopMusic(yadda yadda, 1)
That's also a way.
There's no real way to do it.
As long as you understand StopMusic stops the music, you can decide on your own wherever you want it.