Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ["_sound","_length","_pause","_enableAmbient","_minWaitTime","_maxWaitTime","_musicArray","_waitTimeDifference","_randomWait"];
- /////////////////////////////////////////////
- //// Vampire's Better Ambient Music v1 //////
- /////////////////////////////////////////////
- // Enable Ambient music? true/false
- _enableAmbient = true;
- // 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 = 60;
- // 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 = 120;
- // 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 = ["Track_1", "Track_2", "Track_3","Track_4","Track_5","Track_6","Track_7","Track_8","Track_9"];
- while {!r_player_dead && _enableAmbient} do {
- // 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;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement