Dialogue actions and personality

Doesn't it get annoying how every time you talk to the guard, the conversation starts with "You see a guard..."? This should say something different if you've talked to the guard before. There are a couple of ways you can do this in AvernumScript. You could set up a SDF that remembers if you've talked to the guard before, and an if-else statement that displays text based on the value of the SDF. But this is such a common task that there's a shortcut. First, select the guard in the Editor and set his personality to 1:


Now, change the first node in the talk script to this:

begintalknode 1;
  nextstate = 1;
  personality = 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._";
  text5 = "The guard is still sharpening his sword. _Go talk to my boss._";
  action = INTRO;

personality = 1; matches what we put in the Editor. The special behaviour comes from action = INTRO;. There are a lot of common side effects that are caused by reaching a certain node of dialogue, such as identifying items, buying a room for an inn, giving a certain value to a SDF, or displaying only certain lines of text depending on whether the character has been spoken to before. You can find a list of all actions on page 93 of the documentation. In the case of the INTRO action, the game checks if you've spoken to the character with personality 1 before. If you haven't, lines 1 through 4 are displayed. If you have, lines 5 through 8 are displayed.

That's enough dialogue for the guard. Time to write what the merchant will say.