Frictional Games Forum (read-only)

Full Version: PlayMusic Problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

I'm pretty much done with my CS, I only need to fix a little problem with the PlayMusic command.

When I'm testing just the map (let's call it: map 2) where some music is supposed to be played everything works just fine.

Though, when you play the custom story, and get teleported to that map (map 2), you still hear the sound from the map (map 1) you got teleported from.

I used several commands to stop the music and also I lowered the sounds priority.


Here's an outtake from the script:

void OnStart()
{
PlayMusic("06_amb.ogg", true, 1, 3, 0.9f, true);
}



void OnLeave()
{
StopMusic(1, 1);
StopSound("06_amb.ogg", 1);
AddDebugMessage("Sounds Removed", false);
}

because that didn't do anything, I copied and pasted it in the OnStart of the next maps script as well without any result. The sound keeps playing.

If you want the whole custom story - either to test it for me and give me some criticism or - to check out the problem with the sound yourself, just tell me and I'll give you a download link.

Thanks in advance,

Ainz
The "StopSound" function's unnecessary. It is used for sounds, you tried using it for music.

Try this:

void OnStart()
{
PlayMusic("06_amb.ogg", true, 1, 3, 0.9, true);
}



void OnLeave()
{
StopMusic(1, 0.9);
AddDebugMessage("Sounds Removed", false);
}


Highlighted what I just changed.
Thanks for the fast answer but that didn't solve it, actually it made it even worse. That way the other sounds that were going to play later on in that map didn't start anymore because their priority was too low. maybe i would have to remove the f there as well but I'm almost 100% sure it'll not solve the problem.

And I think the sound playing isn't the ambience sound but it is the ambience sound of the grunt that runs to the player before getting teleported. Any idea how I stop the grunt ambience sound since the StopMusic doesn't seem to work on that.
Set the priority to 0. Change the highlighted "0.9" to 0 in both functions. And don't add the "f" letter to the last number in the "PlayMusic" function.

The reason you should try 0 = It should prevent the grunt's music from starting. I did that, and it works.
That didn't help either but I got it now.

The sound on the next map shall only play once so I didn't put it as a loop sound.

When I use it as a loop sound though, everything works just as desired - I don't know how but hey it works Big Grin

Thanks for your help anyway Robert Smile
Ok, you're welcome.