Welcome, Guest! Login | Register

Sentence Scripting [Print this Article]
Posted by: RaveN
Date posted: May 10 2003
User Rating: 4.7 out of 5.0
Number of views: 4381
Number of comments: 2
Description:

Basics

Most
of the sentences you can hear in half-life are being scripted. This is where
the file 'sentences.txt' in \valve\sounds comes up. Before you change it you
should read through the whole article and also keep the RULES in mind.

You can deliver a new sentences.txt with a mod (to place in half-life\modename\sound\sentences.txt).
You still will be able to use half-life's scripted sentences in your mod, as
the one in your mod subdir is being loaded in adition to the half-life one.
If you use an alias name in your script file (in your mod's sound dir) 
that also is being used in half-life's script file (which is in half-life\valve\pak0.pak),
then the one in your newly defined alias will replace the one in half-life's
script file. Let's demonstrate this on a small sample:



















location
of alias
alias
definition
valve\sound\sentences.txt HG_GREN0
hgrunt/clik(p120) grenade! clik
valve\sound\sentences.txt HG_GREN1
hgrunt/(t30) clik take!(e75) cover!(s5) clik
yourmod\sound\sentences.txt HG_GREN0
hgrunt/clik(p120) freeman! clik

You now call the HG_GREN
sentence group from your mod's code. It randomly will play all HG_GREN# numbers
it can find in both scriptfiles (hl one and yours, whereas yours has higher
priority). So in this case you would hear "click..FREEMAN!..click"
and "click...TAKE COVER!..click" both being played randomly. Half-life's
HG_GREN0 won't be played though, as it has been redefined in your new script
file.


There currently is NO possibility
to include a sentence script file with a map without replacing the global ones.
You can have one per mod though. Furthermore I'd suggest you don't modify half-life's
sentences.txt but make one for your mod and place it in your mod's sound dir.
That way you can use your own scripted sentences and still are able to use the
half-life ones.


 


Detailed Info


example:
HG_POSA hgrunt/clik hold position, a. clik clik


Each sentence of the script
has to start with an alias name, that you will refer to from within the map
or the code (i.e.: HG_POSA). The alias is being followed by a space and the
directory name, where the wav files are located, then a slash (i.e.: hgrunt/).
The default directory is 'vox/'. Therefore if you dont specify a directory it
will search for the wav files in the vox/ subdir. After that the wav commands
start (no space between the directory name and the first voice command). Just
use the wav filenames without using the suffix '.wav' though. You also can use
',' and '.' in between to change the pronounciation ('.' calls the file '_period.wav'
and ',' calls the file '_comma.wav').


You also can group sentences
in order to call them randomly. That makes sense especially for often used situations
such as a incoming enemy. Sentence groups all start with the same name (i.e.:
'NMY_INC') then a number (i.e.: 'NMY_INC0' and 'NMY_INC1'). You can have a maximum
of 31 sentences in a single group (i.e.: 'NMY_INC0' to 'NMY_INC30').















example: NMY_INC0
hgrunt/clik tango fiftymeters north. clik
  NMY_INC1
hgrunt/clik freeman fiftymeters north! fire! clik
  NMY_INC2
hgrunt/clik target fiftymeters north, over. clik

Playing sentences
from the command line, for debugging and testing:















speak !HG_CLR plays the sentence
named HG_CLR
speak !HG_CLR0 plays the sentence
named HG_CLR0
speak "hgrunt/cover!
Me!(p105)"
plays
the sentence specified within quotes

 


Parameters

































P   Pitch 50-150,
100 is no pitch shift, 50 is very low pitch, 150 is very high
V   Volume %
of standard volume. 100 is no volume change, 50 is half volume.
S   Start
point
start
wave playback % from beginning. 0 starts playback from start of wav, 25
skips the first 25% of the wav.
E   End
point
end
wave playback % from end. 100 ends playback at the end of the wav. 80 ends
playback 80% into the wav.
T   Time
compress
playback
in % less time (without pitch shift) 100 plays back the wav unaltered. 50
plays back the wav in half the time. 30 plays back the wav in 30% less time.

Parameters
applied to a word are grouped in parentheses directly following the word with
NO space following the word. Parameters that apply to a range of a sentence
are grouped in parentheses, preceded and followed by a space.


In
the following sentence


HG_CLR
hgrunt/clik (p105 t30) my(e70) sector(s10), clear(p95 t20), over(p95). Clik


(p105
t30) applies to the entire sentence after the word ‘click’, and is
a parameter group indicating ‘play back pitch of all words at 105%, and
time compress all words to playback 30% faster’. The parameter (e70) directly
follows the word ‘my’, and indicates ‘end the playback of the
word 70% into the wav’. (s10) indicates ‘start playback of the word
sector 10% into the wav. (p95 t30) indicates ‘playback pitch of the word
clear is at 95% with 20% time compression.’ NOTE: this pitch change overrides
the previous pitch shift parameter (p105) for the entire sentence. These parameters
were all set to improve the intelligibility and flow of the sentence. None of
them are required. The sentence could also have been written like this, would
speak the same words, but perhaps not as realistically:


HG_CLR
hgrunt/clik my sector, clear, over. click



Rules


Never delete or rename any sentence or sentence group
that is in sentences.txt as published by Valve. The code refers to those sentences
and sentence groups. In case it cannot find one or more, it will crash single
player half-life.

You may change the content of a sentence, change the
number of sentences within a sentence group (except for countdown/countup or
power level sentence groups!), and you may add new sentences. You may not have
more than 1022 sentences in sentences.txt. You may not have more than 31 sentences
per sentence group.


Rate This Article
This article is currently rated: 4.7 out of 5.0 (3 Votes)

You have to register to rate this article.
User Comments Showing comments 1-2

Posted By: fyrye on Mar 11 2004 at 09:16:57
Info on the maps entities would be nice

Posted By: The Master Maniac on May 23 2004 at 07:45:16
Wow, I never knew playing Half-Life for the thousandth time could be so darn fun! Heh, thanks for this insight--I never had a clue this was how the grunts' lines were spoken!


You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005


Latest Comments
knock knock
General | News
By: MIFUNE | Dec 31 2017
 
knock knock
General | News
By: omega | Dec 22 2016
 
knock knock
General | News
By: MIFUNE | Oct 10 2015
 
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
 
knock knock
General | News
By: Whistler | Nov 05 2011
 
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
 
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009
 

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (3 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!