Team Fortress 2

Team Fortress 2

评价数不足
How to Remove the Coconut from the Team Fortress 2 Files
由 Zaptoshi 制作
Can a single, high-quality image of a coconut really break the game? Well, if you truly are willing to spend the time and patience to try...
   
奖励
收藏
已收藏
取消收藏
Clearing Misconceptions
This trending post originally mentioned the existence of the coconut in the game files. Several months later, another post about the coconut would make the file trending again, now including a “developer's note”.


The first misconception is that the coconut is a JPG or a PNG file, often written as "coconut.jpg" or "coconut.png". Just like every other texture in Source Engine games, the image is stored as a VTF and VMT file named "coconut".




Using the program VTFEdit, you can export coconut.vtf to the JPG, PNG, BMP, and TGA file formats. The original poster must have exported the file as JPG and then included the file extension with the name.




The second misconception is that the supposed developer's note is from the source code.

"//I have no ♥♥♥♥♥♥♥ idea who put this here, but when I deleted it the game wouldn’t start. Words cannot describe my ♥♥♥♥♥♥♥ confusion."

This is a joke comment made by a commenter on the original post and was somewhat cleared up in the replies. After the second trending coconut post, they made a post to clarify about how the note isn't real.

I think many people believed this due to the thought that the TF2 source code wasn't well written, especially after watching the video about the TF2 developers' frustration towards the source code.

Still, what if you removed it?
Renaming, replacing, or only removing either the VTF or the VMT file are a few ways to approach this but some may subject that these methods aren’t completely removing the files.

It is recommended to create a backup of the files used in this guide or otherwise verify the integrity of the game files (In Steam, right click on Team Fortress 2, Properties... > Local Files > Verify integrity of game files...) if something goes wrong.
Software Programs
GCFScape[nemstools.github.io] - Useful for finding files inside VPK files and learning the file paths before extracting. Good alternative to vpk.exe for extracting files.

You can use VPKEdit[github.com] or Source 2 Viewer[valveresourceformat.github.io] instead of GCFScape, which are more easier to use.

VTFEdit[nemstools.github.io] - Not necessary at all, but can allow you to look at VTF files.
UI-Friendly Methods
I've found out about the previously mentioned VPKEdit and Source 2 Viewer more recently, which are more nicer and easier to use. You can pretty much do the unpacking and packing without needing to go into the command line yourself. There are possibly more similar programs out there, but these are what I've used for a bit.

VPKEdit
Method 1
  1. In VPKEdit, go to File > Open... or File > Open In... > Team Fortress 2.
  2. Navigate to Steam\steamapps\common\Team Fortress 2\tf directory and open tf2_textures_dir.vpk.
  3. Right click > Remove File on coconut.vtf located in tf2_textures\materials\effects.
  4. Navigate to Steam\steamapps\common\Team Fortress 2\tf directory and open tf2_misc_dir.vpk.
  5. Right click > Remove File on coconut.vmt located in tf2_misc\materials\effects.
  6. Save both VPK files afterwards.
Method 2
  1. In VPKEdit, go to File > Open... or File > Open In... > Team Fortress 2.
  2. Navigate to Steam\steamapps\common\Team Fortress 2\tf directory and open tf2_textures_dir.vpk.
  3. Extract the contents to your disk (Edit > Extract All).
  4. Remove "_dir" from the folder name.
  5. Repeat steps 1 through 4 for tf2_misc_dir.vpk.
  6. Remove coconut.vtf located in tf2_textures\materials\effects.
  7. Remove coconut.vmt located in tf2_misc\materials\effects.
  8. Pack both folder into separate VPKs with their respective names by using the File > Create From Folder.. option. Set the version to v2 when packing.
  9. Replace the existing tf2_texture and tf2_misc VPKs in the tf\ folder with the modified VPKs.
Source 2 Viewer
  1. In Source 2 Viewer, go to File > Open.
  2. Navigate to Steam\steamapps\common\Team Fortress 2\tf directory and open tf2_textures_dir.vpk.
  3. Extract the contents to your disk (Right click on the file name > Extract as is).
  4. Remove "_dir" from the folder name.
  5. Repeat steps 1 and 4 for tf2_misc_dir.vpk.
  6. Remove coconut.vtf located in tf2_textures\materials\effects.
  7. Remove coconut.vmt located in tf2_misc\materials\effects.
  8. Pack both folder into separate VPKs with their respective names.
    1. Go to File > Create VPK from folder.
    2. Delete the README.txt file.
    3. Right click on new.vpk > Add existing folder and select the tf2_textures folder.
    4. Save by right clicking on new.vpk > Save VPK to disk with the name tf2_textures.
    5. Repeat the previous steps with tf2_misc in a new VPK file.
  9. Replace the existing tf2_texture and tf2_misc VPKs in the tf\ folder with the modified VPKs.
vpk.exe Method (old)
Unpacking the VPK Files
Method 1 - GCFScape
You can open the VPK files in GCFScape and extract by the "root" file for both tf2_misc_dir.vpk and tf2_textures_dir.vpk. Remember to rename the folders back to their correct names (tf2_misc and tf2_textures) since both will be named "root" at first.

Method 2 - vpk.exe
Unpacking with vpk.exe currently doesn't work (Ex. vpk.exe is generating the folders, but not the actual files). This is just here just in case it works again and somehow Method 1 didn't work out for you.

Go to the Team Fortress 2\ bin folder (Steam\steamapps\common\Team Fortress 2\bin).

There is an executable called vpk.exe, which can unpack VPK files and pack other files into VPK files.
-------
Go to the tf\ folder (Steam\steamapps\common\Team Fortress 2\tf).

Find tf2_misc_dir.vpk (contains coconut.vmt) and tf2_textures_dir.vpk (contains coconut.vtf).
-------
In Command Prompt, run the command "vpk [vpk directory]" for both VPKs, where [vpk directory] is the current directory to where vpk.exe is.

Alternatively dragging and dropping both files on vpk.exe will also unpack them.



Coconut Extract
The extracted files are now located the same folder, usually in the tf\ folder if you didn’t otherwise do the extraction in a separate folder.

(Optional) Remove "_dir" from both folder names (whether "_dir" is included or not won't affect the packing process).

Remove coconut.vtf located in tf2_textures\materials\effects.

Remove coconut.vmt located in tf2_misc\materials\effects.

Packing Files into a VPK File
With the coconut removed, pack the folders back into VPK files.

Remove the existing tf2_misc and tf2_textures VPK files from the tf\ folder.

Open up Command Prompt. Set the current directory to where vpk.exe is. Run the command "vpk -M [file directory]" on tf2_misc and tf2_textures separately.

Once you’re done, make sure they’re placed inside the tf\ folder.
Additional Information
Shounic's videos below provides some other details about the coconut file and how the game behaves as it is stripped of its files.

Just to mention, removing the cow model and textures won't break your game. You'll just get the error model or the purple and black missing texture instead as expected. You can try this yourself with the methods I've mentioned above by removing the cow001 and cow001_reference files.


4 条留言
Dragonflam3 1 月 14 日 下午 4:48 
🥥
Doctor Sex 2024 年 2 月 2 日 下午 3:14 
cocnuet
Bottle 2023 年 4 月 26 日 下午 1:54 
Coconut = life
cardiepie 2021 年 7 月 19 日 上午 6:59 
yeah its just a image for a soldier taunt