> For the complete documentation index, see [llms.txt](https://captaindiqhedd.gitbook.io/caps-archive-space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://captaindiqhedd.gitbook.io/caps-archive-space/caps-titanfall-2-mods-v1/how-to-guides/autoexec.cfg.md).

# autoexec.cfg

How to create the autoexec.cfg file if you don't already have it, and how to make sure the game calls it.

## What is it?

autoexec.cfg is a config file with lines of commands, that executes upon opening the game. For the most part, we use this file to establish aliases so the game knows what we want when we command it to do certain things. Without this, the game will just see our commands as gibberish and never play anything.

## File Location

If you own the game on Steam, autoexec.cfg should be located in:\
**\[game's drive, likely C:]/Program Files (x86)/Steam/steamapps/common/Titanfall2/r2/cfg/autoexec.cfg**

If you own the game on Origin, autoexec.cfg should be located in:\
**\[game's drive, likely C:]/Program Files (x86)/Origin Games/Titanfall2/r2/cfg/autoexec.cfg**

If this file does not exist, that's okay! You can make it yourself.

## Creating autoexec.cfg

To create this file, simply right click in the cfg folder, go to New>Text Document.

This creates a .txt file. We need to change its extension to .cfg. If you can't see the file's extension, in File Explorer click View, and in the Show/hide section check **File name extensions**.

<figure><img src="https://3229178430-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyzWpbBNlNErdKoq8n9DL%2Fuploads%2FG8p2P9ghSIGGVIQAD7Zw%2Fbandicam%202021-09-15%2015-34-02-349.png?alt=media&amp;token=b9e4d4c3-1df3-440a-902e-55ff70ab0109" alt=""><figcaption></figcaption></figure>

Rename this file to autoexec, and change its extension to .cfg.

<figure><img src="https://3229178430-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyzWpbBNlNErdKoq8n9DL%2Fuploads%2FcrbA2c8PrgHz8iZHQUni%2Fbandicam%202021-09-15%2015-45-26-865.png?alt=media&amp;token=ee9e0931-bcd3-46c9-9ed2-e476ce88f2f8" alt=""><figcaption></figcaption></figure>

## Executing autoexec.cfg

In order for the autoexec to actually execute when the game starts, you need to go into the game's launch options and write this command:

```
+exec autoexec.cfg
```

To get to the launch options on Steam, right click the game, go to Properties, and it's in the General section.

<figure><img src="https://3229178430-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyzWpbBNlNErdKoq8n9DL%2Fuploads%2FtcaJxWQ82tE7zbXHSvr5%2Fbandicam%202021-09-15%2015-49-41-246.png?alt=media&amp;token=e9aa9fc1-3f9d-464f-8a26-5cc40c8b9af3" alt=""><figcaption></figcaption></figure>

To get to the launch options on Origin, click the gear/settings icon while the game is selected in your library, click Game Properties, and click the Advanced Launch Options tab.

<figure><img src="https://3229178430-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyzWpbBNlNErdKoq8n9DL%2Fuploads%2FI5RZF4WyeFGz9aWFA7rp%2Fbandicam%202021-09-15%2015-51-46-447.png?alt=media&amp;token=b2131446-4f38-48e2-954a-40c414ae646a" alt=""><figcaption></figcaption></figure>

Make sure the launch option is saved, and your autoexec is now properly set up! The file is probably empty right now, but we'll be adding to it as we make more and more custom sounds.\
**(you can open the .cfg just like a .txt file, with Notepad or other similar programs)**

The next section just demonstrates how the autoexec works.

## How does it work? (example)

For custom deathsounds, we write this code in **cl\_obituary.gnut**:

<figure><img src="https://3229178430-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyzWpbBNlNErdKoq8n9DL%2Fuploads%2FtCF1maU8ND85q5cr2Qw0%2Fbandicam%202021-09-15%2016-04-50-663.png?alt=media&amp;token=149b2765-f93e-4080-ae12-fe82a080cbe6" alt=""><figcaption></figcaption></figure>

After choosing a random variable, we tell it to run a client command named deathsound, followed by the random variable it selected.

Normally, a client command called deathsound does not exist. Using the autoexec, we make it exist.

<figure><img src="https://3229178430-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyzWpbBNlNErdKoq8n9DL%2Fuploads%2FFhg6QFQyi0idWMQAs71X%2Fassets_-MbT6A_iN6z35klmSlMZ_-MjfGGx1G8PC9X0V3Z10_-MjfHU8sZ-fg1j2M6Rqf_bandicam%202021-09-15%2016-05-31-375.webp?alt=media&amp;token=c3bc8beb-6bb1-4b7c-a885-df0074cd68f6" alt=""><figcaption></figcaption></figure>

**alias deathsound\[number]** makes the command exist. After naming this command, we put into quotations what the command *actually* does. In this (and most) instances, we tell it to run the **playvideo** command, followed by the name of the video. While you don't *HAVE* to, it's easier if you name your video files the exact same as each of their aliases.

These aliases can also run multiple commands at once if they're separated with a semicolon (;). This is required for Custom Lobby Music to properly function.

<figure><img src="https://3229178430-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyzWpbBNlNErdKoq8n9DL%2Fuploads%2FK5lVAAcp0humIJ9wr9nL%2Fbandicam%202021-09-15%2016-16-23-423.png?alt=media&amp;token=2c764715-4c1f-4d70-8fb6-39f9780b0166" alt=""><figcaption></figcaption></figure>

**alias lobbymusic\[number]** sets up the command.\
**stopvideos** stops any other custom sounds that are currently playing.\
**playvideo** plays the specified video.\
**1 1** specifies the width and height of the video.\
**deathtips\_tip5 \[time]** tells it to wait that long, in seconds, before going to play a new lobbymusic track.

Hopefully this section helped you better understand how the autoexec functions.
