Modme Forums

How to stop the music when you leave the area

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: P3Zex
Hello, I did this tutorial by Icegrenade : and I had a question : How to stop the music when you leave the area ?
Thanks You


ModmeBot:

Reply By: Mindmirror
Why do you post this in "Public Assets"?!
If you need help, ask in the "Black Ops 3: Mod Tools" Section...


ModmeBot:

Reply By: Symbo
for a nonlooping sound:
EXAMPLE:
<ol><li>beatBox StopSound("alias");</li></ol>
for a looping sound:
EXAMPLE:
beatBox stoploopsound( 2 );


ModmeBot:

Reply By: P3Zex

Symbo
for a nonlooping sound: EXAMPLE: beatBox StopSound("alias"); for a looping sound: EXAMPLE: beatBox stoploopsound( 2 );

I add it in this script?


function musicplaying()
{
   //Wait till game starts
   level flag::wait_till( "initial_blackscreen_passed" );
   //IPrintLn("Herro?");
   musicmulti = GetEntArray("musicmulti","targetname");
   //IPrintLn("Found " + musicmulti.size + " Ents");
   foreach(musicpiece in musicmulti)
      musicpiece thread sound_logic();
}
 
function sound_logic()
{
   while(1)
   {
       self waittill("trigger", player);
       if(level.musicplay == false)
       {
            level.musicplay = true;
            //IPrintLn("Music Activated: "+self.script_string);
            player PlaySoundWithNotify(self.script_string, "soundcomplete");
            player waittill("soundcomplete");
            //IPrintLn("Music Over");
            level.musicplay = false;

       }
       else
       {
            //IPrintLn("Music Already Playing");
       }
 
   }
}