User:N0one/Sandbox: Difference between revisions
Tag: Undo |
(Portal 2 tutorial) |
||
Line 1: | Line 1: | ||
'' | <small>''This Tutorial page is not finished.''</small> | ||
{{toc-right}} | |||
{{Screenshot|type=screenshots|nocat=1}} | |||
== Introduction == | |||
This guide describes how to make a mod for Portal 2. | |||
== Getting Started == | |||
=== Creating your first mod === | |||
first steps is to create a folder for your mod in {{Code|Steam/steamapps/sourcemods}} and rename it to the name of your mod. Open the folder and create two subfolders: "cfg" and "maps". | |||
Open the "maps" folder and create a folder called "soundcache" inside it. Copy the file called "_master.cache" from {{Code|Steam/steamapps/common/portal 2/portal2_dlc2/maps/soundcache}} and paste it to {{Code|(your mod)/maps/soundcache}}. | |||
=== Creating gameinfo.txt === | |||
Next step is creating the most important file, gameinfo.txt. Create a text file named ''gameinfo.txt'' and open it up and copy the following code: | |||
<pre> | |||
"GameInfo" | |||
{ | |||
game "Your Mod's Name" | |||
GameData "portal2.fgd" | |||
FileSystem | |||
{ | |||
SteamAppId 620 // Portal 2 has ID 620 | |||
SearchPaths | |||
{ | |||
Game |gameinfo_path|. | |||
Game portal2_dlc2 | |||
Game portal2_dlc1 | |||
Game portal2 | |||
} | |||
} | |||
} | |||
</pre> | |||
Remove the {{code|Game/portal2_dlc1}} search path, '''UNLESS''' your mod is going to have Co-Op functionality. | |||
=== Customise core menu funtions === | |||
Use a program like {{gcfscape|4}} to open {{Code|Steam/steamapps/common/portal 2/portal2_dlc2/pak01_dir.vpk}} and copy the file called {{Code|resource/ui/basemodui/mainmenu_new.res}} to {{Code|(your mod)/resource/ui/basemodui}} or create a folder and name it "pak01_dir" and place it anywhere on your pc, easy to reach is by having on desktop and make folders {{Code|resource/ui/basemodui}}. Edit it (See Below), then pack it into a new VPK using {{Code|portal 2/bin/vpk.exe}} or {{gcfscape|4}}, and place it in your mods folder. | |||
==== Removing the Co-Op button ==== | |||
This part is optional, unless your mod is NOT going to have Co-Op functionality. | |||
Open the file {{code|mainmenu_new.res}} with a text editor. | |||
When you have the file open, you'll see something like this: | |||
<pre> | |||
"BtnCoOp" | |||
{ | |||
"ControlName" "BaseModHybridButton" | |||
"fieldName" "BtnCoOp" | |||
"xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] | |||
"xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] | |||
"xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] | |||
"xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] | |||
"ypos" "250" [$GAMECONSOLE] | |||
"ypos" "228" [!$GAMECONSOLE] | |||
"wide" "280" | |||
"tall" "20" | |||
"autoResize" "1" | |||
"pinCorner" "0" | |||
"visible" "1" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"navUp" "BtnQuit" [$GAMECONSOLE] | |||
"navUp" "BtnPlaySolo" [!$GAMECONSOLE] | |||
"navDown" "BtnCommunity" | |||
"labelText" "#PORTAL2_MainMenu_CoOp" | |||
"style" "MainMenuButton" | |||
"command" "CoopPlay" | |||
"ActivationType" "1" | |||
"FocusDisabledBorderSize" "1" | |||
} | |||
</pre> | |||
This is the code that describes the Co-Op button, position on the screen, name of the button, what to do when clicked, and which buttons come next and before it when using the arrow keys. You can delete all of it. | |||
Next thing is to find the "navDown" on "BtnPlaySolo": | |||
Once you have found it replace it with: | |||
<pre> | |||
"navDown" "Options" | |||
</pre> | |||
Also find "navUp": | |||
Once you have found it, replace it with: | |||
<pre> | |||
"navUp" "BtnPlaySolo" | |||
</pre> | |||
Now, if you once you compiled it into a vpk file and start the game you'll se game between single player and community buttons. | |||
{{important|For the "ypos" to work, it should have <nowiki>[!$GAMECONSOLE]</nowiki> or it will not work. If the buttons dont have it and only have one "ypos" then its ok to replace it.}} | |||
Lets fix that by finding the "ypos" on "BtnCommunity": | |||
it should look like this: | |||
<pre> | |||
"ypos" "258" [!$GAMECONSOLE] | |||
</pre> | |||
replace it with the "ypos" from the "BtnCoOp": | |||
<pre> | |||
"ypos" "228" [!$GAMECONSOLE] | |||
</pre> | |||
Do this to all buttons except the single player button, if you dont want the buttons to be in the middle then replace the "ypos" from "BtnPlaySolo" with "228". | |||
Then pack it into a new VPK using {{Code|portal 2/bin/vpk.exe}} and place it in your mods folder. | |||
Thats all for removing the Coop button, this also applies to all buttons in the file. | |||
Here is the premade file without the Coop button and no gap: | |||
{{collapse top|title=mainmenu_new.res}} | |||
<pre> | |||
"Resource/UI/MainMenu.res" | |||
{ | |||
"MainMenu" | |||
{ | |||
"ControlName" "Frame" | |||
"fieldName" "MainMenu" | |||
"xpos" "0" | |||
"ypos" "0" | |||
"wide" "f0" | |||
"tall" "f0" | |||
"autoResize" "0" | |||
"pinCorner" "0" | |||
"visible" "1" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"PaintBackgroundType" "0" | |||
} | |||
// Single player | |||
"BtnPlaySolo" | |||
{ | |||
"ControlName" "BaseModHybridButton" | |||
"fieldName" "BtnPlaySolo" | |||
"xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] | |||
"xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] | |||
"xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] | |||
"xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] | |||
"ypos" "220" [$GAMECONSOLE] | |||
"ypos" "198" [!$GAMECONSOLE] | |||
"wide" "280" | |||
"tall" "20" | |||
"autoResize" "1" | |||
"pinCorner" "0" | |||
"visible" "1" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"navUp" "BtnQuit" [$GAMECONSOLE] | |||
"navUp" "BtnEconUI" [!$GAMECONSOLE] | |||
"navDown" "BtnCoOp" | |||
"labelText" "#PORTAL2_MainMenu_Solo" | |||
"style" "MainMenuButton" | |||
"command" "SoloPlay" | |||
"ActivationType" "1" | |||
"FocusDisabledBorderSize" "1" | |||
} | |||
// Community Maps | |||
"BtnCommunity" [!$GAMECONSOLE] | |||
{ | |||
"ControlName" "BaseModHybridButton" | |||
"fieldName" "BtnCommunity" | |||
"xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] | |||
"xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] | |||
"xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] | |||
"xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] | |||
"ypos" "280" [$GAMECONSOLE] | |||
"ypos" "228" [!$GAMECONSOLE] | |||
"wide" "280" | |||
"tall" "20" | |||
"autoResize" "1" | |||
"pinCorner" "0" | |||
"visible" "1" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"navUp" "BtnOptions" [$GAMECONSOLE] | |||
"navUp" "BtnCoOp" [!$GAMECONSOLE] | |||
"navDown" "BtnOptions" | |||
"labelText" "#PORTAL2_MainMenu_Community" | |||
"style" "MainMenuButton" | |||
"command" "CreateChambers" | |||
"ActivationType" "1" | |||
"FocusDisabledBorderSize" "1" | |||
} | |||
"BtnOptions" | |||
{ | |||
"ControlName" "BaseModHybridButton" | |||
"fieldName" "BtnOptions" | |||
"xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] | |||
"xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] | |||
"xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] | |||
"xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] | |||
"ypos" "310" [$GAMECONSOLE] | |||
"ypos" "258" [!$GAMECONSOLE] | |||
"wide" "280" | |||
"tall" "20" | |||
"autoResize" "1" | |||
"pinCorner" "0" | |||
"visible" "1" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"navUp" "BtnCoOp" [$GAMECONSOLE] | |||
"navUp" "BtnCommunity" [!$GAMECONSOLE] | |||
"navDown" "BtnPlaySolo" [$GAMECONSOLE] | |||
"navDown" "BtnExtras" [!$GAMECONSOLE] | |||
"labelText" "#PORTAL2_MainMenu_Options" | |||
"style" "MainMenuButton" | |||
"command" "Options" | |||
"ActivationType" "1" | |||
} | |||
"BtnExtras" [!$GAMECONSOLE] | |||
{ | |||
"ControlName" "BaseModHybridButton" | |||
"fieldName" "BtnExtras" | |||
"xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] | |||
"xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] | |||
"xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] | |||
"xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] | |||
"ypos" "340" [$GAMECONSOLE] | |||
"ypos" "288" [!$GAMECONSOLE] | |||
"wide" "280" | |||
"tall" "20" | |||
"autoResize" "1" | |||
"pinCorner" "0" | |||
"visible" "1" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"navUp" "BtnOptions" | |||
"navDown" "BtnQuit" | |||
"labelText" "#L4D360UI_MainMenu_Extras" | |||
"style" "MainMenuButton" | |||
"command" "Extras" | |||
"ActivationType" "1" | |||
} | |||
"BtnQuit" [!$GAMECONSOLE] | |||
{ | |||
"ControlName" "BaseModHybridButton" | |||
"fieldName" "BtnQuit" | |||
"xpos" "88" [$WIN32WIDE] | |||
"xpos" "63" [!$WIN32WIDE] | |||
"ypos" "318" | |||
"wide" "280" | |||
"tall" "20" | |||
"autoResize" "1" | |||
"pinCorner" "0" | |||
"visible" "1" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"navUp" "BtnExtras" | |||
"navDown" "BtnEconUI" | |||
"labelText" "#PORTAL2_MainMenu_Quit" | |||
"style" "MainMenuButton" | |||
"command" "QuitGame" | |||
"ActivationType" "1" | |||
} | |||
"BtnEconUI" [!$GAMECONSOLE] | |||
{ | |||
"ControlName" "BaseModHybridButton" | |||
"fieldName" "BtnEconUI" | |||
"xpos" "88" [$WIN32WIDE] | |||
"xpos" "63" [!$WIN32WIDE] | |||
"ypos" "348" | |||
"wide" "280" | |||
"tall" "20" | |||
"autoResize" "1" | |||
"pinCorner" "0" | |||
"visible" "1" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"navUp" "BtnQuit" | |||
"navDown" "BtnPlaySolo" | |||
"labelText" "#PORTAL2_MainMenu_Econ" | |||
"style" "BitmapButton" | |||
"command" "EconUI" | |||
"ActivationType" "1" | |||
"bitmap_enabled" "vgui/store/store_button" | |||
"bitmap_focus" "vgui/store/store_button_focus_anim" | |||
} | |||
"PnlCloudPic" | |||
{ | |||
"ControlName" "ImagePanel" | |||
"fieldName" "PnlCloudPic" | |||
"xpos" "310" | |||
"ypos" "288" | |||
"wide" "50" | |||
"tall" "50" | |||
"visible" "0" | |||
"enabled" "1" | |||
"tabPosition" "0" | |||
"scaleImage" "1" | |||
"image" "resource/icon_cloud_small" | |||
} | |||
} | |||
</pre> | |||
{{collapse bottom}} | |||
=== Restart Steam === | |||
Restart Steam. If it all worked, your mod should be listed and working. Congratulations! | |||
== Advanced == | |||
This part is going to guide you how to create custom images, chapters (button), and more. | |||
=== Creating a button for custom chapters === | |||
This part is almost identical to the above. | |||
First step is to Find the "BtnPlaySolo" (directly at the top) and rename it to "BtnExtras": | |||
Once you did that, find the "command": | |||
<pre> | |||
"command" "SoloPlay" | |||
</pre> | |||
Replace it with: | |||
<pre> | |||
"command" "Extras" | |||
</pre> | |||
This will make it jump into the Extras menu, allowing us to customise the chapter list. | |||
This part is optional, find the "labelText": | |||
<pre> | |||
"labelText" "#PORTAL2_MainMenu_Solo" | |||
</pre> | |||
and replace it with your desire. For example: | |||
<pre> | |||
"labelText" "Play Portal 2: The Ruins" | |||
</pre> | |||
Dont forget to remove the actual "Extras" button! | |||
Next step is to replace the "navUp/Down" with corresponding button names. | |||
For {{code|"BtnCoOp"}} replace the {{code|"navUp" "BtnPlaySolo"}} with {{code|"navUp" "BtnExtras"}}. | |||
For {{code|"BtnCommunity"}} replace the {{code|"navUp""BtnCoOp"}} with {{code|"navUp" "BtnExtras"}}. | |||
If you dont have the BtnCoOp you can replace the "navDown" on the single player button or the Extras button with {{code|"navDown" "BtnCommunity"}} | |||
This also applies to all buttons in the file. | |||
=== Create functioning chapter buttons === | |||
For this, we have to use the Extras menu as the single player menu, the reason why we used the ''Extras'' command instead of the ''SoloPlay'' command is because the ''SoloPlay'' only shows Portal 2 chapters instead of the custom chapters. | |||
Here, you can have as many or as little chapters as you like. You'll need to create a 'scripts' folder for this task. | |||
Inside this folder, create an '''extras''' text file. | |||
While we're in the scripts folder, go to {{code|../Steam/steamapps/common/Portal 2/portal2_dlc2}} and copy the '''game_sounds_manifest''' text file over to your mod's scripts folder. | |||
Back to the '''extras''' text file, copy and paste the following code: | |||
<pre> | |||
"Extras" | |||
{ | |||
"chapter1" | |||
{ | |||
"title" "Chapter 1" | |||
"subtitle" "The Wake Up" | |||
"command" "map sp_a1_00" //map name to start the first chapter | |||
"pic" "vgui/chapters/chapter1" | |||
} | |||
// You can copy as many as you want | |||
"chapter2" | |||
{ | |||
"title" "Chapter 2" | |||
"subtitle" "The Portal Gun" | |||
"command" "map sp_a2_01" //map name to start the second chapter and so on | |||
"pic" "vgui/chapters/chapter2" | |||
} | |||
} | |||
</pre> | |||
=== Create and implement your own logo === | |||
For the logo/background/chapters you will need an image editor such as: {{gimp|4.1}}, {{photoshop|4.1}}, etc. | |||
This guide will use {{gimp|4.1}} for creating logos/backgrounds/chapters. There are plug-ins to export it as a .vmf file, but in this guide we will use {{vtfedit|4}} | |||
==== Logo ==== | |||
Create a new image file with a resolution of 512x128. Then choose 'Transparency' under Advanced. This allows you to admire your logo in all its glory without a visible background layer. The rest is up to you and your imagination! | |||
After creating your logo export it as a png, then create a .vmt file and name it "portal2logo.vmt" or open {{vtfedit|4}} and press on ''new''. | |||
and copy this code: | |||
<pre> | |||
UnlitGeneric | |||
{ | |||
$basetexture "vgui/portal2logo" | |||
$translucent 1 | |||
$vertexcolor 1 | |||
$vertexalpha 1 | |||
$ignorez 1 | |||
$additive 0 | |||
$no_fullbright 1 | |||
$SHADERSRGBREAD360 1 | |||
} | |||
</pre> | |||
Now lets create the .vmf file. | |||
Open {{vtfedit|4}} and click on ''import'', on ''Normal Format'', change it to BGRA8888 and on ''Alpha format'' to DXT 1. Set the size to 512x128, and then press ok. | |||
When you have done that you will see the background is black, to fix that go to ''View'' and enable ''mask'' (shortcut Ctrl+M). | |||
On flags check ''No Mipmap'' and ''No Level Of Detail'', by default the ''Eight bit Alpha'' should be checked, if not, the import it again. | |||
Once you have done all of that, click on ''Save As'' and name it to '''portal2logo.vtf'''. | |||
Now place both files in your pak01_dir in {{code|materials/vgui}} | |||
Pack it again and open the game, if the logo is there, Congratulations! you created your logo! | |||
==== Icon ==== | |||
This is pretty simple, we don't need to make use of an ICO file. We only have to export once from {{gimp|4.1}}. Here, we need a TGA file instead. Do your magic in {{gimp|4.1}}. The resolution should be 32x32. | |||
Now this might seem a bit low-res, which it is in my experience of creating an image originally at 32x32. Try creating the icon at a higher resolution (say 256x256) and then resize it to 32x32 and export it as a TGA file. The TGA file needs to be the name of your mod. |
Revision as of 12:38, 17 May 2024
This Tutorial page is not finished.

You can upload screenshots at Special:Upload. For help, see Help:Images.
Introduction
This guide describes how to make a mod for Portal 2.
Getting Started
Creating your first mod
first steps is to create a folder for your mod in Steam/steamapps/sourcemods and rename it to the name of your mod. Open the folder and create two subfolders: "cfg" and "maps".
Open the "maps" folder and create a folder called "soundcache" inside it. Copy the file called "_master.cache" from Steam/steamapps/common/portal 2/portal2_dlc2/maps/soundcache and paste it to (your mod)/maps/soundcache.
Creating gameinfo.txt
Next step is creating the most important file, gameinfo.txt. Create a text file named gameinfo.txt and open it up and copy the following code:
"GameInfo" { game "Your Mod's Name" GameData "portal2.fgd" FileSystem { SteamAppId 620 // Portal 2 has ID 620 SearchPaths { Game |gameinfo_path|. Game portal2_dlc2 Game portal2_dlc1 Game portal2 } } }
Remove the Game/portal2_dlc1 search path, UNLESS your mod is going to have Co-Op functionality.
Use a program like GCFScape to open Steam/steamapps/common/portal 2/portal2_dlc2/pak01_dir.vpk and copy the file called resource/ui/basemodui/mainmenu_new.res to (your mod)/resource/ui/basemodui or create a folder and name it "pak01_dir" and place it anywhere on your pc, easy to reach is by having on desktop and make folders resource/ui/basemodui. Edit it (See Below), then pack it into a new VPK using portal 2/bin/vpk.exe or
GCFScape, and place it in your mods folder.
Removing the Co-Op button
This part is optional, unless your mod is NOT going to have Co-Op functionality.
Open the file mainmenu_new.res with a text editor.
When you have the file open, you'll see something like this:
"BtnCoOp" { "ControlName" "BaseModHybridButton" "fieldName" "BtnCoOp" "xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] "xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] "xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] "xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] "ypos" "250" [$GAMECONSOLE] "ypos" "228" [!$GAMECONSOLE] "wide" "280" "tall" "20" "autoResize" "1" "pinCorner" "0" "visible" "1" "enabled" "1" "tabPosition" "0" "navUp" "BtnQuit" [$GAMECONSOLE] "navUp" "BtnPlaySolo" [!$GAMECONSOLE] "navDown" "BtnCommunity" "labelText" "#PORTAL2_MainMenu_CoOp" "style" "MainMenuButton" "command" "CoopPlay" "ActivationType" "1" "FocusDisabledBorderSize" "1" }
This is the code that describes the Co-Op button, position on the screen, name of the button, what to do when clicked, and which buttons come next and before it when using the arrow keys. You can delete all of it.
Next thing is to find the "navDown" on "BtnPlaySolo":
Once you have found it replace it with:
"navDown" "Options"
Also find "navUp":
Once you have found it, replace it with:
"navUp" "BtnPlaySolo"
Now, if you once you compiled it into a vpk file and start the game you'll se game between single player and community buttons.

Lets fix that by finding the "ypos" on "BtnCommunity":
it should look like this:
"ypos" "258" [!$GAMECONSOLE]
replace it with the "ypos" from the "BtnCoOp":
"ypos" "228" [!$GAMECONSOLE]
Do this to all buttons except the single player button, if you dont want the buttons to be in the middle then replace the "ypos" from "BtnPlaySolo" with "228".
Then pack it into a new VPK using portal 2/bin/vpk.exe and place it in your mods folder.
Thats all for removing the Coop button, this also applies to all buttons in the file.
Here is the premade file without the Coop button and no gap:
mainmenu_new.res
|
---|
"Resource/UI/MainMenu.res" { "MainMenu" { "ControlName" "Frame" "fieldName" "MainMenu" "xpos" "0" "ypos" "0" "wide" "f0" "tall" "f0" "autoResize" "0" "pinCorner" "0" "visible" "1" "enabled" "1" "tabPosition" "0" "PaintBackgroundType" "0" } // Single player "BtnPlaySolo" { "ControlName" "BaseModHybridButton" "fieldName" "BtnPlaySolo" "xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] "xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] "xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] "xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] "ypos" "220" [$GAMECONSOLE] "ypos" "198" [!$GAMECONSOLE] "wide" "280" "tall" "20" "autoResize" "1" "pinCorner" "0" "visible" "1" "enabled" "1" "tabPosition" "0" "navUp" "BtnQuit" [$GAMECONSOLE] "navUp" "BtnEconUI" [!$GAMECONSOLE] "navDown" "BtnCoOp" "labelText" "#PORTAL2_MainMenu_Solo" "style" "MainMenuButton" "command" "SoloPlay" "ActivationType" "1" "FocusDisabledBorderSize" "1" } // Community Maps "BtnCommunity" [!$GAMECONSOLE] { "ControlName" "BaseModHybridButton" "fieldName" "BtnCommunity" "xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] "xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] "xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] "xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] "ypos" "280" [$GAMECONSOLE] "ypos" "228" [!$GAMECONSOLE] "wide" "280" "tall" "20" "autoResize" "1" "pinCorner" "0" "visible" "1" "enabled" "1" "tabPosition" "0" "navUp" "BtnOptions" [$GAMECONSOLE] "navUp" "BtnCoOp" [!$GAMECONSOLE] "navDown" "BtnOptions" "labelText" "#PORTAL2_MainMenu_Community" "style" "MainMenuButton" "command" "CreateChambers" "ActivationType" "1" "FocusDisabledBorderSize" "1" } "BtnOptions" { "ControlName" "BaseModHybridButton" "fieldName" "BtnOptions" "xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] "xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] "xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] "xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] "ypos" "310" [$GAMECONSOLE] "ypos" "258" [!$GAMECONSOLE] "wide" "280" "tall" "20" "autoResize" "1" "pinCorner" "0" "visible" "1" "enabled" "1" "tabPosition" "0" "navUp" "BtnCoOp" [$GAMECONSOLE] "navUp" "BtnCommunity" [!$GAMECONSOLE] "navDown" "BtnPlaySolo" [$GAMECONSOLE] "navDown" "BtnExtras" [!$GAMECONSOLE] "labelText" "#PORTAL2_MainMenu_Options" "style" "MainMenuButton" "command" "Options" "ActivationType" "1" } "BtnExtras" [!$GAMECONSOLE] { "ControlName" "BaseModHybridButton" "fieldName" "BtnExtras" "xpos" "88" [$GAMECONSOLE && ($GAMECONSOLEWIDE && !$ANAMORPHIC)] "xpos" "63" [$GAMECONSOLE && (!$GAMECONSOLEWIDE || $ANAMORPHIC)] "xpos" "88" [!$GAMECONSOLE && $WIN32WIDE] "xpos" "63" [!$GAMECONSOLE && !$WIN32WIDE] "ypos" "340" [$GAMECONSOLE] "ypos" "288" [!$GAMECONSOLE] "wide" "280" "tall" "20" "autoResize" "1" "pinCorner" "0" "visible" "1" "enabled" "1" "tabPosition" "0" "navUp" "BtnOptions" "navDown" "BtnQuit" "labelText" "#L4D360UI_MainMenu_Extras" "style" "MainMenuButton" "command" "Extras" "ActivationType" "1" } "BtnQuit" [!$GAMECONSOLE] { "ControlName" "BaseModHybridButton" "fieldName" "BtnQuit" "xpos" "88" [$WIN32WIDE] "xpos" "63" [!$WIN32WIDE] "ypos" "318" "wide" "280" "tall" "20" "autoResize" "1" "pinCorner" "0" "visible" "1" "enabled" "1" "tabPosition" "0" "navUp" "BtnExtras" "navDown" "BtnEconUI" "labelText" "#PORTAL2_MainMenu_Quit" "style" "MainMenuButton" "command" "QuitGame" "ActivationType" "1" } "BtnEconUI" [!$GAMECONSOLE] { "ControlName" "BaseModHybridButton" "fieldName" "BtnEconUI" "xpos" "88" [$WIN32WIDE] "xpos" "63" [!$WIN32WIDE] "ypos" "348" "wide" "280" "tall" "20" "autoResize" "1" "pinCorner" "0" "visible" "1" "enabled" "1" "tabPosition" "0" "navUp" "BtnQuit" "navDown" "BtnPlaySolo" "labelText" "#PORTAL2_MainMenu_Econ" "style" "BitmapButton" "command" "EconUI" "ActivationType" "1" "bitmap_enabled" "vgui/store/store_button" "bitmap_focus" "vgui/store/store_button_focus_anim" } "PnlCloudPic" { "ControlName" "ImagePanel" "fieldName" "PnlCloudPic" "xpos" "310" "ypos" "288" "wide" "50" "tall" "50" "visible" "0" "enabled" "1" "tabPosition" "0" "scaleImage" "1" "image" "resource/icon_cloud_small" } } |
Restart Steam
Restart Steam. If it all worked, your mod should be listed and working. Congratulations!
Advanced
This part is going to guide you how to create custom images, chapters (button), and more.
Creating a button for custom chapters
This part is almost identical to the above.
First step is to Find the "BtnPlaySolo" (directly at the top) and rename it to "BtnExtras":
Once you did that, find the "command":
"command" "SoloPlay"
Replace it with:
"command" "Extras"
This will make it jump into the Extras menu, allowing us to customise the chapter list.
This part is optional, find the "labelText":
"labelText" "#PORTAL2_MainMenu_Solo"
and replace it with your desire. For example:
"labelText" "Play Portal 2: The Ruins"
Dont forget to remove the actual "Extras" button!
Next step is to replace the "navUp/Down" with corresponding button names.
For "BtnCoOp" replace the "navUp" "BtnPlaySolo" with "navUp" "BtnExtras".
For "BtnCommunity" replace the "navUp""BtnCoOp" with "navUp" "BtnExtras".
If you dont have the BtnCoOp you can replace the "navDown" on the single player button or the Extras button with "navDown" "BtnCommunity"
This also applies to all buttons in the file.
Create functioning chapter buttons
For this, we have to use the Extras menu as the single player menu, the reason why we used the Extras command instead of the SoloPlay command is because the SoloPlay only shows Portal 2 chapters instead of the custom chapters.
Here, you can have as many or as little chapters as you like. You'll need to create a 'scripts' folder for this task.
Inside this folder, create an extras text file.
While we're in the scripts folder, go to ../Steam/steamapps/common/Portal 2/portal2_dlc2 and copy the game_sounds_manifest text file over to your mod's scripts folder.
Back to the extras text file, copy and paste the following code:
"Extras" { "chapter1" { "title" "Chapter 1" "subtitle" "The Wake Up" "command" "map sp_a1_00" //map name to start the first chapter "pic" "vgui/chapters/chapter1" } // You can copy as many as you want "chapter2" { "title" "Chapter 2" "subtitle" "The Portal Gun" "command" "map sp_a2_01" //map name to start the second chapter and so on "pic" "vgui/chapters/chapter2" } }
Create and implement your own logo
For the logo/background/chapters you will need an image editor such as: GIMP,
Adobe Photoshop, etc.
This guide will use GIMP for creating logos/backgrounds/chapters. There are plug-ins to export it as a .vmf file, but in this guide we will use
VTFEdit
Logo
Create a new image file with a resolution of 512x128. Then choose 'Transparency' under Advanced. This allows you to admire your logo in all its glory without a visible background layer. The rest is up to you and your imagination!
After creating your logo export it as a png, then create a .vmt file and name it "portal2logo.vmt" or open VTFEdit and press on new.
and copy this code:
UnlitGeneric { $basetexture "vgui/portal2logo" $translucent 1 $vertexcolor 1 $vertexalpha 1 $ignorez 1 $additive 0 $no_fullbright 1 $SHADERSRGBREAD360 1 }
Now lets create the .vmf file.
Open VTFEdit and click on import, on Normal Format, change it to BGRA8888 and on Alpha format to DXT 1. Set the size to 512x128, and then press ok.
When you have done that you will see the background is black, to fix that go to View and enable mask (shortcut Ctrl+M).
On flags check No Mipmap and No Level Of Detail, by default the Eight bit Alpha should be checked, if not, the import it again.
Once you have done all of that, click on Save As and name it to portal2logo.vtf.
Now place both files in your pak01_dir in materials/vgui
Pack it again and open the game, if the logo is there, Congratulations! you created your logo!
Icon
This is pretty simple, we don't need to make use of an ICO file. We only have to export once from GIMP. Here, we need a TGA file instead. Do your magic in
GIMP. The resolution should be 32x32.
Now this might seem a bit low-res, which it is in my experience of creating an image originally at 32x32. Try creating the icon at a higher resolution (say 256x256) and then resize it to 32x32 and export it as a TGA file. The TGA file needs to be the name of your mod.