Jump to content
Sign in to follow this  
GIJOE94

Looping sounds

Recommended Posts

Hi all, I have background music in one of my missions and it works fine but I cannot figure out how to loop the music so it plays throughout the whole mission instead of just playing once. The script i am using is:

"class CfgSounds

{

// List of sounds (.ogg files without the .ogg extension)

sounds[] = {song};

// Definition for each sound

class song

{

name = "Song"; // Name for mission editor

sound[] = {\sound\Song.ogg, 1, 1.0};

titles[] = { };

};

};"

What do I need to add to this to make it loop?

Thanks in advance!

Share this post


Link to post
Share on other sites

Hi,

Using a loop?

while { true } do
{
  playMusic "MyMusic";
  sleep 240;  //Music time
};

_neo_

Share this post


Link to post
Share on other sites

I like to use something similar.

With time you can be more accurate.

while {true} do 
{
 _t = time; 
 playmusic "whatever";	
 sleep 200;
 waitUntil {(time - _t) > 600};
};

Share this post


Link to post
Share on other sites
But where should i place it in the script that i posted?

What you did was just define your tracks. And you named your track "Song".

so using Dead3yez script:

while {true} do 
{
 _t = time; 
 playmusic "Song";    
 sleep 200;
 waitUntil {(time - _t) > 600};
};  

and you can ie. place that in a trigger in the editor. and it will play the song you defined as "song". Maybe when your units walk into that trigger?

or you could possibly place it in the init for your mission, and it would play from the start. (I think this is doable, never done it myself).

Hope that helps!

Kind Regards

Melvin

Share this post


Link to post
Share on other sites

I put the script in another .sqf file in the mission folder and now it works fine, thanks for the help guys!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×