Introduction to dialogue

So far you've seen two types of scripts: town scripts and creature scripts. To make our non player characters talk, we need to add a third: talk scripts. Create a new file in the scenario directory called z0tunneldlg.txt, and copy the following:


// Guard

begintalknode 1;
  nextstate = 1;
  text1 = "You see a guard, sharpening his sword with a whetstone. He looks at you suspiciously.";
  text2 = "_My boss has a job for you. Talk to her._";

begintalknode 2;
  state = 1;
  nextstate = -1;
  question = "That's a nice sword.";
  text1 = "He grunts, and continues sharpening.";

Let's break it down line by line, the way we did for town scripts:

But wait! How does the game know what the first node to display for the guard is? We need to specific the guard's starting node in the Editor. Select the guard, click 'Edit This Creature', and set 'Cell 3' to 1. If you read the comments for the 'basicnpc' and 'guard' scripts, Cell 3 is used to set the initial talk node for each creature. Creatures with Cell 3 equal to 0 cannot be talked to.


There's one other thing that needs to be set for the guard: its personality.