大厅背景音乐

更改大厅背景音乐指南。

前期准备

Navigate to your folder and find this folder:

Origin Games\Titanfall2\vpk\

Copy these file and paste them in an empty folder somewhere else:

  • englishclient_mp_common.bsp.pak000_dir.vpk

  • client_mp_common.bsp.pak000_000.vpk

You will need the Titanfall VPK Tool, the program which will allow you to open and repack Titanfall VPK files and RAD Tools Bik, which lets you convert videos to the BIK format, both found here.

解包

Now that these files have been backed up and everything installed, navigate to your game folder and open this file using the VPK tool:

Origin Games\Titanfall2\vpk\englishclient_mp_common.bsp.pak000_dir.vpk

How to extract VPK's properly?

编辑

To add custom music open this file using Notepad:

EXTRACTED-VPK\scripts\vscripts\client\cl_music.gnut

and use CTRL+F to search for void function LoopLobbyMusic()

Place this under string soundAlias:

    int musicLenght;
    while(true)
    {
        musicLenght = GetConVarInt("sp_deathtips_tip6")
        GetLocalClientPlayer().ClientCommand("lobbymusic")
        wait musicLenght;
    }

The final product should look like this:

void function LoopLobbyMusic()
{
	string soundAlias
	int musicLenght;
	while(true)
	{
		musicLenght = GetConVarInt("sp_deathtips_tip5")
		GetLocalClientPlayer().ClientCommand("lobbymusic")
		wait musicLenght;
	}	
	
	bool classicMusicAvailable = !IsItemLocked( GetLocalClientPlayer(), "classic_music" )

	if ( GetConVarBool( "sound_classic_music" ) && classicMusicAvailable )
		soundAlias = "music_lobby_ambient_classic"
	else
		soundAlias = "music_lobby_ambient"

	if ( file.currentMusicPlaying == soundAlias )
		return

	clGlobal.levelEnt.Signal( "MusicPlayed" )
	clGlobal.levelEnt.EndSignal( "MusicPlayed" )
	clGlobal.levelEnt.EndSignal( "MusicStopped" )

	entity player = GetLocalClientPlayer()
	OnThreadEnd(
	function() : ( player )
		{
			if ( IsValid( player ) && file.currentMusicPlaying != "" )
				FadeOutSoundOnEntity( player, file.currentMusicPlaying, DEFAULT_FADE_TIME )
		}
	)

	file.currentMusicPlaying = soundAlias

	while ( true )
	{
		wait 2.0 //Hack. Make music restarting in lobbies slightly less bad.

		player = GetLocalClientPlayer()
		if ( !IsValid( player ) )
			return

		var soundHandle = EmitSoundOnEntity( player, soundAlias )

		WaitSignal( soundHandle, "OnSoundFinished" )
	}
}

After editing the file save it and move to the next step.

创建autoexec.cfg

To easily change your music you need to use a config file.

start by creating a file named autoexec.cfg in:

Origin Games\Titanfall2\r2\cfg

After creating the file open it with Notepad and paste the following in the file:

alias lobbymusic "playvideo lobbymusic 1 1 1; sp_deathtips_tip5 LENGHT"

and replace LENGHT with the lenght of your music in seconds.

After saving add +exec autoexec.cfg to your launch options for titanfall on Origin.

转换声音文件

To use custom sounds in Titanfall 2 we need to use a workaround and play them as video instead. Use RAD Tools to convert a music video to a .bik video. The music HAS to be as a video for it to work.

Open RAD Tools and navigate to the location of your downloaded video. Select the video and press the BINK IT! button. In the menu that opens name the sound to lobbymusic.bik and press the Bink button on the right side of the window.

After compressing the video using RAD Tools move the new lobbymusic.bik to

Origin Games\Titanfall2\r2\media

Remember to change LENGHT in the autoexec to the lenght of your video for proper looping.

You can turn down the original lobby music in the ingame settings.

重新打包

How to repack VPK files properly ?

After following step by step the previous link

Rename pak000_000.vpk to client_mp_common.bsp.pak000_000.vpk

Rename pak000_dir.vpk to englishclient_mp_common.bsp.pak000_dir.vpk

Place both of the renamed files back into your game directory and then launch Titanfall 2 and open multiplayer. You should be able to hear your music.

Origin Games\Titanfall2\vpk\

最后更新于