So, can we all agree that the normal ambient music in dayz sucks? All of these tracks here?
Then you need to define your new tracks in your description.ext like this.
You need to put the class names in the player_music.sqf music array.
The sound files also have to be .ogg files like any arma 2 sounds.
The duration is the length of the track in seconds. This needs to be correct.
For neatness I put all of my tracks in a folder in the mission.pbo called "Ambience", but you can put them where you like.
The length and size of your ambient tracks are only limited by how big you want to make your mission file, but the size grows fast.
Hopefully we can get some servers going that have some awesome custom ambient music instead of the default and actually give our music sliders some use!
I've added 4 ambient tracks to my server, so if you want to see these in action, turn your music slider up, and play around on my Epoch server for a little while.
The first time you hear that screeching grinding metal noise in game, you almost crap yourself, and then go into the settings to turn music off. Most people never turn it back on afterwards for any reason. This makes adding things like server intro music pointless if no one will be able to hear it without first turning their music back up.
So how can we start to make this better? I want to try to get as many servers as possible to start disabling rocket's ambient music so we can actually start playing with our music turned up.
To do this, you make a custom compiles (copied from your client) and simply comment out this line after adding it to your mission.pbo by putting a double slash in front of it.
Code:
player_music = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf";
But why should we stop there when we can add our own custom ambient music! No more smothering the map in triggers to add your own custom ambient sounds, just have them play dynamically for everyone!
Instead of commenting out that line, include a custom player_music.sqf in your mission file.
Use the script below. I've made it really simple.
Code:
private ["_sound","_length","_pause","_enableAmbient","_minWaitTime","_maxWaitTime","_musicArray","_waitTimeDifference","_randomWait"];
/////////////////////////////////////////////
//// Vampire's Better Ambient Music v1 //////
/////////////////////////////////////////////
// Enable Ambient music? true/false
_enableAmbient = true;
while {!r_player_dead && _enableAmbient} do {
// Minimum amount of time before running the next track (in seconds)
// Default for my script is 10 minutes. (600 seconds)
// Must be less than the maximum wait time.
_minWaitTime = 600;
// Maximum amount of time before running the next track (in seconds)
// Default for my script is 30 minutes. (1800 seconds)
// Must be more than the maximum wait time.
_maxWaitTime = 1800;
// The array of your ambient tracks. These must match the class of a
// cfgMusic entry either in the default DayZ cfgMusic or Description.ext
// In your Mission.pbo. (Example: class bombs)
// It will choose a random track from this array.
_musicArray = ["alarm", "bombs", "gunfire","wind"];
// Pick a sound
_sound = _musicArray select floor random count _musicArray;
// Get it's length from the cfgMusic/Description.ext
_length = getNumber(configFile >> "cfgMusic" >> _sound >> "Duration");
// Lets figure out the random wait time
_waitTimeDifference = ((_maxWaitTime) - (_minWaitTime));
_randomWait = (random (_waitTimeDifference));
_pause = (_randomWait) + (_length);
// Play the song
if (!r_player_unconscious and !r_pitchWhine) then {
playMusic _sound;
};
// Let the script sleep the song length and the random amount of time
sleep _pause;
};
Then you need to define your new tracks in your description.ext like this.
Code:
class CfgMusic
{
tracks[]={bombs,etc};
class bombs
{
name = "bombs";
sound[] = {"Ambience\bombs.ogg", db+0, 1.0};
duration = 13;
};
class etc
{
name = "etc";
sound[] = {"Ambience\etc.ogg", db+0, 1.0};
duration = 5;
};
};
The sound files also have to be .ogg files like any arma 2 sounds.
The duration is the length of the track in seconds. This needs to be correct.
For neatness I put all of my tracks in a folder in the mission.pbo called "Ambience", but you can put them where you like.
The length and size of your ambient tracks are only limited by how big you want to make your mission file, but the size grows fast.
Hopefully we can get some servers going that have some awesome custom ambient music instead of the default and actually give our music sliders some use!
I've added 4 ambient tracks to my server, so if you want to see these in action, turn your music slider up, and play around on my Epoch server for a little while.