Factions and Characters

Contents

Characters
Factions
Building Swaps
Trade Cultures
Squads

Characters

Back to Top

Each unit that appears in-game, whether a generic NPC, a unique character, or a player character, is created in the characters tab. Much of the information in the right-hand panel is optional in case you want more granularity.

Bounty

Assigns Bounties: True for characters who assign bounties automatically when witnessing a crime. However, this is automatically true if the NPC is of the OT_MILITARY or OT_LAW_ENFORCEMENT type, and can never be true for characters of the OT_BANDIT type. A crime must occur within a town for a bounty to be assigned automatically.

Bounty Chance/Amout/Fuzz: The % chance this character has a bounty (0-100), its amount, and its +/- randomisation. Unless one or more factions are assigned with the “bounty factions” option from the dropdown, the bounty will default to the United Cities faction.

Armour/Clothing

Armour Gade/Upgrade Chance: All the armour worn by a character has a predetermined grade, with a % chance of it being upgraded one step.

Clothing: Assigned from the dropdown menu, characters may have pre-determined clothing or a random selection of it. The second value for each item determines its (normalised) chance of being selected.

Spawning without Clothing in a Slot: If the first value for a clothing item is a negative number (-1), then its attributes are ignored and it becomes a dummy option for a chance of spawning with no clothing in that slot. For instance, the samurai below has a 50% chance of spawning without any headgear:

Similarly, this character has an equal chance of spawning with a white veset, leather vest, or leather shirt.

General

Body: An optional body file that determines a character’s appearance, exported from the in-game character editor. The exported race must match the character’s race.

Dumb: Prevents the character from talking normally or becoming an interjector (e.g. Agnu). Dumb characters can be selected on interjector nodes with the “is character” option to force them to speak.

Faction Importance: Used to determine how interacting with this character (healing, defeating, kidnapping, etc) impacts your relations with the character’s faction.

Factions

Back to Top

Factions and other relevant entries can be found under the factions tab. The object types are:

  • Faction. Each faction, whether real or fake, appears in the faction list. Factions determine some basic information about how a faction’s squads behave, how its traders work, how it feels about slavery, and more.
  • Squads. All characters who appear in-game are a member of a squad. Squads determine AI, faction, and units, as well as other miscellaneous information that can be contextually relevant.
  • Building Swaps. Factions can use building swaps, which exchanges one building for another. For instance, bandits might exchange regular beds for camp beds.
  • Trade Culture. Trade culture influences item prices, what’s considered contraband, and buildings to which the AI can react if built in a player town.
  • Special squads and faction templates are older, partially implemented ideas that were abandoned. They’re unused and not functional.

Factions

Each squad and town in-game is assigned a faction. While you’re mostly free to do with factions as you wish, some are referenced by Kenshi’s internal code and mustn’t be deleted (although they can be edited):

  • United Cities. This is the default “Empire” faction. Characters who have a bounty on their head but no listed bounty faction default to the United Cities.
  • Tech Hunters. When a player dismisses a character, this character joins the Tech Hunters faction.
  • Wildlife. Wandering units and nests with no faction assigned default to the Wildlife faction.
  • No Faction. Towns without a faction assigned default to this faction.

Let’s break the faction data down, starting with the left-hand panel.

Faction Bounties

Bounties for breaking the law are assigned in three ways:

  • Bounties can be added to characters
  • Bounties can be triggered through dialogue events
  • Bounties are assigned by NPCs of the type OT_MILITARY and OT_LAW_ENFORCEMENT as long as a crime occurs in a town, unless the NPC faction is the OT_BANDIT type

Fundamental Type

Broadly speaking, it doesn’t make much difference what a faction’s fundamental type is, except for the OT_BANDIT type. Bandit factions don’t have any legal system and can’t assign bounties for breaking the law. Similarly, characters of the OT_BANDIT type won’t trigger the various crime witnessing events if they spot an assault, lockpick, or thieving attempt.

Building Swaps

A building swap replaces a building with another one, and each faction may have one or several building swap lists added. Any building may be swapped with any other, but take care when replacing the big stuff.

In vanilla, building swaps are used to select the correct faction banners, and to swap out furniture for lower-tier furniture for peasants and bandits.

To give a % chance of a building not being replaced, simply add a copy of it to its own building swap, like this:

The table is replaced with a metal table 50% of the time

Be aware that, like every piece of data you add to a faction or a town, doing this for hundreds of objects at once (e.g. swapping all bookshelves randomly) will adversely affect town loading times.

Trade Culture

Trade cultures let you affect trade prices and contraband.

Forbidden items are things that won’t spawn. Anything that is a forbidden item won’t spawn as part of a trader’s inventory or a random item lying around.

Happy and illegal buildings will trigger the dialogue events (I_SEE_PLAYER_NICE_BUILDING and I_SEE_PLAYER_ILLEGAL_BUILDING) if:

  • The building in question is in a player-owned town
  • When spotted, there is a nearby player character to act as the target of the dialogue

Legal and illegal buildings won’t cause the dialogue event should the player build in NPC-owned towns, such as by buying a house and putting furniture in it.

Illegal goods trigger the dialogue condition (DC_HAS_ILLEGAL_GOODS), which can also trigger the smuggling crime event when called.

Finally, trade prices alter the cost of items when purchased and sold by the player.

Trade cultures may be assigned directly to towns and town overrides. However, only the trade prices are affected – forbidden items and contraband are not.

Squads

Squads are used to spawn NPCs in the game world. They consist of one or more characters and can be added to the game world as town residents, nest residents, and homeless spawns. The following guidelines apply to squads:

  • Homeless squads with no faction will default to Wildlife
  • Residential (town) squads with no faction will default to the town’s owner faction
  • Squads need AI packages that tell them how to behave
  • Squads may have dialogue assigned to units, which overrides any dialogue defined in character data

Squads can have a lot of data and atrributes – but it’s not all relevant. The first distinction is whether a squad has a homebuilding or not: Squads with a homebuilding need to have an interior layout (at the least) defined.

You can view, edit, and make new interior layouts via the in-game editor. Using a unique string name for an interior can let you hand-place certain squads in their buildings. For example, you might make a new interior layout for a watchtower and put a unique NPC inside.

Exterior layouts are applied to the outside of buildings – like signs. If you set a squad to “regenerate”, this will respawn any units that get killed shortly after the town becomes unloaded.

You can make squads spawn as starving characters by setting the “malnourished” trait to true.

Unlike weapons, armour, and robotic limbs, crossbow levels for ranged units are determined by their respective squads. The tooltip here is wrong – crossbows can be up to 2 steps higher or lower than the option you pick (though it occurs rarely).

We’ll cover how traders and their inventories work in a later chapter.

Dropdown Data

There’s a lot of optional data here. Let’s go over it:

A squad can have three types of unit. When we cover AI packages, you’ll see that each of these three types can have tasks assigned to them:

  • One leader is assigned per squad. If no leader is chosen or the squadleader is down, the next character in the squad hierarchy will assume leadership.
  • Squad/Animal and Squad2/Animal2 make up the squad. Squad2/Animal2 units will copy Squad/Animal goals unless you define their goals separately. This allows to, for instance, to have guards who patrol in day and night shifts.
  • All units will copy leader goals if they otherwise have no goals assigned to them.

For each squad unit you assign (not leaders), you can define the number of each unit type. The second value defines the maximum number for random variation – leaving it at 0 will assign an exact number of characters.

Animals cannot normally be assigned dialogue directly – but it will work if you give them dialogue packages from their squad.

Adding either slave or prisoner squads will add the chosen squad as slaves (following their slave AI goals set in their owning squad’s package) or prisoners (if the squad has a homebuilding with cages).+

Vendors add lists of items that may spawn in a squads’ backpacks (if roaming) or containers (if resident).

World states apply only to roaming squads and nests. They are used to prevent squads from spawning unless a certain condition is met.

The choosefromlist function can be used to randomly choose X characters to add to a squad. You’ll find the minimum and maximum settings in the lefthand panel.