Arma 3
Not enough ratings
Dynamic Ambient Soundtrack
By JackFighter
This guide will help you to install Dynamic Ambient music in your various missions.
   
Award
Favorite
Favorited
Unfavorite
Introduction
I always found interesting the usage of dynamic ambient soundtracks in games with a more or less open environment (e.g, Fallout, TES...). In my opinion, dynamic music change based on combat/calm state always gives players more immersion and brings the overall joy of the gaming process higher.
Unfortunately, Arma doesn't have anything similar in terms of dynamic music so I decided to do it myself. The base concept of this script was made in late 2019 and was used mainly for SP/private MP scenarios being constantly polished throughout these years. I'm not a very experienced scripter, but I tried to make this performance-friendly as much as possible so all suggestions are more than welcome.
The script is very customizable, so you can even come up with your own music (or, more likely, ripped off from other games, just don't tell anyone :)...)
I'll try to explain everything as simply as I can in the lower sections. If you are an experienced scripter, or just know basic things outside of editor this shouldn't be a big problem for you.
Installation slightly varies between SP and MP.
You can use any text editor you prefer (I use Notepad++).
If you need any help with this please feel free to contact me.
Installation for Vanilla
For Singleplayer:
1. Create init.sqf in your mission folder
2. Create folder Scripts in your mission folder
3. Create in your script folder DynamicAmbient.sqf
4. Create in your script folder onLoadEH.sqf
5. Paste script launch and event handler[pastebin.com] in init.sqf
6. Paste main script[pastebin.com] in DynamicAmbient.sqf
7. Paste event handler script[pastebin.com] in onLoadEH.sqf

For Multiplayer
1. Create initPlayerLocal.sqf in your mission folder
2. Create folder Scripts in your mission folder
3. Create in your script folder DynamicAmbient.sqf
4. Paste script launch[pastebin.com] in initPlayerLocal.sqf
5. Paste main script[pastebin.com] in DynamicAmbient.sqf
Installation for CUP
You need CUP Terrains Core for this one to work!

For Singleplayer:
1. Create init.sqf in your mission folder
2. Create folder Scripts in your mission folder
3. Create in your script folder DynamicAmbient.sqf
4. Create in your script folder onLoadEH.sqf
5. Paste script launch and event handler[pastebin.com] in init.sqf
6. Paste main script[pastebin.com] in DynamicAmbient.sqf
7. Paste event handler script[pastebin.com] in onLoadEH.sqf

For Multiplayer
1. Create initPlayerLocal.sqf in your mission folder
2. Create folder Scripts in your mission folder
3. Create in your script folder DynamicAmbient.sqf
4. Paste script launch[pastebin.com] in initPlayerLocal.sqf
5. Paste main script[pastebin.com] in DynamicAmbient.sqf
Installation for S.O.G. Prairie Fire CDLC
For Singleplayer:
1. Create init.sqf in your mission folder
2. Create folder Scripts in your mission folder
3. Create in your script folder DynamicAmbient.sqf
4. Create in your script folder onLoadEH.sqf
5. Paste script launch and event handler[pastebin.com] in init.sqf
6. Paste main script[pastebin.com] in DynamicAmbient.sqf
7. Paste event handler script[pastebin.com] in onLoadEH.sqf

For Multiplayer
1. Create initPlayerLocal.sqf in your mission folder
2. Create folder Scripts in your mission folder
3. Create in your script folder DynamicAmbient.sqf
4. Paste script launch[pastebin.com] in initPlayerLocal.sqf
5. Paste main script[pastebin.com] in DynamicAmbient.sqf
Installation for custom music files
First of all, you need your music files to be in .ogg format.
Create a folder called Music in your mission folder and put all the tracks in it.
Create a file called my_soundtrack.hpp in Music folder
Create a description.ext in your mission folder and paste this in it:
#include "Music\my_soundtrack.hpp"

Now paste this template in my_soundtrack.hpp
class CfgMusic { tracks[] = {}; class track1 { name = "track1"; sound[] = { "\Music\track1.ogg", db + 0, 1.0 }; }; class track2 { name = "track2"; sound[] = { "\Music\track2.ogg", db + 0, 1.0 }; }; class track3 { name = "track3"; sound[] = { "\Music\track3.ogg", db + 0, 1.0 }; }; };
class = should be equal to name
name = name that is going to be used in scripts
sound = path to the file itself

Now take Vanilla Dynamic Ambient[pastebin.com] and insert your tracks instead of standard class names written there:
// Definition of tracks actionAmbient = [ "track1", "track2", "track3" ];
actionAmbient — music that will play during shootouts
dayCalmAmbient — music that will play during calm times at day
nightCalmAmbient — music that will play during calm times at night

Find this line
_enemyAwareness = opfor knowsAbout player; // <-------------------------------could be blufor, opfor or independent
Change (or don't) "opfor" for whatever side enemies are in (could be blufor, opfor or independent)

Now save it all as DynamicAmbient.sqf and follow instructions below:
For Singleplayer:
1. Create init.sqf in your mission folder
2. Create folder Scripts in your mission folder
3. Put DynamicAmbient.sqf in your script folder
4. Create in your script folder onLoadEH.sqf
5. Paste script launch and event handler[pastebin.com] in init.sqf
6. Paste event handler script[pastebin.com] in onLoadEH.sqf

For Multiplayer
1. Create initPlayerLocal.sqf in your mission folder
2. Create folder Scripts in your mission folder
3. Put DynamicAmbient.sqf in your script folder
4. Paste script launch[pastebin.com] in initPlayerLocal.sqf

Credits
Bohemia interactive for such an amazing game.
Savage Game Design for beautiful CDLC
CUP Team for an astonishing addons
Official Arma 3 discord (especially Lou Montana) for various hints

Tinker, modify and use as you wish, just don't forget to give a credit to the author :)