Skip to content

API Hero load_traits

SolWayward edited this page Mar 4, 2026 · 1 revision

gm.hero.load_traits

Endpoint: gm.hero.load_traits

Syntax

gm.hero.load_traits <hero> <filename>

Parameters

Parameter Type Required Position Description
hero string Yes 0 Hero name, StringId, or player
filename string Yes 1 Name of the save file (without .json extension)

Description

Loads all of a hero's traits from a previously saved JSON file and applies them to the target hero. The loaded data includes personality traits (Mercy, Valor, Honor, Generosity, Calculating), persona traits, political traits, role/skill traits, and any other traits captured in the file.

Traits not found in the current game session — for example, traits added by a mod that is no longer active — are skipped gracefully without causing errors.

Use gm.hero.list_traits to see all available saved files, and gm.hero.save_traits to create them.

Examples

Load by Partial Name

gm.hero.load_traits derthert derthert_personality

Output:

[gm.hero.load_traits] hero: Derthert | filename: derthert_personality.json
SUCCESS: Loaded traits onto Derthert from derthert_personality.json

Load Multi-Word Hero Name

gm.hero.load_traits 'Ira of the Aserai' honorable_warrior

Using Named Arguments

gm.hero.load_traits hero:derthert filename:king_traits

Load onto Player

gm.hero.load_traits player my_personality

Usage Tips

Standard Trait Transfer Workflow:

# 1. Check what trait files are available
gm.hero.list_traits

# 2. Load the desired traits onto your target hero
gm.hero.load_traits derthert noble_warrior_traits

Applying a Personality to Multiple Heroes:

# Save once from a hero with the desired personality
gm.hero.save_traits derthert noble_personality

# Apply to multiple heroes
gm.hero.load_traits 'Ira of the Aserai' noble_personality
gm.hero.load_traits meroc noble_personality

Error Handling

Hero Not Found:

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

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

File Not Found:

Error: Trait file not found: '{filename}.json'

Solution: Use gm.hero.list_traits to see available files.

Filename Empty:

Error: Filename cannot be empty.

Solution: Provide a valid filename as the second argument.

Related Commands

Notes

Graceful Mod Compatibility: Trait IDs from the saved file that are not recognized in the current game (e.g., removed mod traits) are silently skipped. Only traits that exist in the current session are applied.

All Trait Types Applied: Personality, persona, political, and role/skill traits are all loaded from the file.

Immediate Effect: Trait changes take effect immediately without requiring a save/reload.

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