Adding chapters to your mod: Difference between revisions
m (Reverted edit of C4tpaSacel, changed back to last version by Etset) |
TomEdwards (talk | contribs) (cleanup) |
||
Line 1: | Line 1: | ||
{{toc-right}} | |||
'''Chapters''' are used to split single-player mods down into manageable chunks. They give your story more structure and allow players to jump into the game half-way through if they so desire. They can also be used to control which background maps/images are displayed. | |||
Adding chapters to your mod is a little complicated, because you need to modify a number of files in order to add new chapters. | |||
== Scripts == | |||
=== Registering a chapter === | |||
Create <code>\mod\cfg\chapter1.cfg</code>. This will create a chapter, and contains the [[console command]]s that the game will run when it is started. Typically just: | |||
map <first map of the chapter> | |||
Do this for all your chapters. | |||
=== Localising names === | |||
Create (or open, if it exists already) <code>\mod\resource\<modname>_english.txt</code> (or <code>_french</code>, <code>_japanese</code>, etc). This is your mod's [[localisation]] file, where you write the [[unicode]] titles for your chapters. | |||
Yours should look something like this: | |||
<source lang=ini> | |||
lang | |||
{ | |||
Language "English" | |||
Tokens | |||
{ | |||
modname_Chapter1_Title "Chapter 1 title" | |||
} | |||
} | |||
</source> | |||
If there are existing tokens in the file, don't remove them. Just add yours somewhere. | |||
{{note|Localization files must be saved in the '''UCS-2 Little Endian''' format. In Notepad's "Save As..." dialogue this is called "Unicode".}} | |||
{{note|Wrap any keys or values with whitespace in "quote marks".}} | |||
=== Fixing on-screen titles === | |||
<code>\mod\scripts\titles.txt</code> defines what appears on-screen when a new chapter starts. | |||
Find the "chapter titles" section and modify it like so: | |||
//CHAPTER TITLES | //CHAPTER TITLES | ||
Line 36: | Line 55: | ||
} | } | ||
This file should be saved as normal ANSI. | |||
== Images == | |||
=== Thumbnails === | |||
[[File:CBXChapter1.gif|right|border|A chapter image]] | |||
You need to [[Creating a Material|create materials]] for each of your chapters. They should be in <code>\mod\materials\vgui\chapters\</code> and named chapter1, chapter2, chapter3 etc. | |||
The . | * The images displayed in the new game dialogue are 152x86. Since texture dimensions must both be a power of two, your VTFs will be 256x128 with a border to the right and bottom. | ||
* Since these are UI textures, They should be compiled without [[mipmap]]s and with level of detail disabled. The [[VTEX]] commands for this are <code>nomip</code> and <code>nolod</code> | |||
Your material should look something like this: | |||
UnlitGeneric | |||
{ | { | ||
$basetexture vgui/chapters/chapter1 | |||
$vertexalpha 1 | |||
} | } | ||
== | === Backgrounds === | ||
<code>\mod\scripts\chapterbackgrounds.txt</code> ties background maps and images to chapters. A background will not be used until the chapter it is associated with has been unlocked (see next section). | |||
Here is what it might look like: | |||
chapters | |||
{ | { | ||
1 " | 1 "my_background01" | ||
2 " | 2 "my_background02" | ||
3 " | 3 "my_background03" | ||
} | } | ||
Each value should be the name of a map in <code>\mod\maps\</code> (unless you don't want background maps at all) and a material in <code>\mod\materials\console\</code>. It's okay to omit a chapter. | |||
See [[Menu Background Map]] for more details. | |||
== Maps == | |||
=== Unlocking chapters === | |||
By default, all chapters except the first start off locked. Unfortunately, Valve's not-terribly-good method of unlocking requires your maps to have the same names as theirs! | |||
You can overcome this issue by starting your mod off with all chapters unlocked (edit the <code>sv_unlockedchapters</code> line in <code>\mod\cfg\config.cfg</code>), [[Unlocking chapters in your mod|or by changing your mod's programming]]. Hacking it within maps is not recommended. | |||
=== Equipping players === | |||
Players who start a new game at a chapter half-way through your mod will drop into the world without any items. To equip them with the weapons and other goodies they are supposed to have, use a [[logic_auto]]'s <code>OnNewGame</code> output to spawn a [[point_template]]. | |||
== | === The map list === | ||
Create <code>\mod\maplist.txt</code> and list of maps that your mod will use. For example: | |||
Map1 | |||
Map2 | |||
{{todo|Is this really necessary?}} | |||
[[Category:Level Design]] | [[Category:Level Design]] | ||
[[Category:Tutorials]] | [[Category:Tutorials]] | ||
Revision as of 04:41, 19 August 2009
Chapters are used to split single-player mods down into manageable chunks. They give your story more structure and allow players to jump into the game half-way through if they so desire. They can also be used to control which background maps/images are displayed.
Adding chapters to your mod is a little complicated, because you need to modify a number of files in order to add new chapters.
Scripts
Registering a chapter
Create \mod\cfg\chapter1.cfg
. This will create a chapter, and contains the console commands that the game will run when it is started. Typically just:
map <first map of the chapter>
Do this for all your chapters.
Localising names
Create (or open, if it exists already) \mod\resource\<modname>_english.txt
(or _french
, _japanese
, etc). This is your mod's localisation file, where you write the unicode titles for your chapters.
Yours should look something like this:
lang
{
Language "English"
Tokens
{
modname_Chapter1_Title "Chapter 1 title"
}
}
If there are existing tokens in the file, don't remove them. Just add yours somewhere.


Fixing on-screen titles
\mod\scripts\titles.txt
defines what appears on-screen when a new chapter starts.
Find the "chapter titles" section and modify it like so:
//CHAPTER TITLES $fadein 0.01 $holdtime 3.5 $position -1 0.58 CHAPTER1_TITLE { #YourModName_Chapter1_Title }
This file should be saved as normal ANSI.
Images
Thumbnails
You need to create materials for each of your chapters. They should be in \mod\materials\vgui\chapters\
and named chapter1, chapter2, chapter3 etc.
- The images displayed in the new game dialogue are 152x86. Since texture dimensions must both be a power of two, your VTFs will be 256x128 with a border to the right and bottom.
- Since these are UI textures, They should be compiled without mipmaps and with level of detail disabled. The VTEX commands for this are
nomip
andnolod
Your material should look something like this:
UnlitGeneric { $basetexture vgui/chapters/chapter1 $vertexalpha 1 }
Backgrounds
\mod\scripts\chapterbackgrounds.txt
ties background maps and images to chapters. A background will not be used until the chapter it is associated with has been unlocked (see next section).
Here is what it might look like:
chapters { 1 "my_background01" 2 "my_background02" 3 "my_background03" }
Each value should be the name of a map in \mod\maps\
(unless you don't want background maps at all) and a material in \mod\materials\console\
. It's okay to omit a chapter.
See Menu Background Map for more details.
Maps
Unlocking chapters
By default, all chapters except the first start off locked. Unfortunately, Valve's not-terribly-good method of unlocking requires your maps to have the same names as theirs!
You can overcome this issue by starting your mod off with all chapters unlocked (edit the sv_unlockedchapters
line in \mod\cfg\config.cfg
), or by changing your mod's programming. Hacking it within maps is not recommended.
Equipping players
Players who start a new game at a chapter half-way through your mod will drop into the world without any items. To equip them with the weapons and other goodies they are supposed to have, use a logic_auto's OnNewGame
output to spawn a point_template.
The map list
Create \mod\maplist.txt
and list of maps that your mod will use. For example:
Map1 Map2