Creating an NPC

About this guide

This guide will take you through a guided tour of all the tables required to set up an NPC. It will explain some tables in detail while only briefly describing the functionality of others. The tables that are only briefly touched upon are either quite simple to get around, or may get featured in future guides.

Most Common Use

For the most part, when you are implementing a new NPC, you will not need to touch most of the tables mentioned below, and typically, the sequence of implementation will look something like this:

  1. Create a new entry in the Spawn Data Table

  2. Link said entry to all the other tables in the Spawn Data Table

  3. Create a Weighted Spawn Table Row entry that links to the entry you made in the Spawn Data Table

  4. Set up a camp with the new NPC and spawn it

All the tables involved

For a quick reference of all the tables involved in the making of an NPC, here is a list:

Spawn Data Table

This is the most important table of all when creating an NPC. This is where you set up what templates the NPC should be using, as well as what blueprint class should be used, and so forth. We will go through this table in detail here.

You will notice that most of the data-work in this table consists of linking to other entries in other tables, so it helps having those set up once already.

Name - This is the display name of the NPC, typically something like "Kushite Alchemist II" or something akin to that.

Male Race Template and Female Race Template - (Human NPCs only) When creating an NPC, you can set it up to either be female OR male or randomize between the two. The "Race Template" here (see the section later on in this document for a look into this) determine what visual looks that should be used for the NPC. The Weight is a weighted chance of spawn (50 for both would mean a 50% chance of female or male spawn, while 1-0 or 100-0 would make it a guaranteed male spawn if the male weight is set to 1 or 100 and the female weight to 0).

Equipment template - (Human NPCs only) This section determines what armor and weapons the NPC will spawn with- this entry links to the "Equipment Template Data Table". Typically there shouldn't be a need to have more than two equipment templates assigned to any NPC; Armor and Weapon, and so the Equipment Template Data Table is organized just like this (see the section later on in this document where we will go through that table in detail).

Profession Template - (Human NPCs only) This, again, links to another table - the "Profession Template Data Table". This table determines, amongst other things, what bonus recipes the NPC knows when thrallified, and also determines the icon and thrall type of the NPC.

Stat Template - The stat template data table links to the corresponding entry in the "Stat Template Data Table". This table determines how much health, damage, consciousness and natural armor the NPC has.

Stat Modifier Template - Some certain NCP's may require some fine-tuning. The "Stat Modifier Template table" is a table where you can set up multipliers for the values present in the Stat Template. You may, for example, set up a new faction called "Legion_Of_The_Dead" whose base hitpoints is 200, but specific members of this faction, for example the fighters, should have an increased health. This is where this is set up.

Combo Presets - ( DEPRECATED, now set up in the Profession Table ) You may want to limit or control what combos your NPC does. The Combo Presets selection links to the "Combo Presets Table" by the Combo Preset ID, which tells the NPC what different types of combos they are allowed to use. You can also set up different combo-rules for different weapon-types which is helpful if your equipment-table randomizes between 1h and 2h weapons.

Npc Tags - These gameplay tags are used for challenges. For mods that have customized spawns and want them to count towards the challenges, it’s important to mark these off properly.

NPCClass - This dropdown selector allows you to select what blueprint should be used for the NPC.
Any non-human NPC should have their class set up to be the "BP_NPC_Wildlife_xxxx" blueprints (as an example, the Black Rhino is set up to "BP_NPC_Wildlife_RhinoBlack")

For humans this should be set to "HumanoidNPCCharacter" but there are some additional blueprints that may be good to know about:

In addition, you may have noticed that some humans have been set up with further customized classes, for example:

These are all set up with custom behaviours that go outside the norm of normal NPC's - the RelicHunters and MurielasHope members are neutral towards players, while the DarfariOstrichFarmers are set up to be friendly with Ostriches.

Behavior Tree - This should be set to either "BT_SimpleAttack" for combat NPCs and to "BT_Dialog" for dialogue/merchant NPCs.

Loot Table - Here you can set up what loot-table the NPC should have. We won't go through how loot-tables work in this guide but they are fairly straightforward randomized lists. There may be a forthcoming guide about these at a later stage.

Distance Threshold Ranged Weapon and Distance Threshold Melee Weapon - (Human NPCs only) This determines when the NPC should switch between Ranged and Melee weapons

Block Action Min Duration and Block Action Max Duration - This determines the minimum and maximum amount of time the NPC should attempt to hold the "block action" in combat

Block Chance - the percentage chance that the NPC should attempt to use the block action when combat starts

Block Chance when attacked - the percentage chance that the NPC should attempt to use the block action while in combat and being attacked

NPCBehaviour Parameters - This should be set to "BP_DefaultNPCBehaviorParameters" unless you are using a dialogue NPC, in which case, you should set it to the correct entry for dialogue NPCs (for example, "BP_DialogueParams_Female_Merchant1")

Health Bar Style - this determines if your NPCS is a normal npc, miniboss, world boss or unique thrall by modifying the health bar in the game.

Max Knockback Chain Time - Measured in seconds, this is how long the NPC can be knock-backed without entering knockback immunity.

Knockback Immunity Period - And this is for how long it stays in that period.

Level Curve ID - This determines how fast the follower can level up. The entry is looked up in the “ NPCLevelCurveDataTable

Growth ID - This determines what stats are affected when the follower levels up. The entry is looked up in the “ NPCStatsAndGrowthsDataTable “.

Perk Type - When followers level up, this entry is looked up in the “ NPCPerksDataTable “ table to see what perks it may get at level 10, 15 and 20.

Drop Equipment Preset - When killed, NPCs have a chance of dropping their equipment. This is only true for human enemies. This entry, in combination with the DropEquipmentTable determines the chance and durability multiplier of what is dropped.

Race Template Data Table

We won't go through the Race Template Data Table in detail, since most of it is very repetative. It may be worth knowing that the table determines the range of random looks for all NPCs. Unique (named) NPCs have specific setups, whereas others (specifically the "Race_xxxx" entries) have random ranges for many things, for example Character Tint/Skin/

Equipment Template Data Table

This table determines what items are put into what slots for the NPC.

Main Hand - Accepts any weapon

Off Hand - (not used anymore since daggers were moved to be 2 handed weapons)

Helmet, Torso, Legs, Hands, Feet - These are all armor slots - use the Item Template ID from the Item table to equip your NPC. You may have noticed that you may have multiple entries here. Doing so will randomize between them. You may also use "-1" as an entry, denoting a "no item equipped" result.

Backpack - Here is where you set the backup weapons for archers. Archers will use the weapon in this slot when switching to melee.

Durability - this determines the durability of the items in the inventory if dropped or when spawned on the thrallified version of the NPC.

Profession Template Data Table

The entries in this table will determine many aspects of the thrallified version of the NPC.

Thrall Type - This number should either be "0" (Any thrall that goes into a crafting station), "1" (any entertainer thrall), "2" (any Archer thrall), or "3" (Any melee fighter thrall)

Thrall Tier - This number should be 1,2,3, or 4 and determines the tier of the thrall.

Thrall Profession - this dropdown allows you to select the specific type of thrall (armorer, blacksmith, carpenter, smelter, etc) for the NPC

Thrall Group - Followers can belong to multiple Thrall groups. Each thrall group has a maximum cap of simultaneous followers assigned, defined in the “ ThrallGroupTable “; A “Warrior” entry, for example, has a maximum cap of 1 and is incompatible with SorceryHorde and SorceryDemon. This means you can have either, but not both, at the same time. Mounts, however, are compatible with every type of other thrall, so you can always have a mount with you.

Known Combos - this array contains all the combos that the character knows. If equipped with a weapon that does not contain any combos in this list, they will use the default combos defined in the weapon blueprint (“DefaultNPCComboPresetsTable“ table). The NPC will use the first combo it finds that matches it’s equipment as defined in the “NPCComboPresetsTable“ table

Bonus Recipes - this list contains all the bonus recipes that the thrallified version of the npc knows about (this list contains ID's from the Recipes Table)

Crafting Groups - This list contains all the different crafting station ID types that the thrall can be placed into.

Stat Template - When thrallified, this template should be used instead of it's original one - this links to the "Stat Template Data Table".

Thrall Stat Modifier Template - As with the Stat Modifiers for normal NPCs, this is the modified. The "Stat Modifier Template table" is a table where you can set up multipliers for the values present in the Stat Template. Typically, the higher tier the thrall, the more hitpoints, damage, etc.

Icon - the icon used for the thrall while in a Wheel of Pain or placed in the crafting slot of a machine.

Buff class - (not used)

Stat Template Data Table

When setting up your NPC, you should make certain that one of the existing Stat Templates is used, or a new one is created. If you choose to create a new template, you can change any INT or FLOAT stat for the NPC in this table.

Stat Modifier Template Data Table

This table is identical to the Stat Template Data Table, except for instead of giving a base value to the stats, the value here denotes a multiplier.

Example:

An NPC set up with Hitpoints value of "200" in the Stat Template Data Table and a Hitpoints value of "25" in the Stat Modifier Template Data Table" will have a grand total of 200 x 25 = 5000 hitpoints.

Be careful with multiplier as they can easily unbalance the game.

Combo Presets Table

The Combo presets table determines how your (human) NPC fights. Without a link to this table, the NPC will do random attacks between light and heavy. And while this is absolutely fine, a more directed selection of attacks allows for more specific gameplay situations for camps and special encounters.

Note : The row name in this table is what is being used as a link from the Spawn Data Table.

An additional note about the Action Sequence - an action sequence is a series of attacks and can be up to 4 attacks long. Any sequence longer than that will not function correctly, as 4 is the maximum combo length of both light and heavy attacks.

An entry may have multiple action sequences, in which case the NPC randomizes between each sequence when attacking.

Weighted Spawn Table Row

This table allows you to set up a random selection of NPCs to spawn when you set up a camp (or otherwise invoke the spawning of an NPC)

Weighted Table ID - This ID can be unique or replicated. If replicated, the system will randomize between all replicated entries.

Next Weighted Table ID - This allows the table to link to other entries in the table, which allows setting up a random selection of NPCs in a more structured fashion.

Example:

BlackHandCombat_Random has two entries - one links to the BlackHandArcher_Random and the other to BlackHandFighter_Random. These two also have multiple entries but does not link to further random tables.

Spawn Table ID - This is the table ID for the Spawn Data Table.

Weight - This is the weight for the random spawns.

Example: An entry of weight 1 and another entry of weight 1 have the same chance of spawning. An entry of weight 99 and another entry of weight 1 have a 99/100 and 1/100 chance of spawning, respectively.