Skip to content

ProficiencyDefinition ​

Inherits: DatabaseResource < Resource

A skill a player gets better at by using it, or is trained in: swords, heavy armor, fire magic, lockpicking.

Description ​

A proficiency has a level from 0 to max_level. Its experience comes from use (hitting with a weapon of a class or type, being hit in armor of a class, using an ability of a school), from rewards and from scripts. It has stat effects of its own: the level is the "points" they are worked out from (a Linear formula of 0.5 is "half a percent per level"), and by default they only work while the player uses what the proficiency is for (holds the weapon, wears the armor). It can also gate the equipment it is linked to: items of its weapon classes, weapon types and armor classes need a level to be equipped. A requirement can ask for a level (RequirementProficiency) and a reward can give experience or levels (ProficiencyReward). The levels belong to the player and are saved with it (ProficiencyTracker). See docs/systems/entity-stats.md, sections 29 and 31.

Properties ​

ColorcolorColor.WHITE
intmax_level100
intstarting_level0
CalculationFormulaexperience_formula
Array[int]weapon_classes[]
Array[int]weapon_types[]
Array[int]armor_classes[]
Array[int]schools[]
Array[SkillTier]tiers[]
Array[SkillSpecialization]specializations[]
boolis_languagefalse
PackedStringArraysyllablesPackedStringArray()
floatexperience_per_use1.0
floatminimum_seconds_between_gains0.0
intlevel_needed_to_equip0
Array[StatEffect]stat_effects[]
booleffects_need_matching_equipmenttrue

Methods ​

floatexperience_to_next_level( level: int )
StatDefinitionget_virtual_stat()
booluses_equipment()
boolis_for_weapon( weapon_class_id: int, weapon_type_id: int )
boolis_trained_by_armor_class( armor_class_id: int )
boolis_trained_by_school( school_id: int )
boolis_trained_by_weapon_type( weapon_type_id: int )
Array[Requirement]requirements_for_item( item: ItemDefinition ) static
Array[Dictionary]validate()

Constants ​

  • int VIRTUAL_STAT_BASE = StatDefinition.VIRTUAL_ID_BASE - The ids of the stat that carries the effects of a proficiency start here (the id of the proficiency is added), so they never meet the ids of stats

Property descriptions ​

Color color = Color.WHITE ​

The color that stands for this in the interface

Levels

int max_level = 100 ​

The highest level

int starting_level = 0 ​

The level a new player starts at

CalculationFormula experience_formula ​

Experience needed to go from level n to level n+1, from the level n. Empty = 10 x (n + 1)

What it is for

Array[int] weapon_classes = [] ​

Weapon classes (Sword, Dagger, Bow ...): hitting with one trains the proficiency, it gates them, and its effects work while one is held (WeaponClassDefinition ids)

Array[int] weapon_types = [] ​

Weapon types (One Hand, Two Hand, Ranged ...): the same, for whole types of weapon (WeaponTypeDefinition ids)

Array[int] armor_classes = [] ​

Armor classes (Plate, Mail, Leather ...): being hit in one trains the proficiency, it gates them, and its effects work while one is worn (ArmorClassDefinition ids)

Array[int] schools = [] ​

Schools (Arcane, Divine ...): using an ability of one trains the proficiency (SchoolTypeDefinition ids)

Tiers and specializations

Array[SkillTier] tiers = [] ​

The steps of the proficiency (Apprentice, Journeyman, Master). A character is in one tier at a time and its level cannot go above the cap of the tier until a trainer, a quest or an event trains the next one. Empty = no caps: the level goes up to the highest level

Array[SkillSpecialization] specializations = [] ​

The choices inside the proficiency (a branch to master). A character chooses with a trainer, a quest or an event

Language

bool is_language = false ​

This proficiency is a language of the game world (Common, Orcish). The level is how much of it the character understands: the share of the words of a line that stay readable is the level divided by the highest level; the rest is garbled. A character gains experience in it by hearing it

PackedStringArray syllables = PackedStringArray() ​

The syllables the garbled words of the language are made of (empty = a default list)

Gaining experience

float experience_per_use = 1.0 ​

The experience of one use

float minimum_seconds_between_gains = 0.0 ​

Uses closer together than this give nothing (seconds, 0 = every use counts): a training dummy cannot be farmed with a thousand taps

Requirements

int level_needed_to_equip = 0 ​

The level the player needs to equip the weapons and armor this proficiency is for (0 = no level needed: anyone can equip them). A player who does not have the level cannot wear the item, so give the starting level to the classes that start trained (a ProficiencyReward in their level 1 rewards)

Effects

Array[StatEffect] stat_effects = [] ​

What the level does. These are stat effects like the ones of a stat, and the level of the proficiency is their points: a Calculation Modifier with a Linear formula of 0.5 makes the hits half a percent stronger for every level

bool effects_need_matching_equipment = true ​

The effects only work while the player uses what the proficiency is for: holds a weapon of its classes or types, or wears a piece of its armor classes. Off: they always work. A proficiency with no weapon or armor (a school, lockpicking) always works either way

Method descriptions ​

float experience_to_next_level( level: int ) ​

Experience needed to go from level to the next one

StatDefinition get_virtual_stat() ​

The stat that carries the effects of this proficiency: a hidden stat with the effects of the proficiency (the same array) that the entities get like any other stat. Its points are the level of the proficiency (see ProficiencyTracker)

bool uses_equipment() ​

Is this proficiency tied to weapons or armor (so its effects can wait for them)?

bool is_for_weapon( weapon_class_id: int, weapon_type_id: int ) ​

Does a weapon of this class and type train the proficiency, gate on it, and make its effects work?

bool is_trained_by_armor_class( armor_class_id: int ) ​

Does equipment of this armor class?

bool is_trained_by_school( school_id: int ) ​

Does an ability of this school train the proficiency?

bool is_trained_by_weapon_type( weapon_type_id: int ) ​

Does a weapon of this type train the proficiency? (kept for scripts that only know the type)

Array[Requirement] requirements_for_item( item: ItemDefinition ) ​

The requirements the proficiencies put on an item: for every proficiency that gates the weapon class, weapon type or armor class of the item, a RequirementProficiency for its level. Items that are not equipment have none

Array[Dictionary] validate() ​

Checks the proficiency. Gives the problems found (empty when it is fine).