User:N0one/Sandbox: Difference between revisions
mNo edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
{{Screenshot|type=screenshots|nocat=1}} | {{Screenshot|type=screenshots|nocat=1}} | ||
== Introduction == | == Introduction == | ||
This tutorial is how to make a {{p2|4.1}} mod, with custom chapters, backgrounds, [[vgui]], and more. | This tutorial is how to make a {{p2|4.1}} mod, with custom chapters, backgrounds, [[vgui]], sound for background, and more. | ||
== Getting Started == | == Getting Started == | ||
Line 419: | Line 419: | ||
For the icon of your mod to show, there are two places it can be displayed: In your steam library and on your desktop. | For the icon of your mod to show, there are two places it can be displayed: In your steam library and on your desktop. | ||
To make your icon you will need an image editor | To make your icon you will need an image editor, something like: {{gimp|4.1}}, {{photoshop|4.1}}, {{paintdotnet|4.1}}. | ||
To start open an image editor and create a new file with the dimensions 256x256 pixels. Then save your image as a .png in a folder (For example {{code|sourcemods/resource/icons_raw/}}) and name it ''icon_huge''. | To start open an image editor and create a new file with the dimensions 256x256 pixels. Then save your image as a .png in a folder (For example {{code|sourcemods/resource/icons_raw/}}) and name it ''icon_huge''. | ||
Line 442: | Line 442: | ||
''(The guide for creating icon is outdated on steam: [https://steamcommunity.com/sharedfiles/filedetails/?id=234558809 Create a Portal 2 mod])'' | ''(The guide for creating icon is outdated on steam: [https://steamcommunity.com/sharedfiles/filedetails/?id=234558809 Create a Portal 2 mod])'' | ||
==== Background ==== | |||
For this task, you'll need [http://www.radgametools.com/bnkdown.htm RAD Video Tools]. | |||
Fire up RAD Video Tools and find whatever video/image you want to use, then select it and press the ''Bink it!'' button in the bottom left corner. Once you've done that, you'll be greeted with a large window that might look a bit familiar to people who have used Windows 95 before. | |||
If you are using an image and not a video, the only setting we have to touch is the compression setting. Select ''Compress to a % of the original:'' and type 100 in the box next to it. | |||
Last but not least, rename your Bink file to 'menu_act01' and click the ''Bink'' button that's positioned to the far right of the window. Make sure that the file type is '''Bink 1''' and not '''Bink 2''', as it isn't supported by the {{source|4.1|nt=1}}. | |||
Finally, create a ''media'' subfolder in your mod's main folder and copy over your new bink movie, now enter your Portal 2 mod and it should be there. |
Revision as of 13:10, 24 May 2024
This Tutorial page is not finished.

You can upload screenshots at Special:Upload. For help, see Help:Images.
Introduction
This tutorial is how to make a Portal 2 mod, with custom chapters, backgrounds, vgui, sound for background, and more.
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, once you compiled it into a vpk file and start the game, you'll see gap 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 or .tga, then create a .vmt file and name it "portal2logo.vmt" or open VTFEdit and press on new. (save it somewhere on your desktop)
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
For the icon of your mod to show, there are two places it can be displayed: In your steam library and on your desktop.
To make your icon you will need an image editor, something like: GIMP,
Adobe Photoshop,
Paint.NET.
To start open an image editor and create a new file with the dimensions 256x256 pixels. Then save your image as a .png in a folder (For example sourcemods/resource/icons_raw/) and name it icon_huge.
Copy the icon_huge and rename it to icon_big and scale it down to 32x32 and do it again but name it icon and scale it to 16x16.
After creating the icons, Open the icon file and save it as a targa file (.tga) in the sourcemods/YourMod/resource folder, do the same with icon_big and NOT with icon_huge.
Now once you have done all of that, the next step is to show the icon in the steam library. Go to your mods folder and open gameinfo.txt.
Below Gamedata type icon "resource/icon", example:
"GameInfo" { game "Your Mod's Name" GameData "portal2.fgd" icon "resource/icon" ...
Now restart Steam. If it all worked, your mods icon should be shown.
(The guide for creating icon is outdated on steam: Create a Portal 2 mod)
Background
For this task, you'll need RAD Video Tools.
Fire up RAD Video Tools and find whatever video/image you want to use, then select it and press the Bink it! button in the bottom left corner. Once you've done that, you'll be greeted with a large window that might look a bit familiar to people who have used Windows 95 before.
If you are using an image and not a video, the only setting we have to touch is the compression setting. Select Compress to a % of the original: and type 100 in the box next to it.
Last but not least, rename your Bink file to 'menu_act01' and click the Bink button that's positioned to the far right of the window. Make sure that the file type is Bink 1 and not Bink 2, as it isn't supported by the Source Engine.
Finally, create a media subfolder in your mod's main folder and copy over your new bink movie, now enter your Portal 2 mod and it should be there.