Garry's Mod

Garry's Mod

28 ratings
Dynamic Music Triggers
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Effects
Addon Tags: Roleplay, Realism
File Size
Posted
Updated
7.164 KB
28 May @ 1:37pm
8 Jul @ 5:15am
5 Change Notes ( view )

Subscribe to download
Dynamic Music Triggers

In 1 collection by Coffee Man
Coffee Man's Gameplay-Enhancing Addons
67 items
Description
My dynamic music addon that I use when playing. Triggers a random action music track to play when you're in a dangerous action-ish situation for long enough. Once triggered, the entire music file plays until the end.

This addon behaves very similarly to how music works in Half Life 1 and 2, but instead of playing music in specific scripted spots, music is triggered dynamically when you're in danger.

This addon contains NO music files. Either get my music pack here or another one here, or add your own. Or do both, add as much music to the total roster as you want.





How to add your own music:
  • Place your mp3 music files inside the GarrysMod\garrysmod\addons\YOUR_ADDON_FOLDER\sound\music_stresscombat folder.

  • If the music_stresscombat folder doesn't exist in the specified directory, simply create it and place your music in it.

  • Only mp3 music files are supported. Highly recommended to keep your music files below 4 minutes long. Make sure your mp3 music is 44100hz.

  • Recommended to use Mute Campaign Music to prevent vanilla music from overlapping with your music.

  • You can grab the tracks I used during the development of this addon here. They are not mandatory to have.

  • Recommended to add a fade-in effect to your tracks if they abruptly start for a smoother experience.




Convars:
  • music_stress_enabled 1 / 0 - Enable or disable the addon.

  • music_stress_volume 0.0 - 10.0 - Change the playing volume of action tracks. Will not affect already playing tracks!




How does the addon work:
  • This addon was made specifically for Single Player. It WILL NOT work correctly in Multiplayer.

  • The system was designed to not be overly present in your game, and it'll try to trigger music only on high-action moments where you're typically expected to blast fools and get blasted yourself a lot.

  • You're assigned a "Stress meter" that works in the background. When you spawn, you're assigned a random low stress value and also a random max stress value.

  • Stress is consistently increased by killing specific NPCs, getting hit by specific NPCs and occasionally when shooting a NPC with bullets. Different NPCs have different stress values, refer to the table below for the whole thing.

  • Added stress is doubled if you kill multiple NPCs within a very short time span. Same goes for damage taken, repeatedly taking damage within a very short time span will double added stress.

  • Being at low health will also double added stress from all sources. Being at very low health will quadruple added stress from all sources.

  • Stress decays and reduces on it's own every so often. If there's action going on, your stress will increase faster than it can decrease. If there's f*ck all going on, stress will simply decrease.

  • When stress reaches it's assigned max value, a random music track will trigger and play through it's entirety. Stress is also set back to a random low value and frozen for 4 minutes, 4 minutes being the cooldown before stress can increase or decrease again.

  • It's recommended to keep your own music tracks below 4 minutes as that's how long the cooldown timer is. It doesn't make sense to have anything that long for this type of addon anyway.

  • Dying and respawning will stop any playing music and will also reset your stress state.

  • Getting riddled with bullets by multiple enemies with SMGs/Assault Rifles for long enough is a guaranteed way to trigger a music track.




Limitations:
  • The addon lacks customization as I made it for myself. If you want to modify or further add on top of this addon to create your variant, you're welcome to do so.

  • This addon will not work in Multiplayer (and obviously when fighting other players). NPCs outside of the specified ones will also not do anything regarding the stress meter.

  • Depending on what maps you play on, you might get a music trigger just as you're done after a big combat encounter, leading to an action track awkwardly playing in your ear while you got nothing to shoot at.

  • When prototyping, originally I wanted bullets that landed or passed near you to also add stress, but I couldn't figure out an optimized way to make this work without impacting performance, so this was cut.

  • It was not tested what happens if there's no music tracks in the tracks folder, because I'm a lazy prick. You've been warned.




Credits:




Technical stuff:
  • The format below shows all the NPCs that work with this addon. The values alongside are "Stress Added when you kill them" followed by "Stress Added when you're attacked by them".

    npc_combine_s: 4, 2
    npc_metropolice: 4, 2
    npc_zombie: 4, 2
    npc_zombie_torso: 4, 2
    npc_fastzombie: 4, 2
    npc_fastzombie_torso: 4, 2
    npc_poisonzombie: 5, 3
    npc_zombine: 5, 3
    npc_antlion: 4, 2
    npc_antlion_worker: 5, 3
    npc_hunter: 20, 10
    npc_sniper_combine: 10, 30
    npc_headcrab: 4, 2
    npc_headcrab_fast: 4, 2
    npc_headcrab_black: 4, 2
    npc_antlionguard: 40, 20
    npc_antlionguardian: 40, 20
    npc_combinegunship: 40, 20
    npc_helicopter: 40, 20
    npc_manhack: 4, 2
    npc_rollermine: 4, 2
    npc_strider: 40, 20


  • There's also a 20% chance to increase stress by 1 every time you land a hit on a NPC.

  • Stress meter can be from 0 to 100. When spawning, you're randomly assigned a value from 0 to 20, and the max value needed for a music trigger is also randomly set from 80 to 100.

  • Stress decays by 1 every second. Added stress is doubled if you keep killing NPCs within 3 seconds from the last NPC killed. Added stress is also doubled if you keep getting hit within 2 seconds from the last hit.

  • Being at 35 health or below will activate another 2x multiplier to added stress from all sources.

  • Being at 21 health or below will activate another 4x multiplier to added stress from all sources.


5 Comments
jangwmpt7 2 Jun @ 5:31pm 
I tried this. Also, I created a music pack for this addon that contains (most, but not all) music from 2005-2019 Need For Speed titles, including Most Wanted 2005, Carbon, ProStreet, Undercover, Hot Pursuit 2010, The Run, Rivals, the 2014 movie, the 2015 reboot, Payback, and Heat. However, I currently don't have any plans on releasing it to the public soon...
Electric Kool-Aid 1 Jun @ 11:40pm 
second this. Not asking for ambience all the time, but maybe just at random when no enemies are present, music starts playing and when the track ends it fades back to silence. Kind of like in RDRII when you're riding around and some subtle ambience plays on occasion
Armalad 31 May @ 6:29am 
Fair enough. I just share the same sentiment of awkwardness when a combat track suddenly fades out which is the case for a lot of dynamic music addons. I'm just really excited for a different take that takes various factors into account as well as letting the track play to its end. Again, problem with most dynamic music addons being the very jarring sudden start and stop. I just figured adding ambient tracks to this would make it a cool alternative.
Coffee Man  [author] 31 May @ 6:24am 
That sounds good in concept, but then it would be just "another dynamic music" addon with a cooldown between tracks. The reason I made this system was because I wasn't satisfied with how the existing dynamic music addons work. I've always liked how Half Life 1 and 2 use action music rather sparingly, but when it does happen, it hits GOOD! So that's what I tried to make dynamic.

I'd much rather have the map ambience until shit hits the fan, which is when the game slowly fades in a bitch bitchin' track and you go absolutely ham on the enemy's ass. Think of it like your protagonist going on a temporary power trip 😎💪
Armalad 31 May @ 5:27am 
This sounds sick. Would you consider updating this to include ambient tracks during low-stress?