Skip to content

API Hero export_character

SolWayward edited this page Mar 4, 2026 · 1 revision

gm.hero.export_character

Endpoint: gm.hero.export_character

Syntax

gm.hero.export_character <hero> <filename>

Parameters

Parameter Type Required Position Description
hero string Yes 0 Hero name, StringId, or player
filename string Yes 1 Output filename without .json extension

Description

Exports a hero's complete character data to a single JSON character set file. The exported snapshot includes:

  • Appearance — face code, body properties, hair, beard, tattoos, body shape, height
  • Development — skills, attributes, perks, focus points, XP, level
  • Traits — all personality, persona, political, and role/skill traits
  • Battle Equipment — all battle equipment slots
  • Civilian Equipment — all civilian equipment slots

This is the most comprehensive save command, capturing everything needed to fully recreate a character. The exported file can be:

  • Loaded onto any existing hero via gm.hero.load_character
  • Used to spawn a brand new hero via gm.hero.import_character

Use gm.hero.list_characters to view all saved character set files.

Examples

Export by Partial Name

gm.hero.export_character derthert my_king

Output:

[gm.hero.export_character] hero: Derthert | filename: my_king
SUCCESS: Exported character 'Derthert' to 'my_king'.
Hero: Derthert (ID: lord_4_1), Level: 26, Age: 48
File: C:\...\BLGM\CharacterSets\my_king.json

Export Multi-Word Hero Name

gm.hero.export_character 'Ira of the Aserai' ira_backup

Using Named Arguments

gm.hero.export_character hero:derthert filename:king_export

Export Player Character

gm.hero.export_character player my_character_backup

Usage Tips

Full Character Backup:

# Create a complete backup of a hero before making any changes
gm.hero.export_character derthert derthert_complete_backup

# Later restore all character data
gm.hero.load_character derthert derthert_complete_backup

Sharing Character Templates:

# Export a well-crafted character for use in other saves
gm.hero.export_character derthert elite_lord_template

# Import as a new hero in another session
gm.hero.import_character elite_lord_template meroc lord

Verify Available Files:

gm.hero.list_characters

Error Handling

Hero Not Found:

Error: No hero found matching '{query}'.

Solution: Use gm.query.hero to verify the hero name or StringId.

Multiple Matches:

Error: Multiple heroes found matching '{query}'. Please be more specific.

Solution: Use a more specific name or the exact StringId.

Filename Empty:

Error: Filename argument cannot be empty.

Solution: Provide a valid filename as the second argument.

Related Commands

Notes

Complete Snapshot: This command captures all character data in a single file, making it the preferred method for full character backup and transfer compared to saving appearance, development, and traits separately.

File Overwrite: If a file with the same name already exists, it will be overwritten without warning. Use gm.hero.list_characters to check existing files first.

Name and Identity Not Included: The export captures visual and gameplay data. When loading via gm.hero.load_character, the target hero's name, gender, StringId, and MBGUID are preserved. When creating via gm.hero.import_character, a new hero is generated with a fresh identity.

Single Quotes Required: The TaleWorlds console requires SINGLE QUOTES (not double quotes) for multi-word arguments.

Named and Positional Arguments: Both named (hero:value) and positional arguments are supported. Named arguments use the format argName:value with no spaces around the colon.

Last Updated: 3/3/2026

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