Modme Forums

[TUTORIAL] How to play music while hellhounds are spawning

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


ModmeBot:

Thread By: Collie

**HERE IS A DEMONSTRATION OF THE CODE**

Hi all, today I'm going to teach you how to play music while hellhounds are spawning. If you're familiar with cut content in World At War, you might know that it was originally planned to have music play while hellhounds were spawning. It was cut for unknown reasons, but the music for it still exists for both Shi No Numa and Der Reise (You can listen to Shi No Numa's one here and Der Reise's here). Ever since I learned that I've wanted to see it in game, and now that I've discovered how to do it I wanted to share it with the community! For this example, we'll be using Shi no Numa's hellhound theme (Feel free to use whatever you like though):

It's very simple, just input this function into your script and have it called by a on_player_connect() function:

function hellhound_monitor()
{
	self endon("disconnect");
	for(;;)
	{
		level waittill("dog_round_starting"); //This makes the script wait until a Hellhound round begins.
		wait(2.8);
		self PlaySoundToPlayer("hellhounds", self);
		level waittill( "last_ai_down", e_last ); //This makes the script wait until the last dog has been killed.
		self StopSound( "hellhounds" );
	}
}



Make sure to call the function in a "on_player_spawned()" function, and use the self modifier on the call or else the song may not play for every player. Here's what it should look like to call the function:

self thread hellhound_monitor();



That's it, you don't need any other code other than the one to call the function. No includes or anything, since all this is done using engine functions.

Now add this line to your sound alias:

hellhounds,,streamed,Collie\mus\hellhounds.wav,,,,,,,,,grp_music,snp_never_duck,default,0,,90,90,,,,,,,,4,reject,,,0,0,100,100,,,,2d,music_all,,NONLOOPING,,,,,,,,,,,,,,,,,,,,,,no,yes,,50,0,yes,no,,,,,,,no,,,,,,,,,,,,,,,,,,,,,,,no,,,



Edit the volume, filepath, and fade in time (It's in miliseconds) as nessisary. Do not edit anything else unless you know what you're doing, it could break the playback of the sound.

Make sure the song is long (I reccomend about 5 minutes) so that the song does not end while hellhounds are still spawning. The reason why I didn't make it a looping sound is because you can't control the volume with a looping sound, and it was too quiet for my tastes. If you still would prefer to use a looping sound, replace the two playback code lines with the following:

self PlayLoopSound("hellhounds", 1);
self StopLoopSound(1);



And change "nonlooping" to "looping" in the alias.

Congrats, you now have custom sound playing during hellhound rounds, as it was meant to be.

EDIT: Fixed the sound alias. Had four numbers one comma off from where they should have been.


ModmeBot:

Reply By: Ping998

This works brilliantly! Thank you so much Collie! :)


BIGCountry77x:

I want to use a custom song, can you help me with this?