Almost Done Music
This is an alternate version of specific time music, where instead of checking the match's time remaining you instead check what the score is. It's also my personal favorite type of music mod.
Last updated
This is an alternate version of specific time music, where instead of checking the match's time remaining you instead check what the score is. It's also my personal favorite type of music mod.
Last updated
Almost Done Music uses the file located in: scripts/vscripts/client/cl_gamestate.gnut
Click here for more info on unpacking/repacking vpks
Because of the location we write our almost done music code in, we need to force it to only run our code one time, because the area we put it in is repeatedly run for updating the game's score. To do this, at the top we'll establish our integer. In this example we'll call it almostdone and set it to 0.
Scroll through until you get to void function TEMP_UpdateRuiScores
which should be around line 350.
Scroll all the way to the bottom of this particular function.
Under the line RuiSetGameTime
is where we'll put our code.
Because we are directly checking the numbers of the score, and these numbers vary widely depending on your gamemode, we'll have to specify scores for each gamemode individually. If you want your music to play near the end of every mode, this can take a while.
Here is a full list of the playable modes with their corresponding GAMETYPE:
AI_TDM = Attrition
ATTRITION = Bounty Hunt
CAPTURE_POINT = Amped Hardpoint
LAST_TITAN_STANDING = Last Titan Standing
CAPTURE_THE_FLAG = Capture The Flag
PILOT_SKIRMISH = Pilots VS Pilots
SPEEDBALL = Live Fire
TITAN_BRAWL = Titan Brawl
COLISEUM = Coliseum
MARKED_FOR_DEATH = Marked For Death
For checking the match score of a particular gamemode, you would write it out like this:
Where [GAMETYPE] is one of the gametypes from above, [score] is the amount of points you would want either team to have before this music starts to play - 1, and [number] is the amount of possible music tracks that can play.
I have the code set up for all the main modes below. These also show my recommended settings for each mode.
For LTS and Live Fire, I recommend setting it up where the music will play if both teams are tied and that round has to be the last. This makes it a bit more climactic and it won't play if one team is one round away but the other team takes it. You can do this by simply putting && between the two team score checks instead of ||.
If you want certain modes to have alternate music play, you can just set up a different variable like you did for almostdone, and check for that instead. This would mainly be good if you want the music in Live Fire, but the buildup is too slow for that mode specifically, so you can make versions with quicker buildups.
You probably don't want your Almost Done music to continue playing after the round/match has reached its conclusion. To turn it off, we have to run the stopvideos command in the area that runs when the match ends. If you've done Victory/Defeat/Draw Music, you'll know where this is.
Scroll until you get to void function ServerCallback_AnnounceWinner
which should be around line 796. You'll see multiple if statements with things in them, the ones we care about contain #GAMEMODE_DRAW
, #GAMEMODE_VICTORY
, #GAMEMODE_DEFEATED
, #GAMEMODE_ROUND_DRAW
, #GAMEMODE_ROUND_WIN
, and #GAMEMODE_ROUND_LOSS
At the end of each of these areas (the same place you would put custom end of match music) you need to add this code:
This runs the stopvideos command, which basically turns off any currently playing custom sounds you have. Because of this, you should put this code BEFORE your custom end of match music, if you have any.
With all that done, you can repack your vpk.
Keep in mind when making your custom audio tracks for this, there's no guarantee on how long it will take the match to end after getting to the score threshold you set up. I recommend making your custom tracks at least 3 minutes long if you want to ensure they don't end before the match does. Of course, the earlier you set your music to play, the larger the margin of error you should account for. Anything can happen!
For round-based modes like LTS and Live Fire, you don't really need to worry about this since the maximum amount of time that the music can play will always be the same, assuming you set it up like I did.
As usual, put your custom .bik files into the media folder and ensure they're named correctly.
Not sure what music to use? You can check out the one's I've already made here.
Write out your aliases in the autoexec like so:
Your music should now be working!