Okay, here I'm going to explain how to make your NPCs (non-player characters) say stuff when you want them to. For this, we will be using the scripted_sentence
entity, which can be triggered by its name attribute.
Scripted sentences work much like scripted sequences, which I have described in a prior tutorial. The similarity is that both entities have an NPC that they target, plus an additional target field, which makes them very flexible.
In order to make scripted sentences, you need to know what the sentences are. To hear them, and to learn their names, you need to go into Half-Life's main PAK file. We will soon have a version of it online, but until then, there is a sentences.txt file in the \sound directory inside pak0.pak. In order to view PAK files, download Pak Explorer. Okay, in sentences.txt, there is a list of sounds. The very first word on a line is the name of the sentence which you'll be using in Worldcraft. Following the name is its location in the PAK file, so you can play it for yourself to hear what it sounds like. Soon, Brian will post a list of these with a description of what they say, so you can eliminate the middle-man of finding your sentence and playing it.
Okay, make a scripted_sentence
entity. It really doesn't matter where you place it, but to keep track of them, I suggest you place them near their designated NPC. Go to its properties.
- Give it a name, so that it can be triggered. Put in a target if you want it to target another entity. The NPC that's supposed to say the sentence does NOT go into the target field.
- In the Sentence Name field, put the name of the sentence as I described it in the above paragraph, it's the name in capital letters. Now put a "!" in front of it. For example, if the sentence name is HG_GREN0, Sentence Name attribute should be !HG_GREN0.
- The Speaker Type attribute should be the name attribute of the NPC which is going to say the sentence.
- Listener Name can be set to any entity name, and the NPC will look at that entity when the sentence is triggered. If "player" (without the quotes) is entered as Listener Name, then the NPC will look at the player while talking.
The other attributes and the flags are self-explanatory.