Modding Server Music

Vampire

OpenDayZ Rockstar!
So has anyone played with modding your server music so that your music slider in the options wasn't so useless?

I wanted to add some atmospheric tracks to my server and decided to poke into how dayz does its music instead of smoldering my map in a range of triggers.

What i've found (if its not common knowledge) is that compiles.sqf calls player_music.sqf.
Player_music.sqf is in dayz_code.pbo in the compile folder.
It looks like so:
Code:
private ["_sound","_num","_length","_pause"];
while {!r_player_dead} do {
    _num = floor(random 36);
    _sound = "z_suspense_" + str(_num);
    _length = getNumber(configFile >> "cfgMusic" >> _sound >> "Duration");
    _pause = ((random 5) + 2) + _length;
    if (!r_player_unconscious and !r_pitchWhine) then {
        playMusic _sound;
    };
    sleep _pause;
};

Its randomizing which track to play, getting the length, and then choosing a random point to stop the music track at.

So for one thing, if you wanted to stop all the ambient noise on your server (other than death I believe and sounds for being unconscious) you could just comment out this line in your compiles.
Code:
player_music =                compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf";            //Used to generate ambient music

Since the file names and locations are defined in cfgMusic.hpp which cannot be modified serverside, and cfgMusic's location is defined in config.cpp which also isn't modifiable serverside, there isn't much hope in changing those.

I do think it may be possible to modify player_music.sqf and make it randomize between a bunch of tracks you have defined in your description.ext.
Code:
class CfgMusic
{
  tracks[]={nam,eve};
  class nam
  {
    name = "Music_Name_Here";
    sound[] = {\Music\Sound_Name_Here.ogg, db+1, 1.0};
  };
  class eve
  {
    name = "Music_Name_Here";
    sound[] = {\Music\Sound_Name_Here.ogg,db+1, 1.0};
  };
};
for example.

Dayz randomizes between 37 tracks totaling 19mb so this would of course lead to a large mission file, but I think I'm gonna play around with adding some Namalsk ambience to my Chernarus map.

Anyone else ever play with this?
 
You would have to have your own custom ambient tracks, which would have to be pretty small.
I couldn't really find any ambient clips that sounded good so I haven't added any yet. I did disable the normal dayz music though.
 
yes, I turned off the ambient music dayz. But I can not add a custom.

if you get to run a personalized ambient music list, please post, would be great. : D

Sorry for my english....
 
No problem.

They would need to be small files, like very faint distant screams or gunshots, maybe 5 seconds each.

If I ever find a collection of sounds to add I'll post a tutorial.
 
I now have this going on my server in my signature.

I have 4 different sounds (totalling almost a full 1000kb) that randomly play. (every 15mins - 30mins)
You can actually turn your music slider up (did you know your gear menu makes clicking noises?)

Can we start a better ambient dayz music movement yet?
 
I turned off the DayZ ambient music.

but I can not put my custom music.

as you have modified your file player_music.sqf and description.ext?

Mi player_music.sqf

Code:
private ["_sound","_num","_length","_pause"];
while {!r_player_dead} do {
    _num = floor(random 36);
    _sound = "z_suspense_" + str(_num);
    _length = getNumber(configFile >> "cfgMusic" >> _sound >> "Duration");
    _pause = ((random 5) + 2) + _length;
    if (!r_player_unconscious and !r_pitchWhine) then {
        playMusic _sound;
    };
    sleep _pause;
};

And my description.ext

Code:
class CfgMusic
{
  tracks[]={nam};
  class nam
  {
    name = "Custom_Music";
    sound[] = {\custom\music1.ogg, db+1, 1.0};
  };
};

and no effect ...

Compiles and init are directed to the mission folder
 
Back
Top