AI TUTORIALS
AI Influence Mod Banner

AI INFLUENCE TUTORIALS

Mount & Blade II: Bannerlord β€” Complete Tutorials & FAQ Compendium

Master the AI Influence Mod β€’ From Beginner to Advanced Roleplay

v3.3.7 β€’ Updated: January 2026
⚠️ IMPORTANT WARNING: AI Influence is designed to work with Vanilla Mount & Blade II: Bannerlord. If you experience crashes or issues, these are likely caused by compatibility problems with other mods. We do NOT provide support for mod compatibility issues - this is the user's responsibility.

πŸ“š Table of Contents

πŸ“¦ Installation Guide

βš™οΈ How to Install AI Influence

Step 1: Download Latest Version

Get the mod from:

Step 2: Extract to Modules Folder
Mount & Blade II Bannerlord/Modules
Step 3: Required Dependencies
  • Harmony
  • ButterLib
  • UIExtenderEx
  • Mod Configuration Menu (MCM)
⚠️ These mods must be ABOVE AIInfluence in load order!
Step 4: Load Order Example
1) Harmony 2) ButterLib 3) UIExtenderEx 4) MCM 5) AIInfluence βœ…
Step 5: Supported Versions

Bannerlord 1.3.9 - 1.3.13

πŸ†“ Free Local AI - Player2 Setup

1. Download Player2:

https://player2.game/

2. Run Player2.exe:

Local server starts automatically at: http://localhost:4315/

3. Configure in Bannerlord:

MCM β†’ AIInfluence β†’ Settings:

  • AI Backend: Player2
  • URL: http://localhost:4315/
  • API Key: leave empty βœ…

🌐 Other Supported AI Providers

⭐ OpenRouter

GPT-4, Claude, Gemini, etc.

βœ… Best quality, requires API key

πŸ’» Ollama

Local LLMs

βœ… Free & offline, supports many models

πŸ–₯️ KoboldCpp

Local AI chat models

βœ… Good for lower-end PCs

How to Switch Models:

MCM β†’ AI Backend β†’ Select provider β†’ Enter API URL and Key if required

Tip: Better AI models = smarter characters

πŸ”Œ DeepSeek API Setup

🌐 How to Use DeepSeek API with AI Influence

Step 1: Create Account

Go to platform.deepseek.com and create an account.

Step 2: Top Up API Funds

Add funds to your API account for usage.

Step 3: Generate API Key

Navigate to API Keys section and create a new API key.

Warning: Save your API key immediately as you can only view it once. Never share it with others unless you intend to.
Step 4: Configure in Game

In Bannerlord's MCM β†’ AI Influence settings:

  1. Select DeepSeek as AI backend
  2. Enter your API key
  3. Configure URL if required

❓ Frequently Asked Questions

πŸ“Œ Where should I ask questions about the mod?

Answer: Check FAQ first, then use Discord for mod discussions.

⚠️ What should I know about the BETA status?

Answer: AIInfluence is in BETA. Bugs, weird NPC behavior, and unexpected AI actions are normal. Report issues in appropriate channels.

βš™οΈ How do I set up MCM AI Backend?

Answer: MCM β†’ AI Backend β†’ Select provider (Player2, OpenRouter, etc.) β†’ Enter URL and API key if required β†’ Press "Test Connection" to validate.

❀️ What are Romance settings?

Answer: MCM β†’ Romance (BETA) settings:

  • Minimum romance level for marriage (default 50)
  • Romance with married NPCs (OFF by default)
πŸ“° How do Dynamic Events work?

Answer: AI analyzes dialogues and creates news, rumors, and political events. These spread between NPCs and can influence alliances, trigger wars, or peace agreements. ⚠️ Some features are experimental.

πŸ”§ Troubleshooting Guide

❌ Mod Not Working?

Check These First:
  • βœ… Correct Bannerlord version? (1.2.12 or 1.3.1)
  • βœ… Dependencies installed? (Harmony, ButterLib, UIExtenderEx, MCM)
  • βœ… Load order correct? (Dependencies ABOVE AIInfluence)
  • βœ… Running without conflicting dialogue/diplomacy mods?
  • βœ… Try new campaign
AI Not Talking / No Messages?

Check AI backend settings in MCM:

  • βœ” AI Backend selected? (Player2, OpenRouter, etc.)
  • βœ” URL correct? (e.g., http://localhost:4315/)
  • βœ” Internet ON? (if using cloud AI)
  • βœ” API Key entered correctly? (if required)

βœ… Tip: Press "Test Connection" button in MCM!

Freezes or Low FPS?
  • ⚠️ Too many initialized AI characters!
  • MCM β†’ Performance: Reduce AI character count (recommended: Around 100 active NPCs)
  • βœ… Disable heavy mods that rewrite diplomacy or economy
  • βœ… Restart Player2 / AI backend after long sessions

⭐ Asterisk Roleplay Guide

🎭 Using Asterisks Actions for Better Immersion

1. Purpose & Benefits:
  • βœ… Better management of situations with NPCs
  • βœ… Clarify NPC misunderstandings
  • βœ… Provide deeper immersion through extended replies
  • βœ… Increase chances of persuading NPCs
2. Planning Your Approach:

Consider these factors before interacting:

  • a) What do you want from the NPC?
  • b) What is the NPC's status (merchant, lord, noble, etc.)?
  • c) What approach matches your character?
  • d) What environmental details are worth describing?
3. Example Scenario:

Situation: You want information from Korin, a merchant in Balgard.

Your Character: Wandering merchant/mercenary who served a Western Empire lord.

"I slowly walk by the side of road. I smile gently when approaching Korin's stall, then I slowly look at his wares *Well, I see you have pretty decent offer of nice wares* I'm gently touching one of the books that are displayed at stall, then I shift my focus back to Korin *I'm interested in some specific goods, and I heard that you may be the one who could provide them for me* I smile gently, a sun is lightly shining at the whole street when I come a few steps closer to the stall *I'm very interested in some old books from the region.*"
4. Correcting AI Mistakes:

When NPCs don't believe your words, use asterisk actions to provide context:

"I nod gently then repeat myself *The words I have spoken are the honest truth, if you don't want to believe me, maybe you should ask your advisors* I slowly turn my head to the advisors of the king, and watch with smile on my face when they agree with my words *Now you see, that I did not lie to you.*"
5. Getting Longer Replies:

Configure in MCM settings:

  1. Set maximum characters to highest value
  2. Set minimum response to at least 150 characters
6. Advanced Roleplay Tips:
  • Use extended descriptions: "I walk slowly, the setting sun on horizon slowly reflects on my shining armor as I walk towards my soldiers"
  • Express emotions: "I just slowly pass by, not even considering his presence, my eyes are little wet from crying"
  • Act like a real person would!
7. Full Conversation Example:
Player: *stops the procession of my leper knights, seeing the imperial banners in the distance. We step off the road, our armor slowly crunching as we move. I turn to Ragaea* Greetings, Empress, it is an honor to meet you on the road *I nod slightly with my deer-antlered helmet* I am Oskar of the Leper Knights. Ragaea: *I raise my hand in greeting, slightly bowing my head, which causes the heavy jeweled crown to gently shift in my hair. My scale armor clinks softly as I move* Greetings, Oskar. I saw your banners on the road. Leper Knights... I have heard tales of your service to travelers. It is a noble occupation in these troubled times. *My eyes survey your group, assessing their discipline and weaponry* What brings you to this region? The road to Lartuzys is not the safest, especially when The Aseraeans are tearing at our southern borders.

πŸ‘₯ Multiple NPC Conversations

πŸ”„ Dual-Conversation Format Tutorial

1. What This Tutorial Covers:

This tutorial explains how to enable conversations with multiple NPCs simultaneously, a feature not natively supported by the mod but possible through custom configurations.

2. Compatibility:

Works with every version of Bannerlord/Warsails. It explores AI possibilities and prompt engineering techniques.

3. Initial Setup:

Go to MCM settings in-game:

  1. Set maximum AI response to 1000 characters
  2. Set minimum AI response to 300 characters
4. Edit world.txt File:

Add the following rule to your world.txt file:

DUAL-CONVERSATION FORMAT (universal roleplay rule) Whenever the player explicitly asks an NPC to speak for two (or more) named characters in the same scene ("RP both {Character} and {Character}", "let Elga and Sidunric talk", etc.), that NPC must format the reply exactly like this: CharacterOne: action/description in asterisks Spoken line or inner thought. CharacterTwo: action/description in asterisks Spoken line or inner thought. CharacterThree: action/description in asterisks Spoken line or inner thought. CharacterFour: action/description in asterisks Spoken line or inner thought. Alternate one block per speaker, never merging them. Keep each character's voice, personality, and physical quirks perfectly intact. Everything said in these replies are to be remembered by each respective character even though the context isn't in their JSON files. Continue the back-and-forth naturally until the conversation pauses or the player interrupts. If one character is silent for a beat, still give them a labeled block to show body language or reaction. Never narrate as the player or break the labeling system.
5. Gathering NPCs & Conversation:

Gather NPCs in the same place (ideal for meetings). When speaking to the main NPC (settlement owner/meeting organizer), end your statement with:

*RP all four characters in the same reply using Hecard:, Servic:, Richelda:, Servic: labels so we can follow their back-and-forth easily.*

⚠️ Important: Always name each NPC involved to maintain consistency.

6. Note on Usage:

Generating larger responses to complicated prompts can use more tokens from Player2. Report any bugs encountered while using the dual-conversation rule.

πŸ”„ ChatSync Submod

🀝 Enhanced Multi-NPC Conversations with ChatSync

What is ChatSync?

ChatSync is a submod for AI Influence that synchronizes conversations between selected NPCs. Once synced, characters share the same conversation context, making them aware of what has already been said and eliminating the need to repeat dialogue. This creates a true multi-NPC conversation experience instead of isolated one-on-one interactions.

Download: ChatSync on Nexus Mods

Key Features:
  • Select multiple NPCs to sync conversations
  • AutoSync mode to keep dialogue context shared
  • NPC search for quick selection
  • Easy in-game UI with intuitive hotkeys
  • Ideal for companions, advisors, rulers, and role-play focused gameplay
  • Universal path detection for all installation types
How to Use ChatSync:

Hotkeys:

  • F8 – Open/close ChatSync menu
  • F9 – Toggle AutoSync ON/OFF instantly
  • F10 - Show Diagnostics
  • F11 - Manual Path Setup (if automatic detection fails)
Installation:
  1. Download ChatSync from Nexus Mods
  2. Place the ChatSync folder in your Bannerlord Modules folder
  3. Ensure it loads after AI Influence in your load order
  4. Launch game and use F8 to open the ChatSync menu
Smart Path Detection:

ChatSync automatically searches for AI Influence in ALL possible locations:

  • Steam Workshop installations (all drives and library folders)
  • Different mod managers (Vortex, ModOrganizer2, manual installs)
  • Custom installation paths on any drive (C:, D:, E:, etc.)
  • Standard Bannerlord directories
  • Windows user folders (Documents, AppData)
Troubleshooting:

If you encounter "NPC not found" issues:

  1. Press F10 to see diagnostics
  2. Check if AI Influence mod is found
  3. Press F11 to manually set the path if needed
  4. Enter the full path to your AI Influence save_data folder

βœ… Tip: ChatSync greatly enhances immersion by allowing NPCs to have shared memory and context, making group conversations feel natural and dynamic!

πŸ”Š Text-to-Speech (TTS) Guide

πŸŽ™οΈ Player2 TTS System

What TTS Does:

Player2's TTS system generates natural-sounding AI voices for every NPC in Bannerlord, replacing limited single-line voice acting with fully voiced dynamic conversations.

Enabling TTS:
  1. Step 1: Open Player2 and ensure the top-right corner slider is ON
  2. Step 2: In Bannerlord β†’ Mod Options β†’ AI Influence β†’ Scroll to Player2 Settings
  3. Step 3: TTS is now enabled
TTS Voice Assignment:
MALE VOICES: 01955d76-ed5b-74ba-89e5-2b4b45e632cd - Benjamin (en_US) 01955d76-ed5b-74de-83e5-800a44fee0d1 - Caleb (en_US) 01955d76-ed5b-7566-9c0e-bce4d88ceba0 - Charles (en_US) 01955d76-ed5b-748c-8d98-0fb708ef0fbd - Ethan (en_US) 01955d76-ed5b-754f-a070-a570ddfed516 - Harry (en_US) 01955d76-ed5b-74d2-a33c-b2b8e998658f - Jackson (en_US) 01955d76-ed5b-74af-a2be-9302077075b8 - Logan (en_US) 01955d76-ed5b-74c6-ac15-ab68ee19d560 - Lucas (en_US) 01955d76-ed5b-74a3-9129-c3253d01f690 - Mason (en_US) 01955d76-ed5b-74e9-9fea-1f8cad1cd9c5 - Nicholas (en_US) 01955d76-ed5b-7497-9f8e-0e7448515bf3 - Noah (en_US) 01955d76-ed5b-753f-9f74-c0674216f0f5 - Oliver (en_US) 01955d76-ed5b-755b-9b43-890d73586908 - William (en_US) FEMALE VOICES: 01955d76-ed5b-7468-83a7-bfc267cf4849 - Abigail (en_US) 01955d76-ed5b-7441-a184-5f5ee015e4fe - Amelia (en_US) 01955d76-ed5b-7534-b7a6-028adcfb4e7d - Amelia (en_US) 01955d76-ed5b-7436-a182-c4d21aaca9fc - Ava (en_US) 01955d76-ed5b-7451-92d6-5ef579d3ed28 - Charlotte (en_US) 01955d76-ed5b-7480-951c-af1dd9873e34 - Chloe (en_US) 01955d76-ed5b-74f9-b54a-2d051890468d - Eleanor (en_US) 01955d76-ed5b-745d-add1-b755d440192d - Evelyn (en_US) 01955d76-ed5b-7528-86ee-3348a642af7e - Florence (en_US) 01955d76-ed5b-7407-a03c-cdd993439ba4 - Madison (en_US) 01955d76-ed5b-7474-86b2-a41b310c2a2d - Mia (en_US) 01955d76-ed5b-7426-8748-4b0e5aea1974 - Olivia (en_US) 01955d76-ed5b-751c-b341-0ee85dbefd92 - Poppy (en_US) 01955d76-ed5b-73e0-a88d-cbeb3c5b499d - Sophia (en_US)
❓ NPCs speaking wrong language/gender?

Answer: When the game starts, random Voice IDs are assigned. Sometimes wrong gender voices or languages are assigned. This is a Player2 generation code issue that the developer is investigating.

❓ How to assign favorite voice to NPC?

Answer: Find the NPC's "AssignedTTSVoice" in their .json file, copy the ID, and paste it into another NPC's file (same gender).

βͺ Rollback AI Actions

πŸ”„ Step-by-Step Rollback Guide

Scenario:

AI does something undesirable (e.g., Raganvad spamming war declarations on his own faction).

Step 1: Preparation

Have a save from before the problematic events. If not, proceed cautiously.

Step 2: Locate Mod Files

Navigate to mod installation folder (Nexus manual download recommended):

Steam Path: Drive:\PathToSteamInstall\workshop\content\261550\3584621421
Step 3: Find Character JSON

Use the JSON editing tutorial to find the specific character file.

Warning: Multiple results may appear if you have multiple campaigns.
Step 4: Edit JSON Sections

Look for these sections in the JSON file:

  • "ConversationHistory"
  • "LastDynamicResponse"
  • "LastAIResponseJson"
Step 5: Clean ConversationHistory

Delete problematic sections from ConversationHistory. Leave it formatted with their last reply.

Step 6: Update LastDynamicResponse

Copy the last line from ConversationHistory (without quotation marks or character name) and paste into "LastDynamicResponse" inside quotation marks.

Step 7: Update LastAIResponseJSON

Repeat for "LastAIResponseJSON" - paste in correct spot inside quotes.

Step 8: Save & Reload

Save the JSON file and reload your previous save game.

πŸ“ Editing NPC .JSON Files

πŸ”§ Finding and Editing NPC Characteristics

1. What You Can Edit:
  • "AIGeneratedBackstory" - NPC's AI-generated history
  • "AIGeneratedPersonality" - NPC's personality traits
  • NPC quirks and additional information
⚠️ Always backup JSON files before editing. Only edit when game is NOT launched to avoid bugs/freezes.
2. Finding JSON Files:
  1. Open AI Influence folder
  2. Use search bar to find specific NPC (e.g., "Baroness Kalatylda (lord_4_6)")
  3. Multiple JSON files may appear (from different saves)
  4. Open the newest file with Notepad
3. Key Information Sections:
  • βœ… NPC Quirks
  • βœ… Personality
  • βœ… Backstory
  • βœ… Last Dynamic Response
4. Creating Custom Companions:

Quick Method:

  1. Recruit wanderer from inn using vanilla features
  2. Initialize them via AI (even with minimal input)
  3. Save game and exit Bannerlord
  4. Search for companion's JSON file
  5. Edit desired characteristics
  6. Boot game and talk to companion referencing your edits

πŸ‘‘ Diplomacy System Guide

βš”οΈ How AI Diplomacy Works

AI-Driven Diplomacy:
  • β€’ AI creates and reacts to world events
  • β€’ AI leaders make public statements
  • β€’ AI can declare war or propose peace
  • β€’ AI can form or break alliances

Statements affect relationships between kingdoms.

⚠️ System is still in active development. Unexpected behavior may occur during BETA testing.
Player Political Influence:

If you are a KING/QUEEN:

  • β€’ Make diplomatic statements through your governor
  • β€’ Declare war publicly
  • β€’ Offer or reject peace
  • β€’ Form or break alliances

Statements appear in BLUE on the campaign map 🌐

AI will evaluate your actions β€” not just accept them.

⚠️ Known Limitations (BETA)

NPC Initialization:

Only NPCs you have talked to are fully driven by AI. Others do not know recent events until first interaction.

Performance Constraint:

Too many initialized AI NPCs will cause lag or freezes. Recommended active limit: around 100 NPCs.

Diplomacy System (BETA):

The system is still being rewritten β€” bugs and unexpected behavior are possible. Developer actively updates based on community feedback.

βš”οΈ NPC Action System & Rules

πŸ“‹ NPC ACTION SYSTEM - REFERENCE GUIDE

What is the Action System

NPCs in AIInfluence can perform various actions: travel across the map, follow the player, attack enemies, besiege settlements, etc.

Multi-tasking actions: An NPC can perform multiple actions in sequence in one chain. For example, a player can ask an NPC to "visit city A, then city B, attack bandits and return" - and the NPC will complete all these tasks sequentially. Actions are combined with commas, creating a chain of tasks.

The actionrules.txt file allows you to add additional instructions for the AI that will be automatically added to the prompt in the "ADDITIONAL RULES FOR ACTIONS" section. This helps adjust AI behavior if it incorrectly uses actions or does something differently than you need.

All Available NPC Actions

2.1. Movement & Basic Actions

  • follow_player - NPC follows the player, accompanies them
  • go_to_settlement - NPC travels to the specified settlement (city, castle, village)
  • return_to_player - NPC returns to the player after completing a task
  • attack_party - NPC attacks the specified party (bandits, deserters, enemies)
  • patrol_settlement - NPC patrols around the specified settlement
  • wait_near_settlement - NPC waits near a settlement without entering it
  • siege_settlement - NPC besieges the specified city or castle
  • raid_village - NPC raids the specified enemy village
  • create_party - NPC creates their own party (leaves the player's party)

2.10. Multi-tasking actions (chains)

What it does: NPC can perform multiple actions in sequence in one chain

Examples of chains:

- Visit multiple settlements: "go to city A, then to city B, then return" - Complete a task and return: "attack bandits and return to me" - Combined tasks: "visit a city, then patrol it, then return"

NPCs can combine actions with commas, creating a sequence of tasks that will be completed one after another.

Dialogue Actions (decision)
  • attack - NPC decides to attack the player
  • surrender - NPC surrenders to the player
  • accept_surrender - NPC accepts the player's surrender as a prisoner
  • release - NPC releases the player peacefully (does not attack)
  • propose_marriage - NPC proposes marriage to the player
  • accept_marriage - NPC accepts the player's marriage proposal
  • reject_marriage - NPC rejects a marriage proposal
  • intimate - Intimate interaction with NPCs
Financial Actions
  • money_transfer - Money transfer between NPC and player

Important: Used only when the NPC AGREES to transfer money, not for offers or refusals.

Workshop Actions
  • workshop_action (sell) - NPC sells their workshop to the player

Important: Used only after final price agreement, not during negotiations.

Diplomatic Actions (kingdom_action)

Available only to kingdom rulers and vassals in certain situations:

  • declare_war - Declaration of war on another kingdom
  • propose_peace / accept_peace / reject_peace - Peace proposal, acceptance or rejection
  • propose_alliance / accept_alliance / reject_alliance / break_alliance - Alliance operations
  • propose_trade_agreement / accept_trade_agreement / reject_trade_agreement / end_trade_agreement - Trade agreements
  • demand_territory / transfer_territory - Demand or transfer of territory
  • demand_tribute / accept_tribute / reject_tribute - Tribute operations
  • demand_reparations / accept_reparations / reject_reparations - Reparations operations
Recruitment Actions (kingdom_action)
  • hire_mercenary - Hiring the player as a mercenary
  • dismiss_mercenary - Dismissal of the player from mercenaries
  • offer_vassalage - Offer to the player to become a vassal
  • dismiss_vassal - Release of the player from vassalage
  • join_player_clan - NPC joins the player's clan as a companion
  • join_player_kingdom - NPC's clan joins the player's kingdom
  • hire_mercenary_clan - NPC's clan accepts the player's offer to hire them as mercenaries
  • kick_from_clan - NPC accepts the player's decision to dismiss them from the clan
  • dismiss_npc_mercenary - NPC's clan accepts the player's decision to dismiss them from mercenaries
  • release_npc_vassal - NPC's clan accepts the player's decision to release them from vassalage
How to Add Custom Rules to actionrules.txt

Creating the file:

  1. Find the AIInfluence mod folder (usually in `Modules/AIInfluence/`)
  2. Create a text file named `actionrules.txt` in the root of the mod folder
  3. Add your rules to this file (in English)

Rule format:

Rules are written in English in free form. They will be automatically added to the "ADDITIONAL RULES FOR ACTIONS" section of the AI prompt.

Rules should be written as instructions for the AI, explaining:

  • When to use or NOT use certain actions
  • What checks to perform before using actions
  • How to consider NPC personality when making decisions
  • Additional restrictions or conditions

Rule writing style:

  • Use imperative form ("NPC should...", "Always verify...", "Never use...")
  • Be specific and clear
  • Specify specific actions and conditions
  • Can reference NPC personality ("Consider personality when...")
  • Can add example situations
Good rule examples: - NPC should always verify settlement information is provided in the prompt before using go_to_settlement action. If settlement details are missing, NPC should say "I don't know which settlement you mean" and NOT use the action. - NPC with high honor trait should refuse to raid friendly or neutral villages, even if player orders it. They should explain their refusal based on their principles. - NPC should never attack settlements that belong to their own kingdom or allied kingdoms, even if player suggests it.
Bad rule examples (too general):
  • NPC should be careful
  • Don't do bad things
  • Think before acting
Examples of Rules for Different Situations

Rules for information verification:

- CRITICAL: Before using any action that requires settlement or party information (go_to_settlement, attack_party, patrol_settlement, siege_settlement, raid_village, wait_near_settlement), NPC MUST verify that the necessary information is provided in the prompt. If information is missing or unknown, NPC should stay in character, express uncertainty, and NOT use the action. - NPC should never guess or invent information. Only use actions when the necessary details are clearly available in the prompt.

Rules for considering NPC personality:

- NPC with high honor trait should refuse to raid villages unless they are clearly enemy villages. They should explain their refusal based on honor and principles. - NPC with cruel trait is more likely to agree to raid villages, but should still verify the target is an enemy. - NPC with calculating trait should consider the strategic value and risks before agreeing to siege_settlement or attack_party actions.

Rules for preventing errors:

- NPC should NEVER use attack_party, siege_settlement, or raid_village actions against targets that belong to their own kingdom, allied kingdoms, or friendly factions. Always check the faction relationship before using combat actions. - NPC should verify the target settlement's faction status before using siege_settlement. If the settlement belongs to an ally or neutral faction, NPC should refuse and explain why.
Frequently Asked Questions
❓ Where is the actionrules.txt file located?

Answer: In the root of the AIInfluence mod folder (usually `Modules/AIInfluence/actionrules.txt`)

❓ Do I need to restart the game after changing actionrules.txt?

Answer: No, the file is automatically re-read on each dialogue. Just save the file.

❓ How many rules can I add?

Answer: There are no limits, but try not to make the file too large (recommended up to 100-200 lines).

❓ Do rules work for all NPCs?

Answer: Yes, rules apply to all NPCs in the game.

Conclusion

The actionrules.txt file is a powerful tool for configuring AI behavior when using actions. By adding custom rules, you can:

  • Fix problems with incorrect action usage
  • Add additional checks and restrictions
  • Improve consideration of NPC personality when making decisions
  • Customize AI behavior to your preferences
Remember:
  • Rules must be in English
  • Be specific and clear
  • Test rules in the game
  • Don't be afraid to experiment and adjust rules

πŸ”§ Technical Guide & File Structure

πŸ“ AI Influence β€” Technical Guide

File Structure
AIInfluence DEV/ β”œβ”€β”€ world.txt # World description for the AI β”œβ”€β”€ world_secrets.json # NPC secrets β”œβ”€β”€ world_info.json # General information β”œβ”€β”€ cultural_traditions.json # Romantic traditions β”‚ β”œβ”€β”€ save_data/ # Save data β”‚ └── [CAMPAIGN_ID]/ # Campaign folder β”‚ β”œβ”€β”€ NPC (id).json # Context for each NPC β”‚ β”œβ”€β”€ dynamic_events.json # Active dynamic events β”‚ β”œβ”€β”€ diplomatic_statements.json # Rulers' statements β”‚ β”œβ”€β”€ alliances.json # Kingdom alliances β”‚ β”œβ”€β”€ war_statistics.json # War statistics β”‚ β”œβ”€β”€ diplomatic_events.json # Active diplomatic events β”‚ β”œβ”€β”€ pending_player_statements.json # Pending player statements β”‚ β”œβ”€β”€ trade_agreements.json # Trade agreements β”‚ β”œβ”€β”€ territory_transfers.json # Territory transfer history β”‚ β”œβ”€β”€ tributes.json # Tribute agreements β”‚ └── reparations.json # Reparations between kingdoms β”‚ └── logs/ # Logs β”œβ”€β”€ mod_log.txt β”œβ”€β”€ diplomacy.txt └── dynamicEvents.log
🌍 world.txt

What: Calradia world description for the AI.

Why: The AI reads it on every dialogue for context.

How to edit:

  • Add your lore in the section "Additional Information About Calradia:"
  • Use `{Character}` and `{Player}` instead of specific names
  • Write in English
  • Save β†’ the file will be hot‑reloaded automatically
πŸ” world_secrets.json

What: Secret knowledge that NPCs may know.

Format:

[ { "id": "unique_id", "description": "Description for the AI", "knowledgeChance": 50, "applicableNPCs": ["lords"], "accessLevel": "high", "tags": ["optional"] } ]

How it works:

  1. On first interaction, a 0–100 roll is made
  2. If ≀ `knowledgeChance` β†’ the NPC learns the secret
  3. The secret is added to the prompt: `"Secrets: ... (access: high)"`
  4. The AI decides whether to reveal it (depends on trust)
Important: Use `knowledgeChance`, NOT `usageChance`!

Fields:

  • `id` β€” unique name
  • `description` β€” full text (passed into the AI prompt)
  • `knowledgeChance` β€” 0–100 chance that the NPC learns it on first contact
  • `applicableNPCs` β€” types: `all`, `lords`, `companions`, `faction_leaders`, `village_notables`, `merchants`
  • `accessLevel` β€” `low`, `medium`, `high` (shown in the prompt)
  • `tags` β€” for organization (does not affect logic)
πŸ“° world_info.json

What: Public, non‑secret information.

Format:

[ { "id": "unique_id", "description": "Description (you can use {character})", "usageChance": 75, "applicableNPCs": ["all"], "category": "world" } ]

Fields:

  • `usageChance` β€” 0–100 chance (works like knowledgeChance)
  • `applicableNPCs` β€” types: `all`, `lords`, `companions`, `faction_leaders`, `village_notables`, `merchants`
  • `category` β€” `world` (persistent), `event` (temporary), `personal` (personal)

Differences from secrets:

  • Field: `usageChance` vs `knowledgeChance`
  • Classification: `category` vs `accessLevel`
  • In the prompt: "General Info: ..." vs "Secrets: ... (access: high)"
πŸ’• cultural_traditions.json

What: Romantic traditions per culture.

Format:

{ "Aserai": "Description of romantic traditions...", "Battania": "..." }

Affects: Flirt style and relationship requirements.

πŸ’Ύ NPC Files: save_data/[CAMPAIGN_ID]/Name (id).json

Main fields:

Field What it does Can edit
CharacterDescription Personality description βœ… YES
KnownSecrets Known secrets βœ… YES (sets a flag)
KnownInfo Known information βœ… YES (sets a flag)
ConversationHistory Dialogue history ❌ Automatic
DynamicEvents Known events ❌ Automatic

You can also see service fields:

  • `KnownSecretsUserEdited` / `KnownInfoUserEdited` β€” flags that knowledge was edited by the user (if `true`, the system will no longer change these arrays)
  • `DynamicEvents` / `LastEventAnalysisMessageIndex` β€” which dynamic events the NPC knows and which messages were already sent for analysis
  • `AIGeneratedPersonality` / `AIGeneratedBackstory` β€” auto‑generated personality and backstory description
  • Romance fields (`RomanceLevel`, `LastRomanceInteractionDays`, `IsRomanceEligible`) and battle fields (`SettlementCombatInfo`) β€” managed only by the system
Recommendation: if you do not fully understand a service field, do not edit it β€” you may break the system.
Editing Knowledge

After changing `KnownSecrets` or `KnownInfo`:

"KnownSecrets": ["My_Custom_Secret"], "KnownSecretsUserEdited": false // ← Will automatically become true

The `UserEdited: true` flag β†’ the system will not touch this field.

Resetting flags: MCM β†’ NPC Management β†’ Reset User‑Edited Knowledge

πŸ“‹ dynamic_events.json

What: Active world events.

Important fields:

  • `type` β€” `military`, `political`, `economic`, `social`, `mysterious`
  • `importance` β€” 1–10 (how important)
  • `kingdoms_involved` β€” array of kingdom `string_id`
  • `allows_diplomatic_response` β€” whether rulers can make statements
  • `expiration_campaign_days` β€” when it expires

Additionally, events have:

  • `id` β€” unique event identifier (string, NPCs store knowledge about it in `DynamicEvents`)
  • `player_involved` β€” whether the player participated
  • `spread_speed` β€” how fast it spreads

NPC link: The list of NPCs who know about an event is stored in each `NPC (id).json` in the `DynamicEvents` array. `DynamicEventsManager` automatically updates these fields and removes expired events from NPCs.

Editing: Not recommended (managed automatically).
πŸ’¬ diplomatic_statements.json

What: Kingdom rulers' statements.

Structure:

{ "kingdom_id": "battania", "statement_text": "Statement text", "action": "None/DeclareWar/ProposePeace/...", "target_kingdom_id": "khuzait", "reason": "Reason", "event_id": "event this statement refers to" }

Storage: Last 15 statements over 50 in‑game days.

Editing: Not needed (automatic system).

Additional Diplomacy Files

All files below are in `save_data/[CAMPAIGN_ID]/` and are managed automatically by the diplomacy system.

  • `diplomatic_events.json` β€” active diplomatic events linked to dynamic events (`DynamicEvents`)
  • `pending_player_statements.json` β€” deferred player statements to be published later
  • `trade_agreements.json` β€” current trade agreements between kingdoms
  • `territory_transfers.json` β€” history of fief transfers between kingdoms
  • `tributes.json` β€” tribute payment agreements
  • `reparations.json` β€” reparations data (history and open claims)
Rule: all these files are intended for automatic system operation. Edit only if you clearly understand the consequences (for debugging); always make a backup first.
πŸ“Š Logs

`logs/mod_log.txt` β€” main log

  • Mod initialization
  • Config loading
  • AI prompts and responses
  • API errors

Check when: NPC does not respond, Secrets are not loaded, In‑game errors occur

`logs/diplomacy.txt` β€” diplomacy

  • Diplomacy system initialization
  • Creation of diplomatic situations and statements
  • Analysis of diplomatic events (full prompts and AI responses)
  • Executing actions (wars, peace, alliances, relation changes)
  • Diplomacy system errors and warnings

`logs/dynamicEvents.log` β€” dynamic events

  • Event generation (including full prompt and AI response with detailed debugging on)
  • Event propagation to NPCs (who learned what and why)
  • Deletion of expired events and cleanup of NPC knowledge
βš™οΈ Important Rules

JSON files

  • βœ… Always validate JSON (jsonlint.com)
  • βœ… Make backups before editing
  • βœ… Do not delete required fields
  • ❌ Do not edit `dynamic_events.json` and `diplomatic_statements.json` unless necessary

Secrets vs Info

  • `world_secrets.json` β†’ field `knowledgeChance`
  • `world_info.json` β†’ field `usageChance`
  • DO NOT CONFUSE THEM! Otherwise the value will be treated as 0.

Hot Reload

These files are hot‑reloaded automatically:

  • βœ… `world.txt`
  • βœ… `world_secrets.json`
  • βœ… `world_info.json`
  • βœ… `cultural_traditions.json`

NPC files are reloaded on the next interaction.

Edit Flags

If you edit `KnownSecrets` or `KnownInfo`:

  • The `UserEdited` flag automatically becomes `true`
  • The system will no longer touch these fields
  • Reset: MCM β†’ Reset User‑Edited Knowledge
🎯 Key Differences
Aspect Secrets Info
File `world_secrets.json` `world_info.json`
Chance field `knowledgeChance` `usageChance`
Classification `accessLevel` + `tags` `category`
Purpose Secrets, require trust Public information
πŸ”„ Workflow

Adding new content

  1. Come up with an idea (secret, event, quest)
  2. Add it to JSON (`world_secrets.json` or `world_info.json`)
  3. Save the file β†’ hot‑reload
  4. Create new NPCs or reset existing ones
  5. Start a dialogue β†’ the AI will know about the new content

Testing secrets

  1. Add a secret with `knowledgeChance: 100`
  2. Create a new NPC or reset an existing one
  3. Start a dialogue
  4. Check the log: `[NPC] Name learned secret: ...`
  5. Ask the NPC about the secret directly

Debugging events

  1. Enable detailed logging (MCM)
  2. Create an event (Force Generate Event)
  3. Check `logs/dynamicEvents.log`
  4. See who received the event and why