-
Notifications
You must be signed in to change notification settings - Fork 0
API Query Overview
Category: Query & Search Commands: 25 commands API Version: 1.3.11.2 Status: STABLE
Query commands provide powerful search and filtering capabilities for discovering game entities in Mount & Blade II: Bannerlord. These commands enable you to search for heroes, clans, kingdoms, troops, items, and item modifiers using flexible text search, type-based filtering, and advanced sorting options.
The query system is the foundation for effective use of GameMaster commands. Before modifying game entities with management commands, query commands help you identify exact StringIds, verify entity states, and explore available options. The system supports both AND logic (all criteria must match) and OR logic (any criteria matches), providing precise control over search results.
All query commands work in campaign mode and provide detailed information without modifying game state. They are safe to use for exploration and entity discovery, making them essential tools for both new users and experienced mod developers.
| Command | Description | Category | Status |
|---|---|---|---|
| gm.query.hero | Search heroes (AND logic) | Hero Queries | STABLE |
| gm.query.hero_any | Search heroes (OR logic) | Hero Queries | STABLE |
| gm.query.hero_info | Get detailed hero information | Hero Queries | STABLE |
| gm.query.clan | Search clans (AND logic) | Clan Queries | STABLE |
| gm.query.clan_any | Search clans (OR logic) | Clan Queries | STABLE |
| gm.query.clan_info | Get detailed clan information | Clan Queries | STABLE |
| gm.query.kingdom | Search kingdoms (AND logic) | Kingdom Queries | STABLE |
| gm.query.kingdom_any | Search kingdoms (OR logic) | Kingdom Queries | STABLE |
| gm.query.kingdom_info | Get detailed kingdom information | Kingdom Queries | STABLE |
| gm.query.settlement | Search settlements (AND logic) | Settlement Queries | STABLE |
| gm.query.settlement_any | Search settlements (OR logic) | Settlement Queries | STABLE |
| gm.query.settlement_info | Get detailed settlement information | Settlement Queries | STABLE |
| gm.query.troop | Search troops by filters | Troop Queries | STABLE |
| gm.query.troop_any | Find specific troop | Troop Queries | STABLE |
| gm.query.troop_info | Get troop details | Troop Queries | STABLE |
| gm.query.character_objects | Search character objects (AND logic) | Character Queries | STABLE |
| gm.query.character_objects_any | Search character objects (OR logic) | Character Queries | STABLE |
| gm.query.character_objects_info | Get character object details | Character Queries | STABLE |
| gm.query.item | Search items by filters | Item Queries | STABLE |
| gm.query.item_any | Find specific item | Item Queries | STABLE |
| gm.query.item_info | Get item details | Item Queries | STABLE |
| gm.query.modifiers | List item modifiers | Modifier Queries | STABLE |
| gm.query.modifier_info | Get modifier details | Modifier Queries | STABLE |
| gm.query.culture | Search cultures | Culture Queries | STABLE |
| gm.query.culture_info | Get culture details | Culture Queries | STABLE |
Commands for searching and discovering heroes with flexible filtering.
gm.query.hero - Search heroes using AND logic where all specified criteria must match. Supports text search (names, IDs) and type filters (lord, wanderer, notable, merchant, child, female, male, clanleader, kingdomruler, alive, dead, prisoner, etc.). Includes sorting by various fields.
gm.query.hero_any - Search heroes using OR logic where matching any specified criteria returns results. Useful for broader searches across multiple hero types simultaneously.
gm.query.hero_info - Get comprehensive detailed information about a specific hero by StringId, including clan, kingdom, age, status, and all applicable type flags.
Commands for searching and discovering clans with type-based filtering.
gm.query.clan - Search clans using AND logic. Supports text search and type filters (active, eliminated, bandit, nonbandit, noble, minor, rebel, mercenary, mafia, outlaw, nomad, sect, withoutkingdom, empty, player). Includes sorting by tier, gold, renown, etc.
gm.query.clan_any - Search clans using OR logic for broader matching across multiple clan types.
gm.query.clan_info - Get detailed clan information including leader, kingdom, member counts, financial status, tier, renown, and all type classifications.
Commands for searching kingdoms and analyzing political structures.
gm.query.kingdom - Search kingdoms using AND logic. Supports type filters (active, eliminated, empty, player, atwar) and sorting by various metrics (clans, heroes, fiefs, strength).
gm.query.kingdom_any - Search kingdoms using OR logic for flexible matching.
gm.query.kingdom_info - Get comprehensive kingdom details including ruler, ruling clan, clan count, military strength, fiefs, diplomatic relations, and war status.
Commands for searching military units and troop types.
gm.query.troop - Search troops with filtering by culture, tier, equipment type, and name. Essential for finding exact troop identifiers before using troop management commands.
gm.query.troop_find - Find a specific troop by name or identifier with partial matching support.
gm.query.troop_details - Get detailed information about a troop including stats, equipment, tier, culture, and upgrade paths.
Commands for searching items and equipment.
gm.query.item - Search items with filtering by category, tier, type, and name. Supports sorting by various attributes. Essential for finding exact item identifiers.
gm.query.item_find - Find specific items by name with partial matching.
gm.query.item_details - Get detailed item information including stats, value, weight, tier, and type classifications.
gm.query.item_categories - List all available item categories for filtering purposes.
Commands for querying quality modifiers and their effects.
gm.query.modifiers - List all available item quality modifiers (Fine, Masterwork, Legendary, etc.) with their stat effects and descriptions.
gm.query.modifier_details - Get detailed information about a specific modifier including exact stat bonuses and applicability.
Text search parameters look for matches in:
- Names - Entity names (hero names, clan names, etc.)
- StringIds - Exact game identifiers
- Related Entities - Clan names for heroes, kingdom names for clans
Hero Types:
- lord, wanderer, notable, merchant, child
- female, male
- clanleader, kingdomruler, partyleader
- alive, dead, prisoner, fugitive
- withoutclan, withoutkingdom, married
Clan Types:
- active, eliminated
- bandit, nonbandit, noble, minor
- rebel, mercenary, mafia, outlaw, nomad, sect
- withoutkingdom, empty, player
Kingdom Types:
- active, eliminated
- empty, player, atwar
Format: sort:field or sort:field:desc
Common Sort Fields:
- id, name
- age, gold, renown
- clan, kingdom
- tier, level, strength
- Type flags (e.g., sort:wanderer, sort:lord)
Locate exact hero StringIds before executing management commands:
gm.query.hero raganvad
gm.query.hero_info lord_1_1
gm.hero.set_gold lord_1_1 50000
Result: Verified hero identity, retrieved details, executed management command safely.
Find specific hero types with multiple criteria:
gm.query.hero empire lord female
gm.query.hero_any lord wanderer
gm.query.hero dead kingdomruler
Result: Filtered results showing only heroes matching all criteria (AND) or any criteria (OR).
Analyze clan strength and resources:
gm.query.clan sort:gold:desc
gm.query.clan noble sort:renown:desc
gm.query.clan_info clan_empire_south_1
Result: Sorted clan lists showing wealthiest and most prestigious clans, detailed clan information.
Find specific troop types for army building:
gm.query.troop imperial tier3
gm.query.troop battanian ranged tier4
gm.query.troop cavalry tier5 sort:level:desc
Result: Filtered troop lists showing specific unit types by culture, tier, and equipment.
Locate items before adding to inventory:
gm.query.item sword tier4
gm.query.item armor empire tier5
gm.query.item_categories
gm.item.add imperial_sword 5 player
Result: Found exact item identifiers, verified availability, executed add command.
Use query commands before executing management operations:
gm.query.hero target_name
gm.hero.set_gold target_stringid 10000
This ensures you're targeting the correct entity and reduces errors from ambiguous partial matches.
Detailed info commands provide comprehensive state verification:
gm.query.hero_info lord_1_1
gm.query.clan_info clan_empire_south_1
gm.query.kingdom_info empire
Confirms current state before making changes.
Sort results to identify patterns and extremes:
gm.query.clan sort:gold:desc
gm.query.hero sort:age
gm.query.kingdom sort:strength:desc
Reveals richest clans, oldest heroes, most powerful kingdoms.
Mix search terms with type keywords for precise results:
gm.query.hero battania female clanleader
gm.query.clan empire noble sort:tier:desc
Narrows results to very specific criteria.
When unsure of exact criteria, use OR logic:
gm.query.hero_any lord wanderer notable
gm.query.clan_any mercenary rebel outlaw
Casts wider net for entity discovery.
Understanding search logic is critical:
-
AND Logic (
gm.query.hero) - ALL criteria must match -
OR Logic (
gm.query.hero_any) - ANY criteria matches
Example:
-
gm.query.hero empire lord female- Must be Empire AND lord AND female -
gm.query.hero_any lord wanderer- Can be lord OR wanderer
Some queries have default filtering:
-
Hero queries - Default to living heroes (use
deadkeyword for deceased) -
Clan queries - Default to active clans (use
eliminatedfor destroyed) -
Kingdom queries - Default to active kingdoms (use
eliminatedfor destroyed)
Text search supports partial matches:
- "rag" matches "Raganvad"
- "empire" matches "Southern Empire", "Northern Empire"
- "bat" matches "Battania", "Battanian"
Be specific to avoid unintended matches.
For commands that modify game state, always use exact StringIds obtained from query results rather than partial names to ensure precision.
Sorting large result sets (100+ entities) may take slightly longer. Use filters to narrow results before sorting when possible.
Query commands are read-only and never modify game state. They are completely safe to use for exploration and experimentation.
- Hero Management Commands - Manage heroes found via queries
- Clan Management Commands - Manage clans found via queries
- Kingdom Management Commands - Manage kingdoms found via queries
- Troop Management Commands - Add troops found via queries
- Item Management Commands - Add items found via queries
- Cultures Reference - Cultural classifications used in queries
- Traits Reference - Hero traits and characteristics
- Skills Reference - Hero skills
- Item Types Reference - Item categories and classifications
- Item Modifiers Reference - Quality modifier details
- Factions Reference - Political factions
- Query Syntax Guide - Comprehensive query system guide
- Quick Start Guide - Getting started with GameMaster
- Best Practices - Recommended usage patterns
- Troubleshooting - Common issues and solutions
Last Updated: 2025-12-16 API Version: 1.3.11.2
🏠 Home | Quick Reference | Syntax Guide
Hero Commands
- gm.hero.abort_pregnancy
- gm.hero.add_gold
- gm.hero.add_hero_to_party
- gm.hero.create_companions
- gm.hero.create_lord
- gm.hero.create_party
- gm.hero.divorce
- gm.hero.edit_appearance
- gm.hero.edit_party
- gm.hero.equip_hero
- gm.hero.export_character
- gm.hero.generate_lords
- gm.hero.give_birth
- gm.hero.heal
- gm.hero.import_character
- gm.hero.impregnate
- gm.hero.imprison
- gm.hero.kill
- gm.hero.list_appearances
- gm.hero.list_characters
- gm.hero.list_developments
- gm.hero.list_traits
- gm.hero.load_appearance
- gm.hero.load_character
- gm.hero.load_development
- gm.hero.load_traits
- gm.hero.marry
- gm.hero.open_inventory
- gm.hero.release
- gm.hero.remove_clan
- gm.hero.rename
- gm.hero.save_appearance
- gm.hero.save_development
- gm.hero.save_traits
- gm.hero.set_age
- gm.hero.set_clan
- gm.hero.set_culture
- gm.hero.set_gold
- gm.hero.set_relation
- gm.hero.start_convrsation
Clan Commands
- gm.clan.add_gold
- gm.clan.add_gold_leader
- gm.clan.add_hero
- gm.clan.add_renown
- gm.clan.create_clan
- gm.clan.create_minor_clan
- gm.clan.destroy
- gm.clan.edit_banner
- gm.clan.equip_heroes
- gm.clan.generate_clans
- gm.clan.give_gold
- gm.clan.rename
- gm.clan.set_culture
- gm.clan.set_gold
- gm.clan.set_leader
- gm.clan.set_renown
- gm.clan.set_tier
- gm.clan.sync_kingdom_colors
Kingdom Commands
- gm.kingdom.add_clan
- gm.kingdom.call_ally_to_war
- gm.kingdom.create_kingdom
- gm.kingdom.declare_alliance
- gm.kingdom.declare_war
- gm.kingdom.destroy
- gm.kingdom.edit_banner
- gm.kingdom.equip_heroes
- gm.kingdom.generate_kingdoms
- gm.kingdom.get_tribute_info
- gm.kingdom.make_peace
- gm.kingdom.pay_tribute
- gm.kingdom.remove_clan
- gm.kingdom.rename
- gm.kingdom.set_ruler
- gm.kingdom.sync_vassal_banners
- gm.kingdom.trade_agreement
Settlement Commands
- gm.settlement.add_militia
- gm.settlement.fill_garrison
- gm.settlement.give_food
- gm.settlement.give_gold
- gm.settlement.rename
- gm.settlement.reset_names
- gm.settlement.set_culture
- gm.settlement.set_hearths
- gm.settlement.set_loyalty
- gm.settlement.set_prosperity
- gm.settlement.set_security
- gm.settlement.set_village_bound_settlement
- gm.settlement.set_village_trade_bound_settlement
- gm.settlement.spawn_wanderer
- gm.settlement.upgrade_buildings
Item Commands
- gm.item.add
- gm.item.equip
- gm.item.equip_slot
- gm.item.list_equipped
- gm.item.list_inventory
- gm.item.load_equipment
- gm.item.load_equipment_both
- gm.item.load_equipment_civilian
- gm.item.remove
- gm.item.remove_all
- gm.item.remove_equipped
- gm.item.remove_equipped_modifier
- gm.item.save_equipment
- gm.item.save_equipment_both
- gm.item.save_equipment_civilian
- gm.item.set_equipped_modifier
- gm.item.set_inventory_modifier
- gm.item.transfer
- gm.item.unequip
- gm.item.unequip_all
- gm.item.unequip_slot
Query Commands
- gm.query.character_objects
- gm.query.character_objects_any
- gm.query.character_objects_info
- gm.query.clan
- gm.query.clan_any
- gm.query.clan_info
- gm.query.culture
- gm.query.culture_info
- gm.query.hero
- gm.query.hero_any
- gm.query.hero_info
- gm.query.item
- gm.query.item_any
- gm.query.item_info
- gm.query.kingdom
- gm.query.kingdom_any
- gm.query.kingdom_info
- gm.query.modifier_info
- gm.query.modifiers
- gm.query.settlement
- gm.query.settlement_any
- gm.query.settlement_info
- gm.query.troop
- gm.query.troop_any
- gm.query.troop_info