Skip to content

API Query Troop character_objects

SolWayward edited this page Dec 22, 2025 · 2 revisions

gm.query.character_objects

Endpoint: gm.query.character_objects

Syntax

gm.query.character_objects [search_terms...] [sort:field[:order]]

Description

Unfiltered query that lists all CharacterObjects in the game, including troops, heroes, lords, NPCs, and other characters. Unlike gm.query.troop, this command does NOT automatically filter out non-combat characters, making it useful for advanced debugging and comprehensive game data inspection.

Parameters

Parameter Type Required Description
search_terms string No Text to match against character name or ID
sort:field[:order] string No Sort results (see Sorting Options below)

Sorting Options

  • sort:id - Sort by StringId (default)
  • sort:name - Sort alphabetically by name
  • sort:tier - Sort by tier level
  • sort:level - Sort by character level
  • sort:culture - Sort by culture name
  • sort:occupation - Sort by occupation type

Add :desc for descending order or :asc for ascending (default)

Examples

List all characters:

gm.query.character_objects

Search by name:

gm.query.character_objects imperial
gm.query.character_objects merchant
gm.query.character_objects wanderer

Sort all characters:

gm.query.character_objects sort:name
gm.query.character_objects sort:level:desc
gm.query.character_objects sort:culture

Output

Success:

Found N character(s) matching [criteria]:
[StringId]    [Name]    [Occupation]    Tier: [Tier]    Level: [Level]    Culture: [Culture]

NOTE: Output will include ALL character types including heroes, lords, NPCs, troops, and special characters.

What This Command Shows

Unlike the filtered troop queries, this command shows:

  • All military troops (all tiers)
  • Heroes and lords
  • Town NPCs (merchants, blacksmiths, tavernkeepers, etc.)
  • Wanderers and companions
  • Children and teenagers
  • Templates and test characters
  • Training dummies and practice targets
  • Non-combat villagers and townsfolk
  • Caravan leaders and merchants
  • Notables and special characters
  • Cutscene characters
  • Any other CharacterObject in the game

Notes

NOTE: This is an unfiltered query primarily intended for debugging and advanced game data inspection.

TIP: For standard troop queries, use gm.query.troop which automatically filters to military units only.

TIP: For hero and lord queries, use gm.query.hero which provides hero-specific information.

WARNING: This command can return a very large number of results. Consider using search terms to narrow results.

Use Cases

Debugging:

  • Inspect all game characters for mod development
  • Find template or test characters
  • Verify character data integrity

Advanced Queries:

  • Find specific NPC types by occupation
  • Locate special characters for scripting
  • Comprehensive game data analysis

Not Recommended For:

Related Commands

Last Updated: 2025-12-16

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