Frictional Games Forum (read-only)

Full Version: Stop Music ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can i stop music on an area and play new music?
To stop music, you need a script. An example I used:
Code:
StopMusic(3.0f, 100);
3.0f is the fade out time for the music
100 is the music priority. If your music has the priority of 1, just change 100 to 1.
And to start music:
Code:
PlayMusic("18_amb", true, 1, 1, 1, true);

These two codes are an example

And a normal script:
Code:
AddEntityCollideCallback("Player", "ScriptArea_1", "Whatever", true, 1);

void Whatever(string &in asParent, string &in asChild, int alState)
{
    StopMusic(3.0f, 100);
    PlayMusic("18_amb", true, 1, 1, 1, true);
}
This is how it should appear in a script file. Just in case you didn't know how to script well.

Make sure the Script Area you want the player to collide with is ScriptArea_1, just like in the AddEntityCollideCallback.

Hope it works. That is the way I do it with music and works fine.
Okay thanks!