Sign in to follow this  
Followers 0
Fahman

Music on my map.

30 posts in this topic

Hello, can someone give me working music script? I mean csv file in soundaliases folder. I have some scripts but noone want to work. Ik my english is bad sry.

0

Share this post


Link to post
Share on other sites

name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max​,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,seconda​ryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage

namehere,,music/namehere.mp3,0.7,0.7,ambience,,,,,ambient,streamed,,looping,,all_mp,,,,,,

0

Share this post


Link to post
Share on other sites

Thanks Sentrex, but i have another problem:  Couldn't play stream 'sound/\ song.mp3' from alias 'song1' - Unable to open file

0

Share this post


Link to post
Share on other sites

your mp3 may be corrupted 

 

I know an easier way to do it, I'll post it once I feel like typing it out :dave: 

0

Share this post


Link to post
Share on other sites

Thanks Sentrex, but i have another problem:  Couldn't play stream 'sound/\ song.mp3' from alias 'song1' - Unable to open file

Should be 'sound/song.mp3'. ;)

0

Share this post


Link to post
Share on other sites

your mp3 may be corrupted 

 

I know an easier way to do it, I'll post it once I feel like typing it out :dave:

Type it out please, it will help me too  ^_^

0

Share this post


Link to post
Share on other sites

Ok, So I'll write it out, Here's the method I use. 

 

First: get your mp3, and name it something short but so you can remind yourself of what the song is, E.g song is dubstep? name it dub

 

Second: get your MP3 and place it in cod4 > Raw > Sound > Music (if you don't have a music folder make one)

 

9098c00887e775769ca3c6c8eb198cbb.png

 

Third: Go into your Raw > Soundalias Folder and get any csv and copy and paste it into the sound alias folder and name it to what your song is called Eg: dub.csv, Then, Open it up and put this code in it:

name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max​,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,seconda​ryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage


dub,,music/dub.mp3,0.7,0.7,ambience,,,,,ambient,streamed,,looping,,all_mp,,,,,,

 

Third Add this to your update zone file in compile tools: 

 

sound,dub,,all_mp

 

The only music script I have is a random music script, so you might be able to change it to your liking

 

Music()
{
        wait 10;
        random = randomint (3);
        switch (random)
        {
                case 0: Ambientplay("who");
                                iprintln("^7Now Playing^1:^7 Iniquity ^1- ^7Who I Am");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Iniquity ^1- ^7Who I am");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Iniquity ^1- ^7Who I Am");
                                break;
                case 1: Ambientplay("happy");
                                iprintln("^7Now Playing^1:^7 Kid Cudi ^1- ^7Pursuit Of Happnies (Steve Aoki Dance Remix)");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Kid Cudi ^1- ^7Pursuit Of Happnies (Steve Aoki Dance Remix)");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Kid Cudi ^1- ^7Pursuit Of Happnies (Steve Aoki Dance Remix)");
                                break;
                case 2: Ambientplay("fair");
                                iprintln("^7Now Playing^1:^7 Gramatik ^1- ^7While I Was Playin Fair");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Gramatik ^1- ^7While I Was Playin Fair");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Gramatik ^1- ^7While I Was Playin' Fair");
                                break;
        }
}

 

 

 

Just remember to change everything that has DUB to what ever your song is called. Should work. if it doesn't, reply back 

0

Share this post


Link to post
Share on other sites

It means it should stop the script I think so the other music doesn't start playing over it, if I'm right

0

Share this post


Link to post
Share on other sites

It means it should stop the script I think so the other music doesn't start playing over it, if I'm right

Hmm alright, thank you  :awesome:

0

Share this post


Link to post
Share on other sites

Ok, So I'll write it out, Here's the method I use. 

 

First: get your mp3, and name it something short but so you can remind yourself of what the song is, E.g song is dubstep? name it dub

 

Second: get your MP3 and place it in cod4 > Raw > Sound > Music (if you don't have a music folder make one)

 

9098c00887e775769ca3c6c8eb198cbb.png

 

Third: Go into your Raw > Soundalias Folder and get any csv and copy and paste it into the sound alias folder and name it to what your song is called Eg: dub.csv, Then, Open it up and put this code in it:

name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max​,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,seconda​ryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage


dub,,music/dub.mp3,0.7,0.7,ambience,,,,,ambient,streamed,,looping,,all_mp,,,,,,

 

Third Add this to your update zone file in compile tools: 

 

sound,dub,,all_mp

 

The only music script I have is a random music script, so you might be able to change it to your liking

 

Music()
{
        wait 10;
        random = randomint (3);
        switch (random)
        {
                case 0: Ambientplay("who");
                                iprintln("^7Now Playing^1:^7 Iniquity ^1- ^7Who I Am");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Iniquity ^1- ^7Who I am");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Iniquity ^1- ^7Who I Am");
                                break;
                case 1: Ambientplay("happy");
                                iprintln("^7Now Playing^1:^7 Kid Cudi ^1- ^7Pursuit Of Happnies (Steve Aoki Dance Remix)");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Kid Cudi ^1- ^7Pursuit Of Happnies (Steve Aoki Dance Remix)");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Kid Cudi ^1- ^7Pursuit Of Happnies (Steve Aoki Dance Remix)");
                                break;
                case 2: Ambientplay("fair");
                                iprintln("^7Now Playing^1:^7 Gramatik ^1- ^7While I Was Playin Fair");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Gramatik ^1- ^7While I Was Playin Fair");
                                wait 1.0;
                                iprintln("^7Now Playing^1:^7 Gramatik ^1- ^7While I Was Playin' Fair");
                                break;
        }
}

 

 

 

Just remember to change everything that has DUB to what ever your song is called. Should work. if it doesn't, reply back 

 

Works this tutorial also with this script_code?? (music menu):

 

initMusic()
{
	level.music = [];
 
	i = 0;
	level.music[i]["artist"] = "Brennan Heart";
	level.music[i]["title"] = "Imaginary";
	level.music[i]["length"] = "03:22";
	level.music[i]["alias"] = "imaginary";
	
	i++;
	level.music[i]["artist"] = "SHM";
	level.music[i]["title"] = "Don't you worry child";
	level.music[i]["length"] = "03:28";
	level.music[i]["alias"] = "worry";
	
		i++;
	level.music[i]["artist"] = "David Guetta";
	level.music[i]["title"] = "Titanium";
	level.music[i]["length"] = "04:05";
	level.music[i]["alias"] = "tito";
		i++;
	level.music[i]["artist"] = "Flux Pavillion";
	level.music[i]["title"] = "Cracks";
	level.music[i]["length"] = "02:09";
	level.music[i]["alias"] = "cracks";
 
	precacheShader( "deathrun" );
	precacheShader( "white" );
}
 
musicMenu()
{
	self endon( "disconnect" );
	self endon( "death" );
	self endon( "spawned" );
	self endon( "joined_spectators" );
	self endon( "music thread terminated" );
 
	self thread onDeath();
	self thread onDisconnect();
 
	self.hud_music = [];
	// self cleanUp();
	self.selection = 0;
 
	// create huds
	i = 0;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 160, 200, 0.35, "left", "top", 2 );	// Background
	self.hud_music[i].sort = 880;
	self.hud_music[i] setShader( "deathrun", 320, 160 );
 
	i++;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 270, 180, 1, "left", "top", 1.8 );
	self.hud_music[i].sort = 883;
	self.hud_music[i] setText( "^3-^7 Select Music ^3-^7" );
 
	i++;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 270, 204, 0.93, "left", "top", 1.8 );
	self.hud_music[i].sort = 884;
	self.hud_music[i] setText( "Artist ^3-^7 Title ^3-^7 Length" );
 
	i++;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 288, 360, 1, "center", "top", 1.4 );
	self.hud_music[i].sort = 885;
	self.hud_music[i] setText( "Press ^3[LMB]^7: Next Song    Press ^3[USE]^7: Play Song    Press ^3[Nade]^7: Close Menu" );
 
	i++;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 235, 360, 1, "center", "bottom", 1.4 );
	self.hud_music[i].sort = 886;
	self.hud_music[i] setText( "Music Menu Made By ^1Braxi" );
 
	for( j = 0; j < level.music.size; j++ )
	{
		i++;
		// Artist - Title [lenght]
		////////////////////braxi\_mod::addTextHud(self, x, y, transparency, "x allignment", "y allignment", size(can't go below 1.3))
		self.hud_music[i] = braxi\_mod::addTextHud( self, 172, 230+(j*16), 0.93, "left", "top", 1.4 );
		self.hud_music[i].sort = 882;
		self.hud_music[i].font = "objective";
 
		entry = level.music[j];
		self.hud_music[i] setText( entry["artist"] + " ^3-^7 " + entry["title"] + " ^3[^7" + entry["length"] + "^3]^7" );
	}
 
	i++;
	self.hud_music[self.hud_music.size] = braxi\_mod::addTextHud( self, 167, 230, 0.4, "left", "top", 1.4 );	// Selection indicator
	self.hud_music[i].sort = 881;
	indicator = self.hud_music[self.hud_music.size-1];
	indicator setShader( "white", 306, 17 );
 
	while( self.sessionstate == "playing" )
	{
		wait 0.1;
 
		if( self attackButtonPressed() )	
		{
			self.hud_music[5+self.selection].alpha = 0.93; //unfocus previous item
 
			self.selection++;
			if( self.selection >= level.music.size )
				self.selection = 0;
 
			item = self.hud_music[5+self.selection];
			item.alpha = 1;
			indicator.y = item.y; // change indicator position
		}
		else if( self useButtonPressed() )
		{
			iPrintlnBold( "^3" + level.music[self.selection]["artist"]+"^7 - ^3" +level.music[self.selection]["title"] );
 
			ambientPlay( level.music[self.selection]["alias"], 3 );
			break;
		}
		else if( self fragButtonPressed() )
		{
			break; // close menu
		}
	}
 
	self cleanUp();
}
 
musictrig()
{
	trig = getEnt ("music", "targetname");
 
	while(1)
	{
		trig waittill("trigger", player);
		player musicMenu();
	}
}
 
onDisconnect()
{
	self endon( "music thread terminated" );
	self waittill( "disconnect" );
	self cleanUp();
}
 
onDeath()
{
	self endon( "disconnect" );
	self endon( "music thread terminated" );
	self waittill( "death" );
	self cleanUp();
}
 
 
cleanUp()
{
	if( !isDefined( self ) )
		return;
 
	if( isDefined( self.hud_music ) )
	{
		for( i = 0; i < self.hud_music.size; i++ )
		{
			if( isDefined( self.hud_music[i] ) )
				self.hud_music[i] destroy();
		}
	}
	self notify( "music thread terminated" );
}
0

Share this post


Link to post
Share on other sites

Stil doesnt work :/

 

should normally work, that's everything I do, I have no idea what could be causing it :/ 

0

Share this post


Link to post
Share on other sites

Thanks Staab :) May I ask, what does "break;" do in a script?

so it goes to the end of the switch when one case is executed. Because in a switch statement you (often) want only one case executed. 

0

Share this post


Link to post
Share on other sites

I wouldn't the sound csv's are different if i'm right, and the file size is a lot bigger

0

Share this post


Link to post
Share on other sites

- Post a screenshot of the statements about the music from your gsc

- Post a screenshot of the csv in your soundalias 

- Post a screenshot of your iwd

- Post a screenshot of your "update zone file"

 

Then I can probably figure out the problem

0

Share this post


Link to post
Share on other sites

so it goes to the end of the switch when one case is executed. Because in a switch statement you (often) want only one case executed. 

So like where there's multiple things happening in one script, like, random selecting scripts?

0

Share this post


Link to post
Share on other sites

Doesnt work :c

I rly dont know what im doing wrong O.o I dont want to release my first dr map without music :o

0

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0