Modme Forums

Multiple Easter Egg Songs

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


ModmeBot:

Thread By: Kingslayer Kyle

Hey guys,

Just wondering if somebody could help me,

I have JBirds easter egg song script,

I would like to edit this script though to be able to have multiple triggers for different songs,

If possible would somebody be able to edit this so that I have a few placeholders for different song names and triggers to activate them?

Thanks,

Kyle.

EDIT: Also if possible, make it so that the songs can't play at the same time.. Thanks :D

#namespace zm_easteregg_song;

function init()
{
	/*	Editable Variables - change the values in here */
	level.easterEggSong = "song";							// sound alias name for the song
	level.easterEggTriggerSound = "ee_trigger";				// sound alias name for the sound played when activating a trigger
	level.easterEggTriggerLoopSound = "ee_loop_trigger";	// sound alias name for the loop sound when you are near a trigger
	level.multipleActivations = true;						// whether or not the song can be activated multiple times (true means it can, false means just once)
	/*	End of Editable Variables - don't touch anything below here */

	setupMusic();
}

function setupMusic()
{
	level.triggersActive = 0;
	triggers = GetEntArray("song_trigger", "targetname");

	foreach(trigger in triggers)
	{
		trigger SetCursorHint("HINT_NOICON");
		trigger SetHintString( "Hold ^3[{+activate}]^7 to play Easter Egg song" );
		trigger UseTriggerRequireLookAt();
		trigger thread registerTriggers(triggers.size);
	}
}

function registerTriggers(numTriggers)
{
	ent = self play_2D_loop_sound(level.easterEggTriggerLoopSound);

	self waittill("trigger");
	ent delete();
	self PlaySound(level.easterEggTriggerSound);
	level.triggersActive++;

	if(level.triggersActive >= numTriggers)
		playMusic();
}

function playMusic()
{
	play_2D_sound(level.easterEggSong);

	if(level.multipleActivations)
		setupMusic();
}

function play_2D_sound(sound)
{
	temp_ent = spawn("script_origin", (0,0,0));
	temp_ent PlaySoundWithNotify(sound, sound + "wait");
	temp_ent waittill (sound + "wait");
	wait(0.05);
	temp_ent delete();	
}

function play_2D_loop_sound(sound)
{
	temp_ent = spawn("script_origin", self.origin);
	temp_ent PlayLoopSound(sound);
	return temp_ent;
}


ModmeBot:

Reply By: Adrih

Tell your script to run multiple songs


ModmeBot:

Reply By: Abnormal202

I actually spent a while making my own script for this. Basically I have a bunch of posters around the map that if you press x on will play a song. If a song is already playing, it will stop that song. I don't have time to code something specific to you, but this is how mine went.

function poster_song_zetsubou()
{
	trig = GetEnt( "zetsubou", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("zetsubou", "Dead Flowers"); //swap "zetsubou" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("zetsubou");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_zetsubou();
		}
		else
		{
			poster_song_zetsubou();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("der_eisendrache");
		level.temp_ent StopSound("zetsubou");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_zetsubou();		
	}
}
function poster_song_der_eisendrache()
{
	trig = GetEnt( "der_eisendrache", "targetname"); //swap "der_eisendrache" for name of song 2
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("der_eisendrache", "Dead Again"); 
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("der_eisendrache");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_der_eisendrache();
		}
		else
		{
			poster_song_der_eisendrache();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("der_eisendrache");
		level.temp_ent StopSound("zetsubou");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_der_eisendrache();		
	}
}
function play_2D_sound(sound, songname)
{
	level.temp_ent = spawn("script_origin", (0,0,0));
	IPrintLnBold( "Playing:  " + songname  );
	self SetHintString( "Press ^3[{+activate}]^7 to stop playing song");
	level.temp_ent PlaySoundWithNotify(sound, sound + "wait");
	level.temp_ent waittill (sound + "wait");
	wait(0.05);
	if(level.song_is_playing == true)
	{
		level.song_is_playing = false;
		level.temp_ent delete();	
	}
}



and I realize this is a very messy script with a lot of things that in it that probably don't need to be there to still make it work. But I can confirm this works 100% as it should.


ModmeBot:

Reply By: Kingslayer Kyle

Abnormal202

I actually spent a while making my own script for this. Basically I have a bunch of posters around the map that if you press x on will play a song. If a song is already playing, it will stop that song. I don't have time to code something specific to you, but this is how mine went.

function poster_song_zetsubou()
{
	trig = GetEnt( "zetsubou", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("zetsubou", "Dead Flowers"); //swap "zetsubou" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("zetsubou");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_zetsubou();
		}
		else
		{
			poster_song_zetsubou();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("der_eisendrache");
		level.temp_ent StopSound("zetsubou");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_zetsubou();		
	}
}
function poster_song_der_eisendrache()
{
	trig = GetEnt( "der_eisendrache", "targetname"); //swap "der_eisendrache" for name of song 2
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("der_eisendrache", "Dead Again"); 
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("der_eisendrache");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_der_eisendrache();
		}
		else
		{
			poster_song_der_eisendrache();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("der_eisendrache");
		level.temp_ent StopSound("zetsubou");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_der_eisendrache();		
	}
}
function play_2D_sound(sound, songname)
{
	level.temp_ent = spawn("script_origin", (0,0,0));
	IPrintLnBold( "Playing:  " + songname  );
	self SetHintString( "Press ^3[{+activate}]^7 to stop playing song");
	level.temp_ent PlaySoundWithNotify(sound, sound + "wait");
	level.temp_ent waittill (sound + "wait");
	wait(0.05);
	if(level.song_is_playing == true)
	{
		level.song_is_playing = false;
		level.temp_ent delete();	
	}
}



and I realize this is a very messy script with a lot of things that in it that probably don't need to be there to still make it work. But I can confirm this works 100% as it should.

Not read through the full script yet but I'm pretty sure this was exactly what I was looking for.. I wanted to do something similar to you.. Thanks a bunch man :)


ModmeBot:

Reply By: Kingslayer Kyle

Abnormal202

I actually spent a while making my own script for this. Basically I have a bunch of posters around the map that if you press x on will play a song. If a song is already playing, it will stop that song. I don't have time to code something specific to you, but this is how mine went.

function poster_song_zetsubou()
{
	trig = GetEnt( "zetsubou", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("zetsubou", "Dead Flowers"); //swap "zetsubou" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("zetsubou");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_zetsubou();
		}
		else
		{
			poster_song_zetsubou();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("der_eisendrache");
		level.temp_ent StopSound("zetsubou");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_zetsubou();		
	}
}
function poster_song_der_eisendrache()
{
	trig = GetEnt( "der_eisendrache", "targetname"); //swap "der_eisendrache" for name of song 2
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("der_eisendrache", "Dead Again"); 
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("der_eisendrache");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_der_eisendrache();
		}
		else
		{
			poster_song_der_eisendrache();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("der_eisendrache");
		level.temp_ent StopSound("zetsubou");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_der_eisendrache();		
	}
}
function play_2D_sound(sound, songname)
{
	level.temp_ent = spawn("script_origin", (0,0,0));
	IPrintLnBold( "Playing:  " + songname  );
	self SetHintString( "Press ^3[{+activate}]^7 to stop playing song");
	level.temp_ent PlaySoundWithNotify(sound, sound + "wait");
	level.temp_ent waittill (sound + "wait");
	wait(0.05);
	if(level.song_is_playing == true)
	{
		level.song_is_playing = false;
		level.temp_ent delete();	
	}
}



and I realize this is a very messy script with a lot of things that in it that probably don't need to be there to still make it work. But I can confirm this works 100% as it should.

Just tried the script for some reason I get 'Not available' when going to the trigger in game, I named the trigger and the sound 'zetsubou'


ModmeBot:

Reply By: Abnormal202

did you thread the function in the beginning? you can do that by putting

thread poster_song_der_eisendrache();
thread poster_song_zetsubou();



in your main function.

By the way if you want to do more than two poster songs I can help you out with that, but you need to be specific with how many you want. this function was just built with my map in mind, and is not exactly easy to manipulate.


ModmeBot:

Reply By: Kingslayer Kyle

Abnormal202

did you thread the function in the beginning? you can do that by putting

thread poster_song_der_eisendrache();
thread poster_song_zetsubou();



in your main function.

By the way if you want to do more than two poster songs I can help you out with that, but you need to be specific with how many you want. this function was just built with my map in mind, and is not exactly easy to manipulate.

I'm pretty sure I didn't actually haha.. What an amateur mistake.. I think I didn't do it because I didn't write the script myself lol

is there any chance you could make 10 for me? And name them ee_song1, ee_song2 and so on and rename the de and zns ones to match that? And is there any chance you could make a function to call from my maps gsc? So that I can have your script in a gsc of its own? Just so that I can keep my map name gsc clean.. Thanks a bunch man really appreciate the help :)


ModmeBot:

Reply By: Abnormal202

Copy a GSC and rename it to ee_songs.gsc. paste this into it:

#using scripts\codescripts\struct;

#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;

#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;

#insert scripts\zm\_zm_utility.gsh;

#using scripts\zm\_load;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;

#using scripts\zm\_zm_score;
#using scripts\shared\ai\zombie_utility;

function init()
{
	thread poster_song_ee_song1();
	thread poster_song_ee_song2();
	thread poster_song_ee_song3();
	thread poster_song_ee_song4();
	thread poster_song_ee_song5();
	thread poster_song_ee_song6();
	thread poster_song_ee_song7();
	thread poster_song_ee_song8();
	thread poster_song_ee_song9();
	thread poster_song_ee_song10();
}
function poster_song_ee_song1()
{
	trig = GetEnt( "ee_song1", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song1", "Dead Flowers"); //swap "ee_song1" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song1");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song1();
		}
		else
		{
			poster_song_ee_song1();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song1");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song1();		
	}
}
function poster_song_ee_song2()
{
	trig = GetEnt( "ee_song2", "targetname"); //swap "ee_song2" for name of song 2
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song2", "Dead Again"); 
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song2");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song2();
		}
		else
		{
			poster_song_ee_song2();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song1");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song2();		
	}
}
function poster_song_ee_song3()
{
	trig = GetEnt( "ee_song3", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song3", "Dead Flowers"); //swap "ee_song3" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song3");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song3();
		}
		else
		{
			poster_song_ee_song3();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song3");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song3();		
	}
}
function poster_song_ee_song4()
{
	trig = GetEnt( "ee_song4", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song4", "Dead Flowers"); //swap "ee_song4" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song4");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song4();
		}
		else
		{
			poster_song_ee_song4();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song4");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song4();		
	}
}
function poster_song_ee_song5()
{
	trig = GetEnt( "ee_song5", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song5", "Dead Flowers"); //swap "ee_song5" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song5");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song5();
		}
		else
		{
			poster_song_ee_song5();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song5");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song5();		
	}
}
function poster_song_ee_song6()
{
	trig = GetEnt( "ee_song6", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song6", "Dead Flowers"); //swap "ee_song6" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song6");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song6();
		}
		else
		{
			poster_song_ee_song6();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song6");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song6();		
	}
}
function poster_song_ee_song7()
{
	trig = GetEnt( "ee_song7", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song7", "Dead Flowers"); //swap "ee_song7" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song7");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song7();
		}
		else
		{
			poster_song_ee_song7();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song7");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song7();		
	}
}
function poster_song_ee_song8()
{
	trig = GetEnt( "ee_song8", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song8", "Dead Flowers"); //swap "ee_song8" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song8");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song8();
		}
		else
		{
			poster_song_ee_song8();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song8");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song8();		
	}
}
function poster_song_ee_song9()
{
	trig = GetEnt( "ee_song9", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song9", "Dead Flowers"); //swap "ee_song9" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song9");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song9();
		}
		else
		{
			poster_song_ee_song9();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song9");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song9();		
	}
}
function poster_song_ee_song10()
{
	trig = GetEnt( "ee_song10", "targetname");
	trig SetHintString( " ");
	trig UseTriggerRequireLookAt();
	trig waittill( "trigger", player);
	if(level.song_is_playing == false)
	{
		trig thread play_2D_sound("ee_song10", "Dead Flowers"); //swap "ee_song10" for name of song 1
		level.song_is_playing = true;	
		trig waittill( "trigger", player);	
		if(level.song_is_playing == true)
		{
			//level.temp_ent StopSounds();
			level.temp_ent StopSound("ee_song10");			
			wait(0.1);
			level.temp_ent delete();
			level.song_is_playing = false;
			poster_song_ee_song10();
		}
		else
		{
			poster_song_ee_song10();
		}
	}
	else if(level.song_is_playing == true)
	{
		level.temp_ent StopSound("ee_song2");
		level.temp_ent StopSound("ee_song10");
		wait(0.05);
		level.temp_ent delete();
		level.song_is_playing = false;
		poster_song_ee_song10();		
	}
}
function play_2D_sound(sound, songname)
{
	level.temp_ent = spawn("script_origin", (0,0,0));
	IPrintLnBold( "Playing:  " + songname  );
	self SetHintString( "Press ^3[{+activate}]^7 to stop playing song");
	level.temp_ent PlaySoundWithNotify(sound, sound + "wait");
	level.temp_ent waittill (sound + "wait");
	wait(0.05);
	if(level.song_is_playing == true)
	{
		level.song_is_playing = false;
		level.temp_ent delete();	
	}
}



in your mapname.gsc, put this above the main function:

#using scripts\zm\ee_songs;



and put this in the actual main function:

thread ee_songs::init();



I haven't tested this out yet, so let me know if you have any problems. You're also gonna have to manually replace where it says "Dead Flowers" to put the name of the song that will be played.


ModmeBot:

Reply By: natesmithzombies

I hate to hijack the post here with another solution, but this one is dynamic (it will update to however many triggers you put in your map) and it requires very few steps to implement.

Step 1) Add this to the bottom of your mapname.gsc:

function many_songs_init()
{
	level.many_song_playing = false; 
	song_trigs = GetEntArray( "ee_song_trigger", "targetname" ); 
	foreach( trig in song_trigs )
		trig thread wait_for_song_trigger( song_trigs ); 
}

function wait_for_song_trigger( original_array )
{
	level endon( "intermission" ); 
	
	self SetCursorHint( "HINT_NOICON" );
	song = self.script_string; 
	
	while( isDefined(self) )
	{
		self waittill( "trigger", player ); 
		if( !zm_utility::is_player_valid(player) ) // stops players who are downed from triggering the songs
			continue; 
			
		ArrayRemoveValue( original_array, self ); 
		PlaySoundAtPosition( "meteor_affirm", self.origin ); 
		self delete(); 
		check_array = GetEntArray( song, "script_string" ); 
		if( !isDefined(check_array) || !check_array.size ) // there are no triggers of this song type left
		{
			if( level.many_song_playing != false )
				foreach( person in GetPlayers() )
					person StopLocalSound( level.many_song_playing ) ;
				
			foreach( person in GetPlayers() )
				person PlayLocalSound( song );  
				
			level.many_song_playing = song; 
		}
	}
}



Step 2) Add this in your function main of your mapname.gsc:

many_songs_init();



Step 3) Add as many triggers around your map (trigger_damage, trigger_use, or trigger_multiple for touch) with the KVP's:

targetname - ee_song_trigger

script_string - your_song_alias_here

I tested this myself so I know it works. The post will be marked as answered. Confirm it works so the topic can be locked.


ModmeBot:

Reply By: Kingslayer Kyle

natesmithzombies

I hate to hijack the post here with another solution, but this one is dynamic (it will update to however many triggers you put in your map) and it requires very few steps to implement.

Step 1) Add this to the bottom of your mapname.gsc:

function many_songs_init()
{
	level.many_song_playing = false; 
	song_trigs = GetEntArray( "ee_song_trigger", "targetname" ); 
	foreach( trig in song_trigs )
		trig thread wait_for_song_trigger( song_trigs ); 
}

function wait_for_song_trigger( original_array )
{
	level endon( "intermission" ); 
	
	self SetCursorHint( "HINT_NOICON" );
	song = self.script_string; 
	
	while( isDefined(self) )
	{
		self waittill( "trigger", player ); 
		if( !zm_utility::is_player_valid(player) ) // stops players who are downed from triggering the songs
			continue; 
			
		ArrayRemoveValue( original_array, self ); 
		PlaySoundAtPosition( "meteor_affirm", self.origin ); 
		self delete(); 
		check_array = GetEntArray( song, "script_string" ); 
		if( !isDefined(check_array) || !check_array.size ) // there are no triggers of this song type left
		{
			if( level.many_song_playing != false )
				foreach( person in GetPlayers() )
					person StopLocalSound( level.many_song_playing ) ;
				
			foreach( person in GetPlayers() )
				person PlayLocalSound( song );  
				
			level.many_song_playing = song; 
		}
	}
}



Step 2) Add this in your function main of your mapname.gsc:

many_songs_init();



Step 3) Add as many triggers around your map (trigger_damage, trigger_use, or trigger_multiple for touch) with the KVP's:

targetname - ee_song_trigger

script_string - your_song_alias_here

I tested this myself so I know it works. The post will be marked as answered. Confirm it works so the topic can be locked.

Im actually on holiday at the moment so I can't test, can you confirm if the songs can be played as many times as you want them to be? (When the song is finished I can activate it again?) And also, do the songs not play over the top of each other? Like how does that work? Can you not activate a song until the current one that's playing is over? Thanks man :)


ModmeBot:

Reply By: Kingslayer Kyle

Also, is there any chance you could do this:

have a hint on the trigger saying "press f to play Easter egg song" and another that says "please wait until current song is over" ? Thanks :D


ModmeBot:

Reply By: Kingslayer Kyle

Or another kvp to add that will define the songs name on the trigger hint that I can set on the trigger so I could set one to say 'press f to play de song' and another trigger say 'press f to play zns song' that would be sweet!!


ModmeBot:

Reply By: Kingslayer Kyle

Because some of the triggers that I'm putting in aren't going to be obvious and I don't want people to have to go round pressing F everywhere to find the songs, so I'd like a hint on the trigger that says 'press f to play "kvp goes here that holds the name of the song" ' and if there's already a song playing then it says 'please wait until current song is finished, and then I just want the songs to be able to be activated as many times as I want with no cap because on some ee song scripts you can only play the song once (sorry for all the comments btw) just wanted to be clear as I can on what I'm trying to achieve so it doesn't confuse you lol