Fr/Adding chapters to your mod
Les Chapitres sont dans les jeux Sources des "étapes" d'un jeux ou d'un mod. Le nombres de chapitres peux varier selon les jeux, et ne sont qu'accessibles dans un jeux en mode solo. La liste des chapitres du jeux se trouve dans le menu de départ, sous forme de liste suivit d'une image représentant le chaptire. Les chapitres donnent également une structure propre à votre jeux, et permet au joueur de naviguer dans son déroulement.
L'ajouts de chapitres à votre mod peut être légèrement compliqué, car il faut modifier certains fichiers à manier avec précautions.
Scripts
Engeristrement d'un chapitre
Créez à cet endroit <votre mod>\cfg\chapter1.cfg
. Cela créera votre premier chapitre, et contiendra dans la console ce qu'il faut pour son démarrage. Il doit y contenir :
map <la première map de votre chapitre>
Vous ferez la même chose pour chaque chapitre de votre mod.
Localisation du nom
Créez (ou ouvrez, si deja existant) <votre mod>\resource\<mod>_english.txt
(ou _french
, _japanese
, etc). Ceci est le fichier de localisation , là où sont écrits les unicodes pour le tires de vos chapitres.
Le fichier doit ressembler à la chose suivant :
lang
{
Language "English"
Tokens
{
modname_Chapter1_Title "Nom du Chapitre 1"
}
}
Si ce fichier existe deja, ne le supprimez pas. Créez-en un nouveau.


Apparition du nom du chapitre lors du jeu
Le <votre mod>\scripts\titles.txt
défini ce qui apparaît lors du commencement de votre chapitre.
Recherchez la section "chapter titles" et modifiez le comme ceci:
//CHAPTER TITLES $fadein 0.01 $holdtime 3.5 $position -1 0.58 CHAPTER1_TITLE { #YourModName_Chapter1_Title }
Ce fichier doit être enregistré au format normal c'est à dire ANSI.
Images
Thumbnails
Vous devez créer un "Thumbnails pour chacun de vos chapitres, en guise d’illustration. Ces images doivent se trouver dans <votre mod>\materials\vgui\chapters\
et nommées 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
This is not necessary but is used to easily find the names of maps without quitting and relaunching the game.
Create <mod>\maplist.txt
and list of maps that your mod will use. For example:
Map1 Map2