Opening Music

Opening Music plays at the very start of the match.

File Location

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

What To Do

Because of the location we write our opening 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 during the prematch gamestate. To do this, at the top we'll establish our integer. In this example we'll call it startopening and set it to 0.

Next, scroll down until you get to case eGameState.Prematch:, which should be around line 227.

In this case, we're going to write an if-statement to check if startopening is still 0. At the end of this if statement, we'll change startopening to 1, so it won't run again.

                if ( startopening==0 )
                {
                    int musicnumber=RandomInt([number])
                    GetLocalClientPlayer().ClientCommand("opening"+musicnumber)
                    startopening=1
                }

Replace [number] with however many opening tracks you're going to have.

Your code should look something like this. Remember to write this stuff ABOVE the break line.

How to Specify/Exclude Game Modes

GAMETYPE specifies what gamemode you're currently playing. Using this we can have music play for specific modes. Below is all the GAMETYPE names on the left and actual mode names on the right for each playable gamemode.

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 example, I want specific opening music to be played during LTS and Live Fire, otherwise play something else instead. To do that I write 2 if-statements, one checking if the mode isn't Live Fire and isn't LTS, and one checking if the mode is Live Fire or LTS. Squirrel uses & for and, and | for or. Your checks should look something like this:

media and autoexec.cfg

As always, put your bik files in the media folder.

The way it's written in autoexec is the same as most sound mods.

Follow this guide for more info about the autoexec and how to properly set it up.

Last updated