Jump to content
Sign in to follow this  
Gamer-3ac24a5e7f4beb96

Jukebox for custom songs

Recommended Posts

At the moment i am using this code in my player init to play continual random custom music:


 

playMusic(switch(round(random 7))do{
 case 0 : {"music0"};
 case 1 : {"music1"};
 case 2 : {"music2"};
 case 3 : {"music3"};
 case 4 : {"music4"};
 case 5 : {"music5"};
 case 6 : {"music6"};
 case 4 : {"music7"};});
addMusicEventHandler["MusicStop",{playMusic(switch(round(random 7))do{
 case 0 : {"music0"};
 case 1 : {"music1"};
 case 2 : {"music2"};
 case 3 : {"music3"};
 case 4 : {"music4"};
 case 5 : {"music5"};
 case 6 : {"music6"};
 case 4 : {"music7"};});}];

 

and this in my description to define the music:


 

class CfgMusic {
tracks[]={music0,music1,music2,music3,music4,music5,music6,music7};
 class music0{name="music0";sound[]={"\Music\1A.ogg",db+0,1.0};};
 class music1{name="music1";sound[]={"\Music\1B.ogg",db+0,1.0};};
 class music2{name="music2";sound[]={"\Music\2A.ogg",db+0,1.0};};
 class music3{name="music3";sound[]={"\Music\2B.ogg",db+0,1.0};};
 class music4{name="music4";sound[]={"\Music\3A.ogg",db+0,1.0};};
 class music5{name="music5";sound[]={"\Music\3B.ogg",db+0,1.0};};
 class music6{name="music6";sound[]={"\Music\4A.ogg",db+0,1.0};};
 class music7{name="music7";sound[]={"\Music\4B.ogg",db+0,1.0};};
};

 

Every 30 minutes or so or very 5th time I start a game it will throw an error about an expected string and stop the music all together. In the past I remember having done this with the jukebox function but for the life of me I can't find the thread I used 2 years ago. How do I use jukebox to continually play random custom music?

 

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  

×