Morwen's Class Tree System
Class Tree System[edit]
The Class Tree System enables dynamic class assignment and evolution path initialization for player characters. It copies class properties, optionally includes abilities, and sets up nested evolution records with all relevant properties except abilities.
Configuration[edit]
Definition[edit]
- Name: Class Config
- Type: YAML
- Initial Value: see configuration example below
- Visibility: Hidden from Player and AI
Structure[edit]
The class tree uses a YAML configuration with this hierarchy:
- Top-Level Settings
-
- includeAbilities
- : Boolean - Include abilities when copying class properties
- Class Definitions
Each entry in the classes map requires:
- label - Display name (string)
- rank - Class tier (number, typically 0 for base classes)
- grade - Rarity classification (string: common, rare, epic, etc.)
- description - Flavor text (string)
- abilities - Array of special abilities (optional)
- requirements - Array of unlock conditions (optional)
- evolutions - Array of class names this class can evolve into
Configuration Example[edit]
includeAbilities: true
classes:
warrior:
label: Warrior
rank: 0
grade: common
description: basic warrior class
abilities:
- 'Second wind'
evolutions: [swordman, spearman]
swordman:
label: Swordman
rank: 1
grade: common
description: warrior focused on sword fighting
abilities:
- 'Fast Cut: an extremely fast sword strike'
requirements:
- trained intensely with the sword
- level at least 10
evolutions: [knight, blade_master]
spearman:
label: Spearman
rank: 1
grade: common
description: warrior specialized in polearm combat
abilities:
- 'Piercing Thrust: a powerful lunging attack'
requirements:
- trained with spears or polearms
- level at least 10
evolutions: [lancer, pike_master]
knight:
label: Knight
rank: 2
grade: rare
description: heavily armored warrior with balanced offense and defense
abilities:
- 'Shield Bash: stun enemies with a shield strike'
- 'Holy Strike: a blessed attack that deals extra damage to undead'
requirements:
- completed the Trial of Valor
- level at least 25
evolutions: []
blade_master:
label: Blade Master
rank: 2
grade: rare
description: master of swordsmanship with lightning-fast reflexes
abilities:
- 'Whirlwind Slash: strike all nearby enemies'
- 'Precision Cut: a critical hit that ignores some armor'
requirements:
- defeated the Blade Phantom in single combat
- level at least 25
evolutions: []
lancer:
label: Lancer
rank: 2
grade: rare
description: elite spearman with exceptional reach and mobility
abilities:
- 'Skewer: impale multiple enemies in a line'
- 'Leaping Strike: jump and strike from a distance'
requirements:
- survived the Gauntlet of Spears
- level at least 25
evolutions: []
pike_master:
label: Pike Master
rank: 2
grade: rare
description: master of long polearms, excelling in formation combat
abilities:
- 'Pike Wall: create a defensive barrier with your pike'
- 'Sweep: knock down multiple enemies in a wide arc'
requirements:
- led a pike square in battle
- level at least 25
evolutions: []
acolyte:
label: Acolyte
rank: 0
grade: common
description: basic magical class
evolutions: [mage, cleric]
mage:
label: Mage
rank: 1
grade: common
description: spellcaster focused on elemental magic
abilities:
- 'Firebolt: a basic fire attack'
requirements:
- studied ancient tomes
- level at least 10
evolutions: [sorcerer, archmage]
cleric:
label: Cleric
rank: 1
grade: common
description: holy spellcaster with healing and support abilities
abilities:
- 'Minor Heal: restore a small amount of health'
requirements:
- performed a sacred ritual
- level at least 10
evolutions: [priest, high_priest]
sorcerer:
label: Sorcerer
rank: 2
grade: rare
description: powerful spellcaster with destructive magic
abilities:
- 'Chain Lightning: strike multiple enemies with electricity'
- 'Meteor Swarm: call down fiery destruction from the sky'
requirements:
- mastered the Arcane Circle
- level at least 25
evolutions: []
archmage:
label: Archmage
rank: 2
grade: epic
description: master of all schools of magic
abilities:
- 'Arcane Shield: create a magical barrier'
- 'Spell Reflection: reflect spells back at the caster'
requirements:
- passed the Test of the Archmage
- level at least 30
evolutions: []
priest:
label: Priest
rank: 2
grade: rare
description: holy warrior with strong healing and support abilities
abilities:
- 'Greater Heal: restore a large amount of health'
- 'Holy Ward: protect allies from dark magic'
requirements:
- performed a miracle
- level at least 25
evolutions: []
high_priest:
label: High Priest
rank: 2
grade: epic
description: divine representative with the power to bless and smite
abilities:
- 'Resurrection: bring an ally back to life'
- 'Divine Judgment: call down holy retribution'
requirements:
- received the Blessing of the Divine
- level at least 30
evolutions: []
Tracked Item Setup[edit]
Create a tracked item to store the class configuration:
- Name: Class Config
- Type: YAML
- Initial Value: see configuration example above
- Visibility: Hidden from Player and AI
- Description: Class definitions and evolution paths for character progression
Create a second tracked item for the player's current class:
- Name: Player Class
- Type: YAML
- Initial Value: empty
- Visibility: Visible to at least AI, Player optional
- Description: Current class properties and available evolutions for the player
Create a third tracked item for the player's new class that starts the recalculation:
- Name: New Player Class
- Type: Text
- Initial Value: empty
- Visibility: Visible to at least AI, Player optional
- Description: Key-Value of the new class
- Update Instructions: depending on your world
Player Class Entry Fields[edit]
Each assigned class contains:
- label - Display name of the class
- rank - Current tier (0 for base classes)
- grade - Rarity classification
- description - Flavor text
- abilities - Array of special abilities (if includeAbilities is true)
- evolution - Map of available evolution paths with their properties (excluding abilities)
Example Generated Player Class[edit]
label: Warrior
rank: 0
grade: common
description: basic warrior class
abilities:
- Second wind
evolution:
swordman:
label: Swordman
rank: 1
grade: common
description: warrior focused on sword fighting
requirements:
- trained intensely with the sword
- level at least 10
spearman:
label: Spearman
rank: 1
grade: common
description: warrior specialized in polearm combat
requirements:
- trained with spears or polearms
- level at least 10
Usage in Game[edit]
Check current class:
<<$player_class.label>>
List available evolutions:
<<$player_class.evolution.keys()>>
Access a specific evolution's requirements:
<<$player_class.evolution.swordman.requirements>>
Check if player has evolution available:
<<$player_class.evolution.contains("swordman")>>
Script Implementation[edit]
# Class Assignment Script
# Assigns a new class to $player_class from $class_config
# Copies all properties except abilities and evolutions by default
# Optionally includes abilities if includeAbilities is true
# Sets up evolution records with all properties except abilities
if $class_config.classes.contains($new_player_class)
set $new_class = $class_config.classes.item($new_player_class).all()
set $evolution_list = list($new_class.evolutions).flatten()
$player_class.all().remove()
for each $key in $new_class.keys()
if $key != 'abilities' and $key != 'evolutions'
$player_class.item($key) = $new_class.item($key)
else if ($class_config.includeAbilities = true and $key = 'abilities' )
$player_class.item($key) = $new_class.item($key)
for each $evol in $evolution_list
if try($class_config.classes.item($evol).keys().count() > 0, false)
set $rec = record()
for each $evokey in $class_config.classes.item($evol).keys()
if $evokey != 'abilities'
$rec.item($evokey) = $class_config.classes.item($evol).item($evokey)
$player_class.evolution.item($evol) = $rec
$new_player_class = ''