Guide: Siege University - 208a: Non-Player Characters

==Introduction==
NPCs, or Non-Player Characters, are a category that includes all townspeople, shopkeepers, and hirable type actors. The following tutorial will lead you through the template files and conventions that apply to these, how to mix and match skins and hairstyles to create your own NPCs, and some tips and tricks on adjusting behavior and animations. 
===What You Need For This Tutorial ===
* Siege Editor
* Dungeon Siege
* Siege Editor Manual (siege_editor_manual.htm comes bundled with Siege Editor.)
* A test map you can practice with. You can create your own in the Siege Editor; a large, flat square will do.
===What This Tutorial Assumes You Have Already Learned===
This tutorial assumes that you have already read the previous Siege University courses, especially 201: Templates, and are familiar with basic Siege Editor operations. 
==Definition: What is an NPC?==
NPCs, or Non-Player Characters, are Actors who are not initially controllable by the Player(s). NPCs include Townspeople, Guards, Shopkeeps, and Hirables (which we generally refer to as potential party members, or PMs). Each type of NPC is defined in their templates through their base specializations and individual characteristics. 
There are three major types of NPCs: 
# Invincible, non monster-attackable townspeople (who range from 'filler' characters found in safe locations like towns to worldly traders camping in the most dangerous of locales) 
# Invincible, monster-attackable guards (who typically wear armor, wield weapons, and are found stationed at strategic or military locations) 
# Killable, monster-attackable potential party members who can be found anywhere at all. 
There are a few template blocks which differentiate these and allow them to possess vastly different functionality. 
Figure 1 - NPC types
 	invincible	attackable	
type 1	X 	 	townspeople, filler characters
type 2	X 	X 	guards
type 3	 	X 	potential party members (PMs)
==NPC Templates==
All NPC templates can be found under "Bits" in \world\contentdb\templates\regular\actors\good\ and in \world\contentdb\templates\regular\actors\good\NPC\. It would be a good idea to look through the files and see if you can recognize some of the NPCs you encountered in Dungeon Siege. Take a look at the example Townsperson template below: 
Figure 2 - A basic NPC template 
 [t:template,n:mp_townfolk_female_01]
 {
 category_name = "1W_townsperson";
 doc = "mp_townfolk_female_01";
 specializes = base_npc_fg_multiplayer;
 [aspect]
 {
 [textures]
 {
 	0 = b_c_gah_fg_skin_22;
 	1 = b_c_pos_a1_059;
 }
 }
 [common]
 {
 screen_name = "Ella Riverstarn";
 }
 [inventory]
 {
 custom_head = m_c_gah_fg_hlmt_head-02;
 [equipment]
 {
 es_feet = bo_bo_le_light;
 }
 }
 }
(Taken from \world\contentdb\templates\regular\actors\good\npc\npc_fg_based.gas - mp_townfolk_01) 
===Overview===
The major differences between NPC types are in what they specialize and the various template blocks which allow them to take on different capabilities. The following sections cover common NPC template components. You are encouraged to look through the specified template files while reading below. 
====Townspeople, Shopkeeps, and Guards====
Townspeople, Shopkeeps, and Guards all specialize base_npc_*, where * = fb for farmboys, fg for farmgirls, and df for dwarves. The key block is the [mind] block containing combat rules that determine how monsters will react when the NPC is in their sight range.
Figure 3 - base_npc_* [mind] block 
 [mind]
 {
 actor_may_attack = false;
 actor_may_be_attacked = false;
 }
(Taken from \world\contentdb\templates\regular\actors\good\npc\npc_fg_based.gas - base_npc_fg) 
To make an NPC into a Guard, the above false combat rules are changed to true. As a general rule, Shopkeeps should never attack or be attackable, since this can cause unexpected shopping problems. Shopkeeps who are allowed to die will drop all of their shop inventory on the ground, which considerably throws off the tuning and balancing of an area. 
====Hirables====
Hirables, or potential party member NPCs specialize base_pm_*. The key blocks within these base specializations are the [store] and [water_effects] (splashes while walking through water) components: 
Figure 4 - base_pm_* important components 
 [store]
 {
 can_sell_self = true;
 }
 [water_effects]
 {
 }
(Taken from world\contentdb\templates\regular\actors\good\pm_fb_based.gas - base_pm_fb) 
These are fairly self-explanatory: to hire an NPC, they must first be able to sell themselves, and [water_effects] allows them to generate splashes when moving through water. Hirables need to have the cost of hire defined as well. This is done by adding a gold value to their [aspect] block, with the gold amount being set to what they cost to hire: 
Figure 5 - Gold value 
 [aspect]
 {
 gold_value = 98880;
 }
Of course, if the Hirable is free, then the gold_value should be set to zero. 
===Skills ===
NPCs who can attack have an additional component within their [actor] component: the [skills] block. This is what defines the skills and stats the actor possesses, which determines their offensive capabilities. Take a look at the [actor] block below for an example attackable NPC. 
Figure 6 - An attack-enabled NPC's template 
 [actor]
 {
 [skills]
 {
 dexterity = 8, 0, 0;
 intelligence = 4, 0, 0;
 strength = 15, 0, 0;
 melee = 15, 0, 0;
 ranged = 10, 0, 0;
 combat_magic = 2, 0, 0;
 nature_magic = 1, 0, 0;
 }
 }
(Taken from world\contentdb\templates\regular\actors\good\NPC\npc_fb_based.gas) 
There are three values possible for each skill field. They are: Skill_name = experience level, experience points, starting level; Usually you will want to tweak a Hirable NPC's skills so they are the appropriate level for the region difficulty they are found in. To change the NPC's abilities, simply modify the skills and stats to the values you prefer. If you do not want them to have any levels in a particular skill, delete the skill's entry from the block and it will automatically be set to base levels. Keep in mind that Strength, Intelligence, and Dexterity have a base starting level of 10, which means any additional skill you add is incremental above that. For example, by adding an 8 to the dexterity line above (dexterity = 8, 0, 0;), the NPC will have a total of 18 dexterity (10 (base level) + 8 (added in [skills] block) = 18 (new total dexterity level)). 
I highly suggest that you look through components.gas (found in \world\contentdb\components\) to gain a better understanding of manipulating actor abilities. It is very easy to unintentionally create an NPC possessing skills that could never be obtained through normal play. If you want to maintain balance, try to adjust your NPCs' skills along the lines of the existing Hirables in pm_fb.gas, pm_fg.gas, and pm_df.gas. 
===Appearance===
When creating a new NPC variant, there are four appearance options you can adjust: skin, clothing, mesh, and head shape. All of these are defined within the [aspect] or [inventory] blocks: 
Figure 7 - Ulora's art asset information 
 [aspect]
 {
 model = m_c_gah_fg_pos_a1;
 [textures]
 {
 0 = b_c_gah_fg_skin_16;
 1 = b_c_pos_a1_026;
 }
 }
 [common] { screen_name="Ulora"; }
 [inventory]
 {
 custom_head = m_c_gah_fg_hlmt_ulora;
 }
(Taken from \world\contentdb\templates\regular\actors\good\pm_fg_based.gas - Ulora) 
====Skins====
The NPC's textures are defined within the [textures] block. Texture 0 is always the NPC's skin, which refers to the facial features and skin color. All of the available skin textures can be found in \art\bitmaps\characters\ and are spread between the Good_A_Heroes, Good_A_NPC, and Good_B_NPC directories. All skin textures are of the format "b_c_*…*skin_##." The texture name may seem confusing at first, but it follows the content directory structure. For example, b_c_gah_fg translates to Bitmap_Character_GoodAHero_Farmgirl. Example skin texture: b_c_gah_fg_skin_16. 
====Clothing====
The second texture, or texture 1, is the NPCs' clothing texture. Clothing texture variants are located in \art\bitmaps\characters\body_armor\. Each of the different clothing types requires a slightly different model. Any clothing texture you define within the template becomes the NPCs' 'underwear,' which will always be the base texture for that NPC, and will become visible if they die and drop all other equipment they might be wearing over it. Example clothing texture: b_c_pos_a1_026. 
====Meshes: Bodies====
NPC Meshes, or models, define the shape of the body and are adjusted once you have chosen the skin and clothing. For Ulora above, she uses a farmgirl skin, and thus requires a farmgirl model. Since she also uses the a1 clothing style, her model is of the a1 style as well. Thus, her model is m_c_gah_fg_pos_a1, or Mesh_Character_GoodAHero_FarmGirl_POSture_Armor1. Clothing textures can usually be applied to any Hero-type NPC (Farmgirl, Farmboy, Skeleton, and Dwarf) so long as you match up the Model to the Armor type. Feel free to mix and match these, so long you keep the types the same! An example mesh is m_c_gah_fg_pos_a1. 
====Meshes: Heads====
Farmgirl and Farmboy NPCs have a number of different hairstyles to choose from. While all of the following head meshes can be chosen for any farmboy or farmgirl character type, not all skins support all meshes. If one skin doesn't look right with a particular head style, either change the head or change the skin until you find a combination that you like. All custom head meshes are defined in the [inventory] block within the custom_head field. 
;Farmgirls
:Long ponytail: default head
:Poofy short hair: m_c_gah_fg_hlmt_head-02
:Loose hair: m_c_gah_fg_hlmt_head-03
:Very short hair: m_c_gah_fg_hlmt_head-04
:Short ponytail: m_c_gah_fg_hlmt_head-05
;Farmboys
:Short hair or bald (depends on skin used): default head
:Short hair with tails: m_c_gah_fb_hlmt_head-02
:Long hair: m_c_gah_fb_hlmt_head-03
:Mohawk: m_c_gah_fb_hlmt_head-04
:Pony tail: m_c_gah_fb_hlmt_head-05
Note: Dwarves and Skeletons do not have any additional head types. 
==NPC Animations==
===Overview===
Configuring NPCs to perform movements other than basic standing around is a frequently requested feature, so I will go into detail on how to set this up. Before reading further, take a minute to load SE and open your test map, if you haven't already. 
===Practical Exercise - Animation Configuration ===
====The "cmd_animation_command" Gizmo ====
To make NPCs display any animations other than their defaults, you need to use a Command Gizmo: cmd_animation_command. This is a Gizmo that allows you to define animation codes to change an NPC's current animations. These can be used either to change the NPC's default animation in that instance (for example, Tarish sitting on a log) or to play a particular animation at a specific time (for example, Rusk rolling out of bed when the party approaches). Bring up your test map and expand the Game Objects tree to \gizmos\commands\specialized\. Select cmd_animation_command and place it in the map. 
====Setting the Scene ====
First, you need an Actor. Farmboy-type actors have the most variety. Expand the Game Objects tree to \actors\good_characters\townspeople\regular\ and place mp_townfolk_m_02 in the test map. We don't want the NPC sitting on air, so expand the Game Objects tree to \furnishings\indoor and place a chair_wood_ornate behind the NPC. You'll probably need to make some fine-tuning adjustments to the chair's placement, but first you want to "wire" up the cmd_animation_command and do a quick test run in game. (Note: if the object list names aren't what you expect, make sure your content display options are set to development name, changeable in the Preferences window) 
====Wiring ====
Now you're ready to "wire" the animation: i.e., fill in the information that allows the gizmo to communicate with the NPC. Copy the NPC's SCID by selecting the NPC and either right-clicking and choosing "Copy scid to clipboard" or hitting "g" on the keyboard. Next, open the cmd_animation_command's template properties by selecting it and either right-clicking and choosing Properties, or hitting "v" on the keyboard. Paste the NPCs SCID into the client_scid field within the [cmd_animation_command] block. There are a number of other fields that can be adjusted as well, but for now let's keep it simple. The "Animation" field is where you put in the FourCC animation code that defines the animation you want to play. Since we want to make the NPC sit, type "sit2" into the Animation field. We want the animation to begin as soon as the NPC is loaded in the world, so change initially_active to True. 
====Test It ====
Now, save the region (make sure Objects are checked). Next, save the Map as a .dsmap so you can run it in the game. Close the editor, launch Dungeon Siege, and take a look at the NPC in the game. If he does not appear to be sitting directly on the chair, go back to SE and move the chair to a better position. If the NPC seems to be clipping through the bottom of the chair too much, change the chair's size by adjusting the scale_multiplier, found in the chair's template properties at the bottom of the [aspect] block. TIP: You can save a lot of time testing maps by launching the game directly to the map and region you're interested in. To do this, create a shortcut to Dungeon Siege and open its properties. In the Target field, add a space after the path information and add map=mapname to go directly to the map, and teleport=n:nodeguid to jump to any node of your choice. The Target should now look something like: "C:\Program Files\Microsoft Games\Dungeon Siege\Dungeon Siege.exe" map=test_map teleport=n:0x98a4b01c. By double clicking the altered shortcut to launch the game, you'll bypass the front interface. Don't forget to put the Dungeon Siege cd in the drive first!
===FourCC Codes===
The exact codes available for each hero NPC type are located in their base specialization template in the chore_misc block. The following are the most useful FourCC codes: 
;Farmboys
:sit1: sitting on a chair with arms resting on a table
:sit2: sitting on a chair with hands on knees
:sit3: variation of sit2
:bed4: sleeping on a bed
:bed5: sleeping on a bed variation
:bed6: sleeping on a hammock
:bed7: sleeping on a hammock variation
:hoe1: hoeing animation
:talk: talking/social animation
;Farmgirls
:sit1: sitting on a chair
:talk: talking/social animation
:hoe1: hoeing animation
;Skeletons
:talk: talking/social animation
:hoe1: hoeing animation
Note: Be aware that the sitting and sleeping animations are not intended to be used if the NPCs are wearing a robe or dress since those meshes don't actually have legs or anything else underneath. TIP: By default, when viewing an object's Template Properties in the Siege Editor, fields are displayed in hexadecimal format. When viewing cmd_animation_command's template properties, you will want to check the FourCC box located in the upper right portion of the Object Properties window. This allows FourCC codes to display in a legible format.
==Talking==
===Overview===
While not all NPCs are required to talk, most of the time it is desirable for them to do so. Shopkeeps and Hirables must be able to talk in order for them to do their jobs - selling goods or the use of their sword arm, for example. Each of the NPC types shares two important components that give them the ability to talk: the [conversation] component, and the [mind] block with a talk job. All talking NPCs must have the empty [conversation] component included either in their leaf template, or referenced in their specialization: 
Figure 8 - The conversation component 
 [conversation]
 {
 }
All talking NPCs must also have a talk skrit AI job defined in their [mind] block as well, either within their template or regional instance. NPCs with simple, single conversations can use the basic talk skrit:
Figure 9 - The [mind] block with the basic talk skrit 
 [mind]
 {
 jat_talk = world\ai\jobs\common\job_talk.skrit;
 }
If you want to have an NPC with multiple conversations based on various conditions, you must create a custom talk job for them that specifies what the conditions are and what conversation they should use. This is covered in 208b: Talk Skrits.
===Practical Exercise - Add a Conversation ===
Adding simple conversations to NPCs is fast and easy, thanks to Siege Editor's Conversation Editor. In the following section, we'll create a two-line conversation for the sitting Farmboy. Open the Siege Editor and load your test map from above. 
====Adding Conversations via Siege Editor ====
To add a conversation to an Actor, you must select an actor who has the [conversation] block within their template. Most of the "mp_*" type NPCs found in \actors\good_character\townspeople\regular\ are conversation-ready. If you try to add a conversation to a non-conversation-ready NPC, SE will generate a warning. 
Select the mp_townfolk_m_02 actor you previously placed. With the NPC selected, either right click and select Region Conversation Manager or choose Region Conversation Manager from the Tools Menu. This brings up the Region Conversation Manager window, which allows you to create, edit, and remove conversations. 
To add a Conversation to the NPC, click the New button and either name the conversation, or select an existing one. When naming conversations, they must be unique within that region only. Create a new conversation called "conversation_test" and click OK. Now it's time to edit the conversation's text. Select conversation_test from the Existing Conversations list and click Edit. You can now create or edit the text lines that make up the conversation, as well as add Goodbye Samples that will play when you close the NPCs dialogue window in game. 
====Adding Text ====
Now that the conversation name has been defined, it's time to add the actual text dialogue that will appear when you talk to the NPC in game. To add a line to conversation_test, click the New button. <No text added yet> will appear under the Text heading. Click on this string to select it and click the Edit button. The Conversation Text Editor will open and you can now add dialogue. Type "It's great to sit down." into the box. For the most basic conversation type, you can stop here; click OK to get past the next windows until you are back to looking at the scene in the editor again. 
====Add a Talk Skrit ====
NPCs must have a talk skrit defined in order to open a dialogue box in the game. Select the NPC and open his Template Properties. Scroll two-thirds of the way down the [mind] block until you find the jat_talk field. Paste in the basic talk skrit path: "world\ai\jobs\common\job_talk.skrit". 
Take a minute to go through the save processes and test the NPC in the game. When ready, continue reading for more advanced text settings and adding a second text block. 
====Text Settings ====
When creating or editing text, there are a number of settings you can choose to adjust. 
Text Scroll Rate: This number determines how rapidly the text scrolls within the dialogue window if it takes up more than one window. 1.0 is the fastest, 10.0 is the slowest.
Order: Each conversation can contain multiple dialogue blocks, or lines. Each line will be played in its own dialogue window depending in the order you specify. You are not required to give a text block an order - if the text block does not have an order, it will be played more than once. If there are multiple text blocks within a conversation and none of them have an order, the blocks will be played randomly every time you initiate dialogue with an NPC. When assigning orders, the first line you want to be read first is assigned order 0. The second is order 1, third 2, and so on. Note: if every block within a conversation has an order, no text will appear at all if you talk to the NPC again after the last line has played.
Audio Sample: Drop down to choose the audio dialogue that will play when you talk to the NPC.
Button Choice: These are non-custom buttons directly supported by the UI. Important note: you may only have one of these per text block. They are:Buy_packmule: Adds a button for purchasing a packmuleMore: Adds a button for advancing to the next text block in the conversationPotential_member: Adds a button for hiring an NPC to join your partyShop: Adds a button that opens up the shopActivate Quests: This allows you to activate a quest when the line is played. Quest-related topics will be covered in 209: Quests.
;Complete Quests: This allows you to complete a quest when the line is played. Quest-related topics will be covered in 209: Quests.
;Custom Buttons: There are two custom buttons you can add to the in game dialogue window. Button 1 appears on the far left side of the window, under the text area, while Button 2 appears just to the right of Button 1. These can be given any text string that will fit on the button, allowing you to create dialogue trees. However, you must create a custom talk skrit to use the buttons since there's no other way to define what conversation should be played when someone clicks on them. The Value field allows you to assign a unique ID to each button, which is then referenced in the custom talk skrit. Creating custom talk skrits that give the buttons in game functionality will be covered in a future Siege U course.
Continuing where we left off above, let's finish configuring conversation_test's text. For the text block ("It's great to sit down.") change the Text Scroll Rate to 3 to make the line scroll faster. Set the Order to 0 so it is the first conversation played. From the Button Choice menu, select More. Click OK. 
Now let's add the second line to the conversation. Click the New button to create a new line, select it, and click Edit. Type "I'd do anything for a tasty piece of jerky." Again, change the Text Scroll Rate to 3. Since we want this line to play anytime someone talks to this NPC after the first line has been spoken, we want to leave the Order value blank. Click OK to close the Text window. Click OK to get past the next windows until you are back to looking at the scene in the editor again. Go through the Save processes again, close the editor, and try talking to the NPC in the game!
 
===Multiple Conversations for a Single NPC ===
Setting up multiple conversations or custom buttons is more difficult and requires custom talk skrits. Multiple conversations for a single NPC are needed when you want to have an NPC respond differently according to changing conditions, or if you want the NPC to respond to you on a more specific level. For example, say a townsperson NPC is looking for a particular fabled sword. If your party does not have the sword, you expect the NPC will merely tell you that she is always on the lookout for such an item. However, if someone in your party already possesses the sword, the NPC should respond very differently! The key to creating 'smart' talking behavior in NPCs is by writing a custom talk skrit for that NPC. 
====Talk Skrits ====
Writing a custom talk skrit isn't as difficult as it sounds. A beginner's guide to writing custom talk skrits is covered in Siege U: 208B - Talk Skrits. 
==Stores==
===Overview ===
There are two kinds of Storekeepers: those who sell inventory (such as weapons, armor, spells, potions, etc.) and those who sell Packmules. Inventory storekeepers are configured to be tuned to the difficulty of the area they are placed in by utilizing randomized content, which is available through the Parameterized Content, or Pcontent system. This tutorial will cover the basic features of this system and will allow you to customize a shopkeeper. 
===Inventory Shopkeepers ===
Shopkeepers are configured in both their templates and conversations. 
==== Templates ====
There are three main components that define a Shopkeeper: the [actor] block (containing their portrait information), the [store] block (containing item markup information), and the [inventory] block (which defines what the NPC sells).
Shopkeepers have a large interface window through which their inventory is available. The upper right side also contains a portrait of their face. The facial textures are in Photoshop format and can be found in \Art\Bitmaps\Gui\In_game\Icons\. They are prefixed by "b_gui_ig_i_ic_c_*" 
Figure 10 - The [actor] block 
 [actor] {portrait_icon = b_gui_ig_i_ic_c_foulton;}
(Taken from \World\Contentdb\Templates\Regular\Actors\Good\NPC\npc_blacksmith.gas - blacksmith_zabar_treseck) 
The [store] block tells the game that the NPC is a storekeeper and also defines how much the store's prices are raised over the base item values. The item markup value plays a role in game tuning. It is highly recommended to leave this at 2. 
Figure 11 - The [store] block 
 [store]
 {
 item_markup = 2;
 }
(Taken from \World\Contentdb\Templates\Regular\Actors\Good\NPC\npc_blacksmith.gas - blacksmith_zabar_treseck) 
If the NPC sells potions, the [item_restock] block is added within the [store] block. [item_restock] tells the game that the contents should fully restock when the tab is clicked. Generally, potions and basic spells are listed within [item_restock], but any sellable item template can be called here. The format is templatename = number to restock. 
Figure 12 - [item_restock] 
 [store]
 {
 item_markup = 2;
 [item_restock]
 {
 potion_health_medium = 7;
 potion_mana_medium = 5;
 scroll_resurrect = 10;
 spell_fireshot = 4;
 }
 }
(Taken from \World\Contentdb\Templates\Regular\Actors\Good\NPC\npc_fg_based.gas) 
The [inventory] block contains all of the actual sellable content the shopkeeper has to offer. This is contained within the [store_pcontent] component, and is sorted into blocks for each different kind of inventory. For an example, take a look at the following blacksmith store inventory: 
Figure 13 - The [inventory] block 
 [inventory]
 {
 [store_pcontent]
 {
 full_ratio = 1;
 [armor]
 {
 [all*]
 {
 il_main = #body/23-40;
 max = 7;
 min = 7;
 }
 }
 [shields]
 {
 [all*]
 {
 il_main = #shield/3-40;
 max = 10;
 min = 10;
 }
 }
 [weapons]
 {
 [all*]
 {
 il_main = #melee/14-18;
 max = 10;
 min = 10;
 }
 }
 }
 }
(Taken from \World\Contentdb\Templates\Regular\Actors\Good\NPC\npc_blacksmith.gas) 
Before configuring a storekeeper's inventory, it is important to understand the basics of the Pcontent system. 
===Pcontent ===
The [pcontent] block is a set of "parameterized content" that is randomly generated, based on parameters that you supply. With the [store_pcontent] block - a subset of the Pcontent system - the game engine adds Pcontent to the shopkeeper's inventory (when that actor is loaded) by selecting from groups specified in the [store_pcontent] block. When loading an actor with a [store_pcontent] block, the game engine will either select all of the group's entries as candidates for inclusion or will choose one from the list. 
*If an "all" group is selected, then all of the items and groups within its block are available as candidates for adding to inventory. If a subgroup has a "chance" defined, then that will be evaluated to decide whether or not to include the group. 
*If a "oneof" group is selected, then one of its items or groups is selected based on probability. By default, all have the same chance of being selected (for example, a group with 3 items would give each item a 33% chance of selection), but by assigning "chance" values to the subgroups, you can change this. The total chance for a group must be <= 1.0. Note that a total chance of < 1.0 means that it's possible that none of the items will be selected and the entire group will be ignored. 
*When a group is selected, then min/max are used to specify how many of the items will appear, with a range from min to max chosen randomly. 
Figure 14 - The [store_pcontent] block 
 [store_pcontent]
 {
 full_ratio = 0;
 [tabname]
 {
 [all*|oneof*]
 {
 il_main = template_name; 
 //OR
 il_main = #pcontent_name/power_min-power_max;
 min = 20;
 max = 20;
 chance = 0.2;
 }
 }
 }
(Taken from \World\Contentdb\Components\components.gas) 
Each block can contain the full_ratio field, which is a 0.0 - 1.0 float that determines how full the tab may be. It defaults to the 1.0 or the setting in the store_pcontent block. Upon load, the store will repeatedly query its pcontent system, adding items until it reaches the full_ratio. Setting full_ratio to 0 will disable this repeated-add feature. 
The [tabname] block directly correlates to the in-game store interface tabs and determine which tab the inventory appears on. They are: 
:[armor], for body armor, helms, boots, and gauntlets
:[weapons], for swords, staffs, maces, etc
:[shields], for shields
:[magic], for spells
:[misc], for spellbooks and jewelry 
Now that you understand a little more on how to adjust pcontent, a word of caution: store inventory is yet another feature that greatly affects game balance, and it might be a good idea to copy and paste existing store inventory blocks from appropriately-tuned pre-existing NPCs until you get the hang of balancing your own store content. 
====Conversation ====
A shopkeeper without a conversation can't sell anything at all, so first thing you'll want to do after creating your new shopkeeper's template is to load up the Siege Editor. You already know how to place the NPC and create new conversations and text blocks, so do this part next. Once the conversation is ready, edit each text block within the conversation to choose Shop from the Button Choice menu. Voila, that's all you need to do! 
===Packmule Sellers ===
Creating Storekeepers who sell packmules is relatively simple. The process involves a mix of templating the new storekeeper and placing a Party gizmo in SE to link the mules and storekeeper together. 
====Templates ====
Packmule Sellers only require one additional component above the base NPC setup: the [store] block. This is the same component found in Inventory Shopkeepers' templates, and just as straightforward to setup. For an example, look at Fretch's template below: 
Figure 15 - Fretch 
 [t:template,n:fretch]
 {
 category_name = "1w_character";
 doc = "fretch";
 specializes = base_npb_fb;
 [aspect]
 {
 [textures]
 {
 0 = b_c_gah_fb_skin_19;
 1 = b_c_pos_a1_060;
 }
 }
 [common]
 {
 screen_name = "Fretch";
 }
 [conversation]
 {
 }
 [store]
 {
 item_markup = 2;
 }
 }
(Taken from \World\contentdb\templates\regular\actors\good\npc\npc_fb_based.gas - Fretch) 
====Party Gizmo and Editor ====
Mule sellers are unique in that they are an NPC who sells NPC mules. Once the sale has taken place, the NPC mule is automatically transformed into the party-member Packmule, complete with a new model and texture to give them saddlebags. While the behind-the-scenes changeover isn't something that requires modifications to occur, the shopkeeper and mules are linked together via the Party gizmo and the Party Editor. 
====Tutorial ====
The Party gizmo is an editor gizmo in the shape of a person. It can be found under gizmos\commands\specialized\party_npc. With your test map open, take a moment to place one in your region. Note: until recently, the party gizmo was not listed in the SE object lists. If you are using an older Update version than 1.09.2, you may need to perform a content search for party_humanoid by choosing the Content Search function found in the Object menu. 
Now, you need a merchant seller and mules. First, place Fretch in the test map next to the Party gizmo. He can be found in \actors\good_characters\guards_and_pms\regular\fretch. Next, place two mules for him to sell, found in \actors\ambients\regular\mule. Base mules have a default gold value of 200, however this can be changed depending on the difficulty of the area. To change the base sale price, adjust the gold_value field within the [aspect] block. You may also want to adjust the screen names of the mules to better identify them. 
Open the Object Menu and select the Party Editor. This will open the Party Editor window, where you can assign Fretch and his mules to the Party gizmo. Select the scid of the Party gizmo from the Party Name menu. From the Available Actors listing, select Fretch and click the Add button. Finish assembling the party by adding both of the mules in the same manner. Click the OK button to close the window. 
Finally, add a conversation to Fretch, and make sure all text blocks contain the buy_packmule Button Choice. Don't forget to add a talk job ("world\ai\jobs\common\job_talk.skrit" is fine). 
Now that setup is complete, Save the region (make sure Objects is checked), save the map as a .dsmap, and test it out in the game. 
==Conclusion==
You should now have a better understanding in what makes NPCs tick, from templating them, customizing their appearance and animations, to making them talk and offer both items and mules for sale. Keep this information in mind while reading through Skrits and Quests.
== Navigation ==
Category:Dungeon Siege Editor