Modme Forums

Song when all payers go down except for one??

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


ModmeBot:

Thread By: XxCAFxX

could someone script me something where when all of the players go down except for one a song plays?


ModmeBot:

Reply By: natesmithzombies

This has been tested and I can guarantee that it works:

1) Add this to the bottom of mapname.gsc

function cinematic_downs()
{
	level endon( "intermission" ); 
	level.players_not_valid = 0; 
	
	while(1)
	{

		while( zm_utility::is_player_valid(self) )
			wait(0.05); 
		
		level.players_not_valid++; 
		self.player_not_valid = true; 
		players = GetPlayers(); 
		if( level.players_not_valid == players.size-1 )
			foreach( player in players )
				if( !isDefined(player.player_not_valid) )
				{
					player PlayLocalSound( "nsz_banana_song" );  // change to your song name
					player.playing_cinematic_down = true; 
				}
		
		while( !zm_utility::is_player_valid(self) )
			wait(0.05); 
		
		level.players_not_valid--; 
		self.player_not_valid = undefined; 
		
		players = getplayers(); 
		foreach( player in players )
			if( isDefined(player.playing_cinematic_down) )
			{
				player StopLocalSound( "nsz_banana_song" ); // change to your song name
				player.playing_cinematic_down = undefined; 
		}
		
		wait(0.05); 
	}
}



2) Add this to the top of your function main in mapname.gsc:

callback::on_spawned( &cinematic_downs );



3) Make sure you have your alias set up and you switch the alias in the script to match your sound


ModmeBot:

Reply By: Abnormal202

Oh man, I spent like an hour trying to write a script for this and just couldn't figure it out. I'll try to learn from my mistakes though and see how your script works, NSZ.

Also on an unrelated note, you don't happen to know anything about Zombie Spawners, do you?


ModmeBot:

Reply By: XxCAFxX

natesmithzombies

This has been tested and I can guarantee that it works:

1) Add this to the bottom of mapname.gsc

function cinematic_downs()
{
	level endon( "intermission" ); 
	level.players_not_valid = 0; 
	
	while(1)
	{

		while( zm_utility::is_player_valid(self) )
			wait(0.05); 
		
		level.players_not_valid++; 
		self.player_not_valid = true; 
		players = GetPlayers(); 
		if( level.players_not_valid == players.size-1 )
			foreach( player in players )
				if( !isDefined(player.player_not_valid) )
				{
					player PlayLocalSound( "nsz_banana_song" );  // change to your song name
					player.playing_cinematic_down = true; 
				}
		
		while( !zm_utility::is_player_valid(self) )
			wait(0.05); 
		
		level.players_not_valid--; 
		self.player_not_valid = undefined; 
		
		players = getplayers(); 
		foreach( player in players )
			if( isDefined(player.playing_cinematic_down) )
			{
				player StopLocalSound( "nsz_banana_song" ); // change to your song name
				player.playing_cinematic_down = undefined; 
		}
		
		wait(0.05); 
	}
}



2) Add this to the top of your function main in mapname.gsc:

callback::on_spawned( &cinematic_downs );



3) Make sure you have your alias set up and you switch the alias in the script to match your sound

I'm probably doing something wrong but its not working, i tried on splitscreen if that makes a difference, if you need more info let me know.


ModmeBot:

Reply By: natesmithzombies

XxCAFxX
natesmithzombies

This has been tested and I can guarantee that it works:

1) Add this to the bottom of mapname.gsc

function cinematic_downs()
{
	level endon( "intermission" ); 
	level.players_not_valid = 0; 
	
	while(1)
	{

		while( zm_utility::is_player_valid(self) )
			wait(0.05); 
		
		level.players_not_valid++; 
		self.player_not_valid = true; 
		players = GetPlayers(); 
		if( level.players_not_valid == players.size-1 )
			foreach( player in players )
				if( !isDefined(player.player_not_valid) )
				{
					player PlayLocalSound( "nsz_banana_song" );  // change to your song name
					player.playing_cinematic_down = true; 
				}
		
		while( !zm_utility::is_player_valid(self) )
			wait(0.05); 
		
		level.players_not_valid--; 
		self.player_not_valid = undefined; 
		
		players = getplayers(); 
		foreach( player in players )
			if( isDefined(player.playing_cinematic_down) )
			{
				player StopLocalSound( "nsz_banana_song" ); // change to your song name
				player.playing_cinematic_down = undefined; 
		}
		
		wait(0.05); 
	}
}



2) Add this to the top of your function main in mapname.gsc:

callback::on_spawned( &cinematic_downs );



3) Make sure you have your alias set up and you switch the alias in the script to match your sound

I'm probably doing something wrong but its not working, i tried on splitscreen if that makes a difference, if you need more info let me know.

I tested it on splitscreen myself to make sure it worked. You did step 2 correct?


ModmeBot:

Reply By: XxCAFxX

natesmithzombies
XxCAFxX
natesmithzombies

This has been tested and I can guarantee that it works:

1) Add this to the bottom of mapname.gsc

function cinematic_downs()
{
	level endon( "intermission" ); 
	level.players_not_valid = 0; 
	
	while(1)
	{

		while( zm_utility::is_player_valid(self) )
			wait(0.05); 
		
		level.players_not_valid++; 
		self.player_not_valid = true; 
		players = GetPlayers(); 
		if( level.players_not_valid == players.size-1 )
			foreach( player in players )
				if( !isDefined(player.player_not_valid) )
				{
					player PlayLocalSound( "nsz_banana_song" );  // change to your song name
					player.playing_cinematic_down = true; 
				}
		
		while( !zm_utility::is_player_valid(self) )
			wait(0.05); 
		
		level.players_not_valid--; 
		self.player_not_valid = undefined; 
		
		players = getplayers(); 
		foreach( player in players )
			if( isDefined(player.playing_cinematic_down) )
			{
				player StopLocalSound( "nsz_banana_song" ); // change to your song name
				player.playing_cinematic_down = undefined; 
		}
		
		wait(0.05); 
	}
}



2) Add this to the top of your function main in mapname.gsc:

callback::on_spawned( &cinematic_downs );



3) Make sure you have your alias set up and you switch the alias in the script to match your sound

I'm probably doing something wrong but its not working, i tried on splitscreen if that makes a difference, if you need more info let me know.

I tested it on splitscreen myself to make sure it worked. You did step 2 correct?

Yes, and ive changed the script alies to mine and added my song to the user alies but no avail


ModmeBot:

Reply By: Abnormal202

It worked well for me. What does the sound look like in the user_aliases? mine looks like:

the_juggernauts_clutch,,,sandstorm\the_juggernauts_clutch.wav,,,UIN_MOD,,,,,,,,,0,0,100,100,0,900,1000,,,,,,,,,,,,,,,,3d,,,NONLOOPING,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,



and then I reference it in script with

the_juggernauts_clutch



Do you get any errors in Launcher when linking?


ModmeBot:

Reply By: XxCAFxX

Alright i got it working, thank you so much! it turns out it was because i was missing a sound somewhere else that had nothing to do with this script.