Adding a Trainer NPC to Skyrim

From Nexus Wiki

Jump to: navigation, search

Contents

Overview

This tutorial shows all the main steps you need to follow to add a trainer NPC to Skyrim. In this tutorial I am using an existing merchant (created following the tutorial Adding a Merchant NPC to Skyrim) and expanding the services he offers by adding training lessons.

Required tools

  • Creation Kit: available on Steam (Menu option View -> Tools and then select Creation Kit)

Add a Trainer NPC

Add a new trainer class
Setting the NPC class
Setting the NPC factions
Add the TrainerGoldScript
Set the TrainerGoldScript properties
Setting the prefix for the TIF files
Dialogue Trainers quest
Duplicate dialogue
Dialogue lines order
Edit dialogue
Select shared answer
Response window
Available voices
Setting NPC Voice Type
Cleaning the esp file

The main steps for adding a trainer to Skyrim are:

  1. Edit an exising NPC
  2. Assign the right class to your NPC
  3. Assign the right factions to your NPC
  4. Add the TrainerGoldScript to your NPC
  5. Add the training dialogue to your NPC
  6. Add voice to the training dialogue
  7. Clean the esp file
  8. Package your mod

Edit an existing NPC

First we are going to load the esp file that contains the merchant NPC we want to edit. To do this:

  1. Launch the Creation Kit
  2. Select the menu option File -> Data ...
  3. Check the flag at the left side of the esp file that contains the NPC to edit (for example MyMerchant.esm)
    Note: If you want to edit the existing esp file, just press the button Set as Active File while having your esp file selected. If you want to create a new esp file, then don't set the esp file as the active file
  4. Press the OK button and wait until the CK has finished uploading everything (the CK will load your esp file and all the required masters like Skyrim.esm and Update.esm)
    Note: the CK has a bad habit of showing lots of warning messages. When the first one appears click on the Cancel button and you won't see more of these warnings.

Assign the right class to your NPC

  1. In the Object window expand the menu Actor and choose the existing NPC you want to edit.
  2. Double click on the selected NPC and a window will pop-up like the one shown in picture Setting the NPC class.
  3. In the Stats tab look for the class field and click on it: select one of the trainer classes from the drop-down list. All trainer classes names follow this convention: Trainer + "Skill" + "Trainer level", where:
    1. "Skill" indicates the name of the Skill the NPC trains, like Alchemy, Sneak, etc.
    2. "Trainer level" indicates if the trainer can train you depending on the level your character has in that particular skill. There are 3 trainer levels:
      1. Journeyman: can increase your skill from 1 to 50
      2. Expert: can increase your skill from 1 to 75
      3. Master: can increase your skill from 1 to 90
    3. If you want your trainer to train your character to a different level, for example, from 1 to 100, then you have to create a new trainer class:
      1. In the Object window expand the menu Character -> Class and choose one of the existing classes (for example, the TrainerMarksmanMaster class).
      2. Double click on the selected class to open a window like the one shown in picture Add a new trainer class and change the class ID. Press the OK button and when the CK asks you if you want to create a new class, anwer Yes.
      3. Double click on the new class you've created and in the edit window check the Training checkbox: this will allow you to edit the values of the offered training:
        1. The first box tells you which skill is to be trained (Archery, in the picture).
        2. The second box tells you the highest level your trainer will teach (100 in the picture).
          In the example shown in picture I've created a training class that allows my trainer to teach Archery up to level 100.
  4. Select now the trainer class for your NPC as shown in picture Setting the NPC class. Here the class is set to the new class I've created, that means the NPC can train you in Archery up to level 100.

It is good to save your progress from time to time just in case the CK crashes. To save your work seelct File -> Save and type the name of your plugin if you are creating a new esp (for example MyTrainer.esp).

Assign the right factions to your NPC

Next thing you have to do is to assign the right factions to your NPC or he won't be able to train you. You assign the factions to an NPC by dragging and dropping factions to the Factions and Ranks list of the Factions tab.

There are two factions that any trainer needs to have as shown in picture Setting the NPC factions:

  • JobTrainerFaction: this adds the trainer dialogue to your NPC. Set the Rank to 0 as shown in picture.
  • The specific training faction for the skill your trainer teaches: these trainer factions are named following the convention JobTrainer + "Skill" + Faction, where "Skill" indicates the name of the Skill the NPC trains, like Alchemy, Sneak, etc. In the picture, the faction I've selected is JobTrainerMarksmanFaction as this NOC will train you in Archery. Set the Rank to 0, too, as shown in picture.

You can add other factions to your Trainer . For example, if you are going to place him in Winterhold it is good to add some of the Winterhold related factions to avoid him having problems with the locals ;)

Add the TrainerGoldScript to your NPC

Next step is to add the TrainerGoldScript to your NPC. To do this:

  • On the Scripts section of your NPC edit window (the one encircled in picture Add the TrainerGoldScript) click the button Add.
  • From the drop-down menu that appears, select the TrainerGoldScript and press OK. This will add the script to your NPC.
  • Now double click on the script added to your NPC and a window like the one shown in picture Set the TrainerGoldScript properties will be opened.
  • Select the first property, Gold001, and select Gold001 from the the PickObject drop-down list (you can also press the Auto-Fill button and the CK will fill the box with the right object).
  • Select the second property, TrainerType and press the Edit Value button. This will allow you to enter a value for the property. The vanilla values are:
    • 1 = Journeyman trainer
    • 2 = Expert trainer
    • 3 = Master trainer
  • Once you've entered the trainer type, press the Ok button to close this window and return to your NPC edit window.
  • Press OK again to close your NPC edit window, and save the changes.


Add the training dialogue to your NPC

Set the prefix for your TIF files

First of all, we are going to set the initials that we want the CK to put at the beginning of the dialogue script files (called TIF, that stands for Topic Info Form). This way, it will be easier to identify the TIF files that belong to your mod and package them if you want to redistribute the mod. To do this:

  1. From the main CK menu select the option File -> Preferences ...
  2. This will open a window. Go to the Scripts tab as shown in picture Setting the prefix for the TIF files.
  3. In the Fragment file prefix box enter something meaningful. You can enter up to 4 characters, including numbers. These characters you enter here will be put by the CK at the beginning of your TIF files names. In the example, I've entered ASH as the prefix I wan to use, that means that all my TIF files will be named ASH_TIF_xxxx where xxx is an ID automatically generated by the CK.

Duplicate dialogue line

Now you can add the training dialogue to your NPC. To do it you have to edit the DialogueTrainers quest. This quest contains the dialogues of all trainers in game.

  1. In the Object window expand the menu Character and select the menu item Quest.
  2. Write "trainers" in the filter box at the top as shown in picture Dialogue Trainers quest: this will left only two quests at the right side of the screen.
  3. Select the DialogueTrainers quest and double click on it. This will open a window like the one shown in picture Duplicate dialogue.
  4. Select the Training Branch item on the left part of the screen and you will see the list of all trainers' dialogues listed on the right.
  5. Now we are going to duplicate an existing dialogue
    IMPORTANT NOTE on DialogueTrainers quest order:
    The DialogueTrainers quest works as follows: looks for a dialogue that can be said by your NPC from top to bottom. When it finds a line that can be said by the NPC (a line that fullfils the conditions set in the dialogue, it runs that line in game and stops looking for another dialogue line. That means that, if you want to add a trainer in Alchemy and put your dialogue lines after the dialogue lines that apply to all Alchemy trainers when they cannot train your character anymore (the ones encircled in picture Dialogue lines order), your NPC will say those closing lines instead of the dialogue line you've just added. That is because those closing dialogue lines only have as conditions that the NPC belongs to the JobTrainerFaction and the JobTrainerAlchemyFaction and nothing else.
    To avoid this and make sure that your NPC will say the dialogue line you've added, place your dialogue lines before those closing lines.
    1. Select one of the dialogue lines on the right list
    2. Right click on it and select Copy from the pop-up menu. Wait until the CK has finished copying the dialogue line.
  6. Next step is to edit the duplicated dialogue line:
    1. Select the new dialogue line:
      Note: To distinguish the new diloague line, check the Script Name box, at the bottom right section of this window: the TIF name the CK has generated begins by the characters you've entered in the Preferences window.
    2. Double click on the new dialogue line and you'll see a window like the one shown in picture Edit dialogue. Here you should edit the following things:
      1. Prompt: this is the text line that will appear when you talk to the trainer NPC in game. Put something meaningful here that shows what is the skill he trains.
      2. Conditions: this is the most important part to change. Change each one of the existing values by double clicking on each of the lines. That will open a pop-up window where you can change the value of the condition.
        1. GetBaseActorValue: select here the skill your trainer is going to teach (Marksman in the picture, as the trainer is going to teach Archery) and set the value to the maximum level your character can have to be trained by this NPC (in the example I've set it to be lower than 100 as my trainer can teach characters with Archery until level 99).
        2. GetIsID: select here the ID of your NPC trainer.
        3. GetInFaction: leave the first Faction check as it is (JobTrainerFaction).
        4. GetInFaction: change the second Faction to the training skill faction you've given to your NPC (JobTrainerMarksmanFaction in the example in the picture).


Once you've edited the dialogue, press OK to close this window and save changes. Then Press OK again to close the DialogueTrainers quest window.

Add voice to the training dialogue

If you've followed the tutorial to this point, your character will be able of providing training services but he won't say a word when you ask about them. We are going to fix this now.

I am going to use one of the vanilla existing answers. If you want to add new custom dialogue to your training follow this tutorial: Voice Acting: A Complete Guide.

Open again the dialogue window for your trainer (the window shown in picture Edit dialogue) and this time look for the Share response data box at the right top section, as shown in picture Select shared answer. Click on the arrow to see the drop-down list of available answers and choose one: you can see the text of the answer displayed in the Response Text box, so you'll know what your trainer is saying. In the example, I've chosen a shared response that will make my trainer say "Of course" when you ask him for training services.

Next thing is to check if the response you've selected is available for your trainer voice: if you have assigned a voice to your trainer that doesn't have the sound record corresponding to the reponse you've chosen, he won't say a word. To check this:

  1. Click on the ... button at the right side of the response box: this will open a window like the one shown in picture Response window.
  2. Double click on the Response text (the line highlighted in picture Response window): this will open a window like the one shown in picture Available voices.
  3. Look at the box at the bottom of this window, you'll see there all the voices that can say this line in Skyrim:
    1. The voice records are stored following this convention: Data\Sound\Voice\Skyrim.esm\"Voice type"\... where voice type is the type of voice you can assign to your NPC.
    2. I've assigned my trainer the FemaleYoungEager voice type, so I've checked if that voice is available in the response I've chosen. I can see there is a Data\Sound\Voice\Skyrim.esm\FemaleYoungEager\... folder listed there, so that means that my trainer will be able to say that line.
      Note: If you don't see the voice type for your NPC in the list of available voice types, you can either select another response text that is available for your NPC voice or change your NPC's voice by selecting another voice in the Traits tab of the NPC window, as shown in picture Setting NPC Voice Type.
  4. Once you've checked the available voice types, press the Cancel button to close the window, then press the Cancel button again to close the Response window and return to your trainer Dialogue window.
  5. Press the Ok button to close the Dialogue window saving the changes, and press the OK button again to close the Dialogue quest window saving the changes you've made.

Now your trainer should have say the response line you've chosen when asked for training services.

Save the esp file.

Clean the esp file

The CK (at least in version 1.8) will have modified the original dialogue line you were copying (it will have an * in front of its name as shown in picture Duplicate dialogue), and we don't want this unwanted edit to be included in our mod as it will prevent future Skyrim updates done to that line or other mods that edit that line to work. To fix this:

  1. Select the main menu option File -> Data ...
  2. Select your esp file and press the Details ... button. This will open a window like the one shown in picture Cleaning the esp file.
  3. Select the line that contains the original dialogue and press the Delete key in your keyboard: ypu¡ll see that an I appears in front of that line, under the Ignored column: what this means is that when you load that esp file the CK will ignore that line in the esp file (not in Skyrim.esm) and will not upload it from the esp file.
  4. Then press the Close button to close the details window.
  5. Press the OK button and wait until the CK reloads your mod.
  6. Now edit something in your mod (like for example, changing your NPC class and putting the right class again): you need to do this or the CK won't save your esp file again as it will think there are no changes done.
  7. Save your esp file and it will be now saved without the unwanted edit :)

Test your plugin in game :)

Package your mod

If you want to redistribute your trainer mod you will need to include the following files:

  • your esp file (for example, MyTrainer.esp)
  • the meshes and textures files that fix your NPC's face colour. These files will be located under the folders:
    • \Data\meshes\actors\character\FaceGenData\FaceGeom\MyTrainer.esp\
    • \Data\textures\actors\character\facegendata\facetint\MyTrainer.esp\
      where MyTrainer.esp is the name of your esp file
  • the dialogue TIF files, i.e. the files that begin by the 4 characters prefix you've used (ASH in the example) and that are located under the folders:
    • \Data\scripts\
    • \Data\scripts\source\


Related pages

Personal tools