Custom Sound - Not Working

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
creazee
CJ Wannabe
CJ Wannabe
Posts: 4
Joined: October 16th, 2019, 6:07 pm

Custom Sound - Not Working

Post by creazee » October 16th, 2019, 6:19 pm

I've tried to modify sounds within a script. All the directories seem to be in place, but the .wav isn't playing within the map.

Here's my .gsc file (Not main)

Code: Select all

main()
{
	thread musicTrigger1();
	thread musicTrigger2();
	thread musicTrigger3();
	thread musicTrigger4();
	thread musicOffTrigger();


	thread onPlayerConnect();
}


onPlayerConnect()
{
	level endon("game_ended");

	for(;;)
	{
		level waittill("connected", player);

		player.music1Playing = false;
		player.music2Playing = false;
		player.music3Playing = false;
		player.music4Playing = false;
	}
}


musicTrigger1()
{
	trigger = getEnt("music1", "targetname");

	for(;;wait 0.05)
	{
		trigger waittill("trigger", player);

		if(!player.music1Playing)
		{
			player thread playMusic(1);
		}
	}
}

musicTrigger2()
{
	trigger = getEnt("music2", "targetname");

	for(;;wait 0.05)
	{
		trigger waittill("trigger", player);

		if(!player.music2Playing)
		{
			player thread playMusic(2);
		}
	}
}

musicTrigger3()
{
	trigger = getEnt("music3", "targetname");

	for(;;wait 0.05)
	{
		trigger waittill("trigger", player);

		if(!player.music3Playing)
		{
			player thread playMusic(3);
		}
	}
}

musicTrigger4()
{
	trigger = getEnt("music4", "targetname");

	for(;;wait 0.05)
	{
		trigger waittill("trigger", player);

		if(!player.music4Playing)
		{
			player thread playMusic(4);
		}
	}
}

playMusic(num)
{
	self endon("disconnect");

	ambientStop(0);

	switch(num)
	{
		case 1:
		self iPrintLn("^3Now playing: ^1BAD STYLE - TIME BACK");
		self playLocalSound("song1");
		self.music1Playing = true;
		self.music2Playing = false;
		self.music3Playing = false;
		self.music4Playing = false;
		wait (156);
		self.music1Playing = false;
		break;
		
		case 2:
		self iPrintLn("^3Now playing: ^1REQUEM FOR A DREAM");
		self playLocalSound("song2");
		self.music1Playing = false;
		self.music2Playing = true;
		self.music3Playing = false;
		self.music4Playing = false;
		wait (192);
		self.music2Playing = false;
		break;

		case 3:
		self iPrintLn("^3Now playing: ^1ELLIPHANT - REVOLUTION");
		self playLocalSound("song3");
		self.music1Playing = false;
		self.music2Playing = false;
		self.music3Playing = true;
		self.music4Playing = false;
		wait (197);
		self.music3Playing = false;
		break;

		case 4:
		self iPrintLn("^3Now playing: ^1LINDSEY STIRLING - CRISTALLIZE");
		self playLocalSound("song4");
		self.music1Playing = false;
		self.music2Playing = false;
		self.music3Playing = false;
		self.music4Playing = true;
		wait (258);
		self.music4Playing = false;
		break;
		
		default:
		break;
	}
}

musicOffTrigger()
{
	trigger = getEnt("musicstop", "targetname");

	for(;;wait 0.05)
	{
		trigger waittill("trigger", player);

		if(player.music1Playing || player.music2Playing || player.music3Playing || player.music4Playing)

		{
		
		player stopLocalSound("song1");
		player stopLocalSound("song2");
		player stopLocalSound("song3");
		player stopLocalSound("song4");
		
		player playLocalSound("stop");
		player iPrintLn("^3Music ^1Stoped");

		player.music1Playing = false;
		player.music2Playing = false;
		player.music3Playing = false;
		player.music4Playing = false;
		}
	}
}
I've added 5 trigger_use_touch for all 4 songs, along with a stop button.

Then my .csv is

Code: Select all

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,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage,conversion

vender,,level/ac_unit_window_loop.wav,0.7,0.7,max,1,1,150,300,auto,streamed,,looping
vender_drop,1,mp_scripttest/vender_drop1.wav,0.7,0.8,max,0.9,1,150,300,auto,,,
vender_drop,2,mp_scripttest/vender_drop2.wav,0.7,0.8,max,0.9,1,150,300,auto,,,
song1,,mp_scripttest/song1.wav,1,,music,,,150,6000,music,streamed,,looping,,,,,,,,,,,,,,
song2,,mp_scripttest/song2.wav,1,,music,,,150,6000,music,streamed,,looping,,,,,,,,,,,,,,
song3,,mp_scripttest/song3.wav,1,,music,,,150,6000,music,streamed,,looping,,,,,,,,,,,,,,
song4,,mp_scripttest/song4.wav,1,,music,,,150,6000,music,streamed,,looping,,,,,,,,,,,,,,
Note: vender is just another script I've added within the map.

Also i've put the .wav files into 'raw/sounds/mp_scripttest' folder

I've updated my main gsc by adding

Code: Select all

maps\mp\_music::main();
Along with "Update Zone File" from compile tools

Code: Select all

sound,mp_scripttest,,,

Note: The script works fine; Displaying the text & muting all sounds to play the track.
| |
| |
V V

It just doesn't play the track, which I'm trying to figure out.

creazee
CJ Wannabe
CJ Wannabe
Posts: 4
Joined: October 16th, 2019, 6:07 pm

Custom Sound - Not Working 2

Post by creazee » October 17th, 2019, 7:46 pm

From the last post of showing proof, which hasn't been approved yet. I have an image to show about the problem. Shown within my last post, I had the right directories.

Image


Sometimes it works & sometimes it doesn't for some reason.
Last edited by creazee on October 18th, 2019, 3:26 pm, edited 1 time in total.

Pedsdude
Site Admin
Site Admin
Posts: 15908
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: Custom Sound - Not Working

Post by Pedsdude » October 18th, 2019, 3:13 pm

I've approved your posts and merged them into one topic.

One of your posts was in the CoD4 Mapping Help forum and the other in the CoDWaW Mapping Help forum, so not sure which one you intended them to be in. If it's WaW then let me know and I'll move the topic.

As for help, this isn't my area of expertise so I'm afraid you'll have to wait for someone else to help!
Image
Image

creazee
CJ Wannabe
CJ Wannabe
Posts: 4
Joined: October 16th, 2019, 6:07 pm

Re: Custom Sound - Not Working

Post by creazee » October 18th, 2019, 3:28 pm

You can close/delete both if possible.

(Fixed by placing your 'iwd - sound' inside the mod folder you're running)

or

usermaps/mp_mapname

Pedsdude
Site Admin
Site Admin
Posts: 15908
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: Custom Sound - Not Working

Post by Pedsdude » October 29th, 2019, 7:18 pm

I'll leave it in case someone comes across the same issue and finds your solution :)
Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests