☄️
Cap's Archive Space
  • Welcome
  • Cap's Titanfall 2 Mods v1
    • Welcome!
    • Downloads
    • Custom Audio Repo
    • How-To Guides
      • autoexec.cfg
      • Extract Sound Files
      • Converting to Video
      • Converting to .bik
      • Unpack/Repack .vpk Files
      • How RandomInt Works
    • Mod Guides
      • Killsounds and Deathsounds
      • Lobby Music
      • Victory/Defeat/Draw Music
      • Opening Music
      • Specific Time Music
      • Almost Done Music
      • Announcement Sounds
      • Killstreak Sounds
      • Medal Sounds
      • Announcer
    • Northstar Guides
      • Installing Northstar
      • Modding Northstar
    • Announcers
      • TF2 Administrator
        • Team Fortress 2 Killstreak Mod
      • Halo Announcer
        • Install Guide
        • Mod Settings Info
        • All Medals & Voicelines
        • All Skulls
        • Previous Versions
      • DMC5 Announcer
        • Alternate Downloads
        • Installation Guide
        • In-Depth Guide
        • Configuration
        • Previous Versions
    • Titan OS
      • Titan Fortress 2
    • Text Changes
      • Alternate Titan Ready Text
    • Custom Music
    • Unlocks Reloaded
    • Music Packs
      • MGR Finale Music
    • Speedometer
    • English Text for Various Languages
    • Viewmodels
      • Minimized
    • Joke Mods
      • Shrek.Kill
      • GoFuckYourself
      • Survivor.Death
      • GoMortyYourself
    • Compatibility Patches
Powered by GitBook
On this page
  • File Location
  • What To Do
  • Checking Mode Scores
  • How to force music to stop at end of the match
  • media and autoexec.cfg
  1. Cap's Titanfall 2 Mods v1
  2. Mod Guides

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.

PreviousSpecific Time MusicNextAnnouncement Sounds

Last updated 2 years ago

File Location

Almost Done Music uses the file located in: scripts/vscripts/client/cl_gamestate.gnut

What To Do

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.

Checking Mode Scores

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:

	if(GAMETYPE==[GAMETYPE] && (GameRules_GetTeamScore(friendlyTeam) > [score] || GameRules_GetTeamScore(enemyTeam) > [score]) && almostdone==0)
	{
		int totalnumber = RandomInt([number])
		GetLocalClientPlayer().ClientCommand("almostdone"+totalnumber)
		almostdone=1
	}

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.

How to force music to stop at end of the match

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:

GetLocalClientPlayer().ClientCommand("stopvideos")

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.

media and autoexec.cfg

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.

Write out your aliases in the autoexec like so:

Your music should now be working!

Not sure what music to use? You can check out the one's I've already made .

here
Click here for more info on unpacking/repacking vpks
Click here for more info on .bik files
Click here for more info on the autoexec