How to make a War Campaign or Trader Visit About AI Campaigns

WIP

You have two options for sending an AI campaign: territorial or dialogue.

Territorial campaigns trigger on their own based on the frequency and distance set in the trigger file (FACTION_CAMPAIGN).

Dialogue campaigns trigger from a dialogue, usually PLAYER_TALK_TO_ME but they can be triggered from any of the dialogue events.

Both are set up exactly the same on the trigger file, but Territorial Campaigns require a town set to that faction somewhere in the world. The town does not need residents of buildings, just a town marker somewhere. Do note, that even TOWN_NULL will trigger a ‘Discovered ’ notification to the player. The faction must also have the campaign set to it for it to trigger and the squads used must have suitable AI packs, at least patrol map.

Dialogue Campaigns require a NPC of that faction to trigger the campaign.

There can be only one campaign coming/active from a faction at a time. So try not to make new campaigns for vanilla factions. If you do, make sure the world states prevent two campaigns to be possible at the same time. And this naturally means your mod is incompatible with other mods who add campaigns to the same faction.

How to set up the campaign

  1. Copy any of the vanilla campaigns, try to pick one closest to the type you are meaning to do: trader, tax or attack
  2. Change the squads used or keep them
  3. Victory Trigger: what happens when this squad wins in the fight against the player, does it trigger a new campaign? The same campaign? Nothing? Does not trigger if the squad leaves peacefully.
  4. Loss Trigger: what happens when this squad loses in the fight against the player, does it trigger a new campaign? The same campaign? Nothing? Does not trigger if the squad leaves peacefully.
  5. Announcement: very important, this makes or breaks your campaign. It is a monologue with interrupt to a PLAYER_TALK_TO_ME dialogue. It is up to you what you put in these dialogues, but the important bit is they need Dialogue Actions of DA_RETREAT_PHASE, DA_ASSAULT_PHASE or DA_VICTORY_PHASE. The latter triggers also the Victory Trigger.
This article is adapted from How to make a War Campaign or Trader Visit About AI Campaigns on the Kenshi Fandom wiki, written by its contributors and licensed under CC BY-SA 3.0. It has been converted to Markdown, and its images and navigation boxes were left out.