Skip to content

API Troop Overview

SolWayward edited this page Dec 27, 2025 · 5 revisions

[TROOP] Troop Management Commands

Category: Troop Management Commands: 7 commands API Version: 1.3.13.1 Status: STABLE


Overview

Troop management commands provide control over military units in Mount & Blade II: Bannerlord. These commands enable you to add troops (nameless soldiers) to hero parties, upgrade existing troops to higher tiers, grant experience points for troop progression, and manage army composition. Build powerful armies, reinforce companions, or strengthen allied lords for military campaigns.

Troops are CharacterObjects representing nameless military units such as infantry, archers, cavalry, and specialized units. Unlike heroes, troops exist as quantities rather than individual characters. The troop management system allows you to rapidly assemble armies of specific unit types, create balanced force compositions, upgrade troops through their progression trees, and test military scenarios without the time investment of traditional recruitment and training.

All troop commands require campaign mode to be active. Heroes must have valid parties to receive troops, and standard party size limits still apply. Troops are added immediately to party rosters, ready for deployment in battles and sieges.


Command Reference

Quick Reference Table

Command Description Category Status
gm.troops.give_hero_troops Add specific troops to hero party Distribution STABLE
gm.troops.add_basic Add basic tier troops from leader's culture Bulk Addition STABLE
gm.troops.add_elite Add elite tier troops from leader's culture Bulk Addition STABLE
gm.troops.add_mercenary Add random mercenary troops Bulk Addition STABLE
gm.troops.add_mixed Add mixed tier troops (basic, elite, mercenary) Bulk Addition STABLE
gm.troops.upgrade_troops Upgrade all troops to specified tier with ratio control Troop Progression STABLE
gm.troops.give_xp Add experience points to all troops in party Troop Progression STABLE

Command Categories

Troop Distribution

Commands for distributing specific military units to hero parties.

gm.troops.give_hero_troops - Adds a specified number of troops to a hero's party. This is the primary method for adding specific troop types. Supports any troop type (infantry, archers, cavalry, etc.) and can add up to 10,000 troops per command. The hero must have a party, and the troop cannot be a hero character (only regular units). Works for any hero in a party, not just party leaders.

Bulk Troop Addition

Commands for quickly adding culture-based troops to party leaders. These commands only work for heroes who are party leaders.

gm.troops.add_basic - Adds basic tier troops from the party leader's culture. The troop type is automatically determined by the leader's culture (e.g., Vlandian Recruits, Imperial Recruits). Quick way to build entry-level armies without specifying exact troop IDs.

gm.troops.add_elite - Adds elite tier troops from the party leader's culture. Provides high-tier units based on the culture's elite troop pool. Useful for creating powerful armies quickly without looking up specific elite unit names.

gm.troops.add_mercenary - Adds random mercenary troops from the party leader's culture. Troops are randomly selected from the culture's mercenary pool, providing variety and specialized units.

gm.troops.add_mixed - Adds mixed tier troops (basic, elite, and mercenary) in equal proportions. The count parameter specifies how many of EACH type to add, resulting in 3x total troops. Perfect for creating balanced, diverse armies quickly.

Troop Progression

Commands for upgrading existing troops and managing their experience. These commands only work for party leaders.

gm.troops.upgrade_troops - Upgrades all troops in the party to a specified tier (default tier 7) while maintaining desired unit type ratios. Intelligently upgrades troops through their upgrade trees, respecting maximum tier limits for each troop type. Allows customization of infantry, ranged, and cavalry ratios to create specialized army compositions.

gm.troops.give_xp - Adds experience points to all troops in the party. Provides rapid troop progression without requiring combat. Troops gain XP and can naturally level up and become eligible for upgrades. Essential for quickly preparing armies for battle or testing different troop progression scenarios.


Common Parameters

Troop Query

The troop query parameter accepts:

  • StringId - Exact troop identifier (e.g., imperial_recruit, battanian_fian_champion)
  • Partial Name - Substring match in troop name (e.g., imperial, fian, knight)
  • Searches all CharacterObjects representing troops

Hero Query

The hero query parameter accepts:

  • StringId - Exact hero identifier (e.g., lord_1_1, wanderer_empire_1)
  • Partial Name - Substring match in hero name
  • Special Keywords - player for the player character

Count

  • Range: 1 to 10,000 troops per command
  • Type: Integer
  • Troops are added immediately to party roster

Usage Examples

Example 1: Quick Army Building with Culture Troops

Create a balanced force using culture-based commands:

gm.troops.add_mixed player 20

Result: Player receives 60 troops (20 basic + 20 elite + 20 mercenary) from their culture.

Example 2: Building a Starting Army

Create a basic balanced force for the player:

gm.troops.give_hero_troops player imperial_recruit 50
gm.troops.give_hero_troops player battanian_tribesman 50
gm.troops.give_hero_troops player aserai_recruit 30

Result: Player receives 130 recruits from multiple cultures for diverse army composition.

Example 3: Elite Force Assembly

Build a powerful army quickly:

gm.troops.add_elite player 50

Result: Player receives 50 elite troops from their culture.

Or build with specific high-tier troops:

gm.troops.give_hero_troops player imperial_legionary 30
gm.troops.give_hero_troops player battanian_fian_champion 20
gm.troops.give_hero_troops player vlandian_knight 15
gm.troops.give_hero_troops player imperial_elite_cataphract 10

Result: Player has an elite 75-troop force with specialized high-tier units.

Example 4: Reinforcing Allied Lords

Strengthen allied party leaders:

gm.troops.add_basic derthert 100
gm.troops.add_elite derthert 30

Result: Derthert receives 100 basic and 30 elite Vlandian troops.

Example 5: Companion Reinforcement

Give troops to companions in your party (note: companions are usually not party leaders):

gm.troops.give_hero_troops companion_name imperial_infantry 25
gm.troops.give_hero_troops companion_name empire_horseman 10

Result: Companion receives 35 troops for independent operations.

Example 6: Balanced Army Composition

Create a tactically balanced force:

gm.troops.give_hero_troops player imperial_legionary 40
gm.troops.give_hero_troops player imperial_archer 30
gm.troops.give_hero_troops player imperial_cavalry 20
gm.troops.give_hero_troops player imperial_cataphract 10

Result: 100-troop army with 40% infantry, 30% archers, 30% cavalry.

Example 7: Rapid Army Upgrade and Experience

Upgrade existing troops to battle-ready status:

gm.troops.give_xp player 2000
gm.troops.upgrade_troops player 6

Result: All troops gain 2000 XP and are upgraded to tier 6, creating an elite fighting force.

Example 8: Custom Army Composition via Upgrade Ratios

Create a specialized cavalry-focused army:

gm.troops.upgrade_troops player 7 0.3 0.2 0.5

Result: Army upgraded to tier 7 with 30% infantry, 20% ranged, 50% cavalry - perfect for mobile warfare.

Example 9: Progressive Troop Training

Natural progression from recruits to veterans:

gm.troops.give_hero_troops player imperial_recruit 100
gm.troops.give_xp player 1000
gm.troops.upgrade_troops player 4

Result: Start with 100 recruits, give them combat experience, upgrade to tier 4 - simulating campaign progression.


Best Practices

TIP: Use Troop Query Commands First

Before adding troops, use query commands to find exact troop identifiers:

gm.query.troop imperial tier3
gm.query.troop battanian ranged tier4
gm.query.troop cavalry tier5 sort:level:desc

This ensures you're adding the correct troop type and helps discover available units.

TIP: Consider Upgrade Paths

When building armies, consider troop upgrade trees:

  • Add lower-tier troops for natural progression
  • Add high-tier troops for immediate power
  • Mix tiers for balanced costs and effectiveness

TIP: Party Size Limits

Remember that party size limits still apply:

  • Check hero's party size capacity before adding troops
  • Commands may fail if party is at maximum capacity
  • Clan tier affects maximum party size

TIP: Unit Type Balance

Create effective armies with balanced composition:

  • 40-50% Infantry (frontline, shield wall)
  • 30-40% Archers (ranged support)
  • 20-30% Cavalry (flanking, pursuit)

Adjust ratios based on tactical preferences and terrain.

TIP: Troop Progression Strategy

Combine XP and upgrade commands for optimal army development:

  • Use gm.troops.give_xp to prepare troops for upgrades
  • Then use gm.troops.upgrade_troops to execute upgrades with desired ratios
  • Start with lower tiers for cost-effective progression
  • Jump to high tiers when immediate power is needed

TIP: Cultural Troop Considerations

Different cultures have specialized strengths:

  • Imperial - Balanced units, strong heavy infantry
  • Vlandia - Excellent heavy cavalry
  • Sturgia - Superior infantry
  • Aserai - Fast cavalry, mobile archers
  • Khuzait - Mounted archers, horse archers
  • Battania - Elite archers (Fian Champions)

Notes & Warnings

WARNING: Hero Must Have a Party

Heroes must belong to a party to receive troops:

  • Wanderers without parties cannot receive troops
  • Imprisoned heroes typically lack parties
  • Dead heroes cannot receive troops

Use hero query commands to verify party status first.

WARNING: Cannot Add Hero Characters

The command only accepts regular troop CharacterObjects:

  • Heroes (lords, companions, wanderers) cannot be added as troops
  • Named characters must be recruited through normal game mechanics
  • Attempting to add heroes generates an error

NOTE: Non-Leader Heroes

If a hero is not their party's leader (e.g., companion in player party):

  • Troops are still added successfully
  • Troops go to the party the hero belongs to
  • Party leader retains command of all troops
  • This is normal behavior for party members

NOTE: Immediate Addition

Troops are added to the party roster immediately:

  • No recruitment time required
  • No morale impact from instant addition
  • Troops are ready for immediate deployment
  • Party wages increase based on troop count and tier

NOTE: Troop Tier Impact

Higher-tier troops provide:

  • Better combat performance
  • Higher wages (increased costs)
  • Better equipment
  • Superior stats and abilities

Balance cost vs. effectiveness based on your needs.


Related Documentation

Command Groups

Query Commands

For finding specific troops before adding:

  • gm.query.troop - Search troops by name, culture, tier
  • gm.query.troop <name> <filters> - Filter by tier, equipment type
  • gm.query.troop <culture> <tier> sort:level:desc - Sorted results

Reference Materials

User Guides


Last Updated: 2025-12-27 API Version: 1.3.13.1

Return to API Reference | Home

Quick Links

🏠 Home | Quick Reference | Syntax Guide


Hero Commands
Clan Commands
Kingdom Commands
Settlement Commands
Item Commands
Troop Commands
Caravan Commands
Bandit Commands
Query Commands

Clone this wiki locally