Dialogue scripting

Dialogue scripting tutorial by de dood this is pretty much irrelevant now. FMC dialogue tool saw to that.

Quite a few people on the different Fallout modding forums have asked for help with scripting. I already wrote an overview of the main concepts of scripting, which can be found here. This time I'll deal with dialogue scripting. Before reading this, I suggest you read the aforementioned tutorial, and ColJack's tutorial on setting up the compiler, which can be found somewhere on the Mutants Rising site.

To write dialogue for a character you need two files. One will be a text file that will contain all the dialogue text, the other will be the character script that determines when a character will say what. They will have the same name, but the text file will be named NAME.msg and the script file NAME.int. The text file will be located in the directory data\text\english\dialog in the Fallout installation directory. The script file will be located in the directory data\scripts.

The text file will look like this:

{100}{}{A line of dialogue}
{101}{}{Another line of dialogue}

and so on. It doesn't matter in what order the lines are, but the numbers must be unique for each line of dialogue. This is the easy part. The script will determine which line(s) of dialogue to show at a given moment. That's the hard part.

The first thing you'll need in the script is the talk\_p\_proc procedure. This procedure will get called when the player tries to initiate dialogue with the critter. The basic procedure will look like this:

procedure talk\_p\_proc begin

```
   start_gdialog(NAME,self_obj,4,-1,-1);
   gSay_Start;
       call Node001;
   gSay_End;
   end_dialogue;

```

end

You can look up what the different commands do in the mapper manual, but the main thing to notice is the line that says call Node001. This will call the procedure that starts the dialogue. So we write a procedure called Node001.

procedure Node001 begin

```
   Reply(100);

```

```
   NOption(101,Node999,004);

```

end

The line that says Reply(100) means that the NPC will speak the line in the text file that is numbered 100. The NOption(101, Node999, 004) means that the player has the option to speak the line in the text file that is numbered 101 if his intelligence is greater than 4, after which the procedure Node999 will be called. Procedure Node999 is always the procedure which ends the dialogue. We now have a complete (albeit very short) dialogue! Let us now write another procedure:

procedure Node002 begin

```
   Reply(103);

   NOption(104, Node999, 004);

```

end

and change procedure Node001 to:

procedure Node001 begin

```
   Reply(100);

```

```
   NOption(102,Node002,006);
   NOption(101,Node999,004);

```

end

Now in Node001 the player has the option to say line 102 if his intelligence is greater than 6. If he speaks that line, Node002 will be called, which will result in the NPC speaking line 103 after which the player can only choose to say line 104. This is basically all there is to it. Writing dialogues is all about connecting the different nodes in the dialogue tree to each other.

Reply, NOption and a number of other dialogue related commands are macros for the gSay/giQ family of commands. Here are the complete descriptions of the most important gSay commands:

Name: gSay\_Message
Returns: void Dialog
Arguments:

```
 msg_list (int)
 msg_num (int)
 reaction (int)

```

Sets up a sayMessage, which is a reply with just a [Done] option. The msg\_list determines which message file to look in, and the msg\_num determines which line to use from the file.

Name: gSay\_Option
Returns: void Dialog
Arguments:

```
 msg_list (int)
 msg_num (int)
 target (procedure)
 reaction (int)

```

Sets up an option-choice for a reply block, getting the string from the message file (msg\_list) and message number (msg\_num), which will cause a given reaction (reaction), and if chosen will jump to the given (target) procedure.

Name: gSay\_Reply
Returns: void Dialog
Arguments:

```
 msg_list (int)
 msg_num (int)

```

Sets up a reply block (what the \*CRITTER\* says).

Name: giQ\_Option
Returns: void Dialog
Arguments:

```
 iq_test (int)
 msg_list (int)
 msg_num (int)
 target (procedure)
 reaction (int)

```

Sets up an option-choice for a reply block if the player's IQ statistic is equal to or greater than a given value (iq\_test), getting the string from the message file (msg\_list) and message number (msg\_num), which will cause a given reaction (reaction), and if chosen will jump to the given (target) procedure.

©2004 Daniel Sjöblom
mail me!