Tutorial: Titles.txt Last edited 2 months ago2024-09-17 17:06:06 UTC

Download attachment

The idea for this tutorial came from Loque who wanted to use the versatility of the titles.txt to display in-game messages. The tutorial he wrote was based on the work he was doing for his Mod. This guide has been written to take into account some of the information he provided, but mainly to get back to the basics of the titles.txt. Loque has been credited with writing this, because he produced the original work.

Titles.txt is used by env_message point entity to display some text on the client's screen, this was used extensively in the hazard-course, and some multiplayer maps. It's a very effective way of displaying text on the client's screen.

Using a game_text entity limits you to about 60 Characters per line using \n to add the second 60 Character line (Max per game_text is about 127 including spaces). You can link several game_text's together using a multimanager (I managed 10 without a crash) and this is fine for short intro's and titles. But you will have to open the .rmf and recompile it every time you want to change things.

The best thing about modifying the titles.txt is that you can make your changes, without effecting an already compiled map. It can display lots (Full Screen) of text over multiple lines, you have full control over 3 text effects, colours, display times etc.

The only drawback is that you have to supply the edited titles.txt file with your map.

You can find this file in the game directory
E.g.: valve\titles.txt or spirit\titles.txt Etc

Entity Setup

Create an env_message entity.

Set its Name to something like msg_01 - so you can target it.

Set the Message Name. The Message Name, in titles.txt, is the text in capital letters, that comes before a { parenthesis.
Something like CR28 or HZBUTTON1

Now for the Sound Effect. This takes the form of any other sound property: buttons/blip1.wav. This is the sound to be played at the beginning of the message. The sound gets played once only, and can only be played once. So no typewriter sound effects here.

There are 2 flags: check the Play Once one to make the message triggerable once only (no surprises there) and nothing for the person who guesses what the other flag does: in a multiplayer game, check this if you want all the players to see the message.
env_messageenv_message
All you need now is something to trigger it. Anything with a Target field can trigger an env_message.

Modifying titles.txt

Before you start doing anything with it I suggest you make a backup of titles.txt, in case you make a mess of things. To view the file use a simple text editor like Notepad with word wrap turned off.

The titles.txt has 9 major area headings, This will make it easier for us to modify, because Valve has done all the work. All you have to do is decide what you want your Message to look like (based on how it was in the game) and place it under the area heading that corresponds to that type and effect.
//INTRO TITLES (Black-Mesa Research Facility only)
//INTRO CREDITS
//END CREDITS
//INTRO TITLES (a second one, but it deals with the actual intro titles)
//CHAPTER TITLES
// In-Game messages
// Game title
//HAZARD COURSE TEXT
// Multiplayer Scoreboard
Ok, I know you don't want to use Valve's effects, but we will talk about adding your own later.

Looking at the text file itself, you can see that a lot of the options are already explained. But let's take a title from the file and I'll explain further. Here is the usage (as it appears in the Half-Life titles.txt):
//INTRO TITLES
$position -1 -1
$effect 2
$color 100 100 100
$color2 240 110 0
$fadein 0.01
$fxtime 0.25
$holdtime 3.5
$fadeout 1.5
CR27
{
Black Mesa Research Facility
Black Mesa, New Mexico
}
Here it is again with Commands and Values in bold and explanations in Italic:

// Hello I'm a comment
All lines with // in front of them will be ignored by the game.

$position -1 -1
$position specifies where on the screen the text will appear. The first number is the X value, the horizontal alignment.
Left =
Right = 1
Centre = -1

The second number is the Y value, or vertical alignment.
Top =
Bottom =1
Centre = -1

Example: $position -1(space)0.15 would be the horizontal center of the screen and at the top and $position 0.1(space)0.8 would be displayed at the bottom left of the screen.

$effect 0
Specify the effect to use.
Effect 0 is fade in/fade out
Effect 1 is flickery credits
Effect 2 is like a typewriter


$color 100 100 100
$color2 240 110 0
$color is the final colour (grey in this case)
$color2 is the highlight colour (gold colour in this case). The values are RGB (Red Green Blue) colour values, same as the lights.rad. ($color2 is not used in the Game title area) Any paint program worth its cheese will give you these values, even Microsoft's Paint! OMG!

$fadein 0.01
This is the time it takes to fade or 'scan' each character.

$fxtime 0.25
This is the amount of time the highlight lags behind the leading edge of the text.

$holdtime 3.5
How long to hold the message on the screen (after it scans out)

$fadeout 1.5
How long it takes the message to fade out, after holding.

CR27
This is important, this is the same as the Message Name of your env_message

{ this marks the beginning of your message

YOUR MESSAGE GOES HERE

} this marks the end of your message

Changing some of the commands, not all of them?
You can change commands like effects, colour, holdtime etc, e.g.:

$fadein 0.05 (Command)
$holdtime 9 (Command)

GAMEOVER (Message Title)
{
SUBJECT: FREEMAN

STATUS: EVALUATION TERMINATED

POSTMORTEM:
Subject failed to effectively utilize
human assets in achievement of goal.
} (end of title)

$fadein 0.9 (Command)
$holdtime 3 (Command)
TRAITOR (Message Title)
{ SUBJECT: FREEMAN

STATUS: HIRED

AWAITING ASSIGNMENT
} (end of title)

As long as the command you want changed precedes the Message Title, then the command will override anything before it. The example above shows two INTRO TITLES that will be displayed differently to the ones before them because the $fadein and $holdtime have been changed. All Messages after TRAITOR will have a $fadein 0.9 and a $holdtime 3 unless another set of commands are put in place.

Ok, so that is about it,
And don't forget to distribute that modified titles.txt file with your work! otherwise all anyone will see is the actual Message Name, and not the Message.

3 Comments

Commented 14 years ago2010-03-20 16:00:21 UTC Comment #100639
thanks ***
Commented 14 years ago2010-03-20 16:00:21 UTC Comment #100640
thanks ***
Commented 2 years ago2022-04-01 20:48:51 UTC Comment #104296
I remeber there was another setting that worked like a trigger, but i think they removed it.

You must log in to post a comment. You can login or register a new account.