Adding chapters to your mod: Difference between revisions
m (→Chapter images) |
TomEdwards (talk | contribs) (made some improvements, but this page really needs to be redone) |
||
Line 3: | Line 3: | ||
{{warning|'''Half-Life 2 uses unicode for the localization file. Some text editors may save the file as ASCII-encoded.<br>Use Notepad or another Unicode-savvy editor to edit these files.'''}} | {{warning|'''Half-Life 2 uses unicode for the localization file. Some text editors may save the file as ASCII-encoded.<br>Use Notepad or another Unicode-savvy editor to edit these files.'''}} | ||
== Chapter config files == | |||
Create a chapter1.cfg file and put it in the cfg folder like so <code>yourmodfolder/cfg/chapter1.cfg</code>. Then edit the file to read ... | Create a chapter1.cfg file and put it in the cfg folder like so <code>yourmodfolder/cfg/chapter1.cfg</code>. Then edit the file to read ... | ||
map Map1 | map Map1 | ||
Replacing Map1 with the name of your own map. Do this for each chapter in your mod. | Replacing Map1 with the name of your own map. Do this for each chapter in your mod. | ||
==Strings file== | |||
Goto your <code>yourmodfolder/resource</code> folder and copy the HL2_english.txt file and give it the name YourModName_english.txt. (Again replacing YourModName with the name of your mod) Now you will need to edit the YourModName_english.txt file. At the top of the file add the following lines above HL2_Chapter1_Title like so ... | Goto your <code>yourmodfolder/resource</code> folder and copy the HL2_english.txt file and give it the name YourModName_english.txt. (Again replacing YourModName with the name of your mod) Now you will need to edit the YourModName_english.txt file. At the top of the file add the following lines above HL2_Chapter1_Title like so ... | ||
"HL2_Chapter1_Title" "POINT INSERTION" | "YourModName_Chapter1_Title" "Title of the chapter goes here" | ||
"HL2_Chapter1_Title" "POINT INSERTION" | |||
You can leave the original HL2_Chapter1_Title title entries as they will not affect your mod by being there. | You can leave the original HL2_Chapter1_Title title entries as they will not affect your mod by being there. | ||
==Chapter titles== | |||
Open up the <code>yourmodfolder/scripts/titles.txt</code> file and scroll down to the CHAPTER TITLES section and modify the chapters entries like so ... | |||
$fadein 0.01 | //CHAPTER TITLES | ||
$holdtime 3.5 | |||
$position -1 0.58 | $fadein 0.01 | ||
$holdtime 3.5 | |||
$position -1 0.58 | |||
CHAPTER1_TITLE | |||
{ | |||
#YourModName_Chapter1_Title | |||
} | |||
==Chapter images== | |||
[[image:CBXChapter1.gif|thumb|Sample Chapter Image]] | [[image:CBXChapter1.gif|thumb|Sample Chapter Image]] | ||
Next you will need to create [[VMT|*.vmt]] and [[VTF|*.vtf]] image files for your chapters. Place the [[VMT|*.vmt]] and [[VTF|*.vtf]] files into the <code>yourmodfolder/materials/vgui/chapters/</code> folder. Be sure to name your images chapter1.vtf, chapter1.vmt and chapter2.vtf, chapter2.vmt respectivly. | Next you will need to create [[VMT|*.vmt]] and [[VTF|*.vtf]] image files for your chapters. Place the [[VMT|*.vmt]] and [[VTF|*.vtf]] files into the <code>yourmodfolder/materials/vgui/chapters/</code> folder. Be sure to name your images chapter1.vtf, chapter1.vmt and chapter2.vtf, chapter2.vmt respectivly. | ||
Make sure | Make sure that: | ||
*The image files are 256x128 in size, i.e., a power of 2. (When your chapter is selected in the new game dialogue that only the portion from 0,0 to 152,86 will be visible.) | |||
*The images are marked with <code>[[nomip]]</code> and <code>[[nolod]]</code>. The same goes for your menu backgrounds: without these parameters, people using medium or low texture detail will have blurry menu graphics. '''You can't set these options in the .vmt!''' | |||
The .vmt file should look like this | The .vmt file should look like this | ||
"UnlitGeneric" | |||
{ | |||
"$basetexture" "vgui/chapters/chapter1" | |||
"$vertexalpha" 1 | |||
} | |||
==The map list== | |||
Now that you have your images setup do not forget to create a <code>yourmodfolder/maplist.txt</code> file containing a list of maps that your mod will use. For example inside a maplist.txt file would look like ... | |||
== | Map1 | ||
Map2 | |||
==Chapter map loading images== | |||
You will need to edit the <code>yourmodfolder/scripts/chapterbackgrounds.txt</code> file and specify what loading images you want to be displayed while your mod is starting and the background map is loading. Below is an example of what a chapterbackgrounds.txt might look like. | You will need to edit the <code>yourmodfolder/scripts/chapterbackgrounds.txt</code> file and specify what loading images you want to be displayed while your mod is starting and the background map is loading. Below is an example of what a chapterbackgrounds.txt might look like. | ||
{ | "chapters" | ||
{ | |||
1 "YourImage1" | |||
2 "YourImage3" | |||
3 "YourImage3" | |||
4 "YourImage4" | |||
5 "background03" | |||
6 "background03" | |||
7 "background04" | |||
8 "background04" | |||
9 "background05" | |||
9a "background05" | |||
10 "background06" | |||
11 "background06" | |||
12 "background07" | |||
13 "background07" | |||
14 "background07" | |||
} | 15 "background07" | ||
} | |||
{{note|If you do not want background maps for your mod, create a <code>valve.rc</code> in your <code>cfg</code> folder without the <code>startupmenu</code> command in it.}} | {{note|If you do not want background maps for your mod, create a <code>valve.rc</code> in your <code>cfg</code> folder without the <code>startupmenu</code> command in it.}} | ||
// Setup custom controller | // load the base configuration | ||
exec joystick.cfg | //exec default.cfg | ||
// Setup custom controller | |||
exec joystick.cfg | |||
// run a user script file if present | |||
exec autoexec.cfg | |||
// | |||
// stuff command line statements | |||
// | |||
stuffcmds | |||
Be sure to create your images 1024x1024. The trick to creating an image that is displayed properly in either 4:3, 16:9, or 16:10 is to create a 1024x768 (or 1280x1024 to scale down) image then resize it to 1024x1024 before saving it. For widescreen you would start by creating 1280x800 for example, then resize it to 1024x1024. See [[Creating Menu Background Maps]] for more info on this topic. | |||
==Additional notes== | |||
If you want your chapters to be unlocked when you first play your mod then be sure to edit the <code>yourmodfolder/cfg/config.cfg</code> file. Scroll down to about line 162 and edit the line ... | If you want your chapters to be unlocked when you first play your mod then be sure to edit the <code>yourmodfolder/cfg/config.cfg</code> file. Scroll down to about line 162 and edit the line ... | ||
sv_unlockedchapters "1" | |||
For information on how to unlock chapters read the [[Unlocking chapters in your mod]] tutorial. | For information on how to unlock chapters read the [[Unlocking chapters in your mod]] tutorial. |
Revision as of 07:01, 31 January 2007
Adding chapters to your mod is a little complicated because you need to modify a number of files in order to add new chapters.

Use Notepad or another Unicode-savvy editor to edit these files.
Chapter config files
Create a chapter1.cfg file and put it in the cfg folder like so yourmodfolder/cfg/chapter1.cfg
. Then edit the file to read ...
map Map1
Replacing Map1 with the name of your own map. Do this for each chapter in your mod.
Strings file
Goto your yourmodfolder/resource
folder and copy the HL2_english.txt file and give it the name YourModName_english.txt. (Again replacing YourModName with the name of your mod) Now you will need to edit the YourModName_english.txt file. At the top of the file add the following lines above HL2_Chapter1_Title like so ...
"YourModName_Chapter1_Title" "Title of the chapter goes here" "HL2_Chapter1_Title" "POINT INSERTION"
You can leave the original HL2_Chapter1_Title title entries as they will not affect your mod by being there.
Chapter titles
Open up the yourmodfolder/scripts/titles.txt
file and scroll down to the CHAPTER TITLES section and modify the chapters entries like so ...
//CHAPTER TITLES $fadein 0.01 $holdtime 3.5 $position -1 0.58 CHAPTER1_TITLE { #YourModName_Chapter1_Title }
Chapter images
Next you will need to create *.vmt and *.vtf image files for your chapters. Place the *.vmt and *.vtf files into the yourmodfolder/materials/vgui/chapters/
folder. Be sure to name your images chapter1.vtf, chapter1.vmt and chapter2.vtf, chapter2.vmt respectivly.
Make sure that:
- The image files are 256x128 in size, i.e., a power of 2. (When your chapter is selected in the new game dialogue that only the portion from 0,0 to 152,86 will be visible.)
- The images are marked with
nomip
andnolod
. The same goes for your menu backgrounds: without these parameters, people using medium or low texture detail will have blurry menu graphics. You can't set these options in the .vmt!
The .vmt file should look like this
"UnlitGeneric" { "$basetexture" "vgui/chapters/chapter1" "$vertexalpha" 1 }
The map list
Now that you have your images setup do not forget to create a yourmodfolder/maplist.txt
file containing a list of maps that your mod will use. For example inside a maplist.txt file would look like ...
Map1 Map2
Chapter map loading images
You will need to edit the yourmodfolder/scripts/chapterbackgrounds.txt
file and specify what loading images you want to be displayed while your mod is starting and the background map is loading. Below is an example of what a chapterbackgrounds.txt might look like.
"chapters" { 1 "YourImage1" 2 "YourImage3" 3 "YourImage3" 4 "YourImage4" 5 "background03" 6 "background03" 7 "background04" 8 "background04" 9 "background05" 9a "background05" 10 "background06" 11 "background06" 12 "background07" 13 "background07" 14 "background07" 15 "background07" }

valve.rc
in your cfg
folder without the startupmenu
command in it.// load the base configuration //exec default.cfg // Setup custom controller exec joystick.cfg // run a user script file if present exec autoexec.cfg // // stuff command line statements // stuffcmds
Be sure to create your images 1024x1024. The trick to creating an image that is displayed properly in either 4:3, 16:9, or 16:10 is to create a 1024x768 (or 1280x1024 to scale down) image then resize it to 1024x1024 before saving it. For widescreen you would start by creating 1280x800 for example, then resize it to 1024x1024. See Creating Menu Background Maps for more info on this topic.
Additional notes
If you want your chapters to be unlocked when you first play your mod then be sure to edit the yourmodfolder/cfg/config.cfg
file. Scroll down to about line 162 and edit the line ...
sv_unlockedchapters "1"
For information on how to unlock chapters read the Unlocking chapters in your mod tutorial.