SkillBase class
Part of Character Stats
Definition of a skill: its name, description and icon, the ID of the attribute it relies
on (attribute, its key stat), its highest rank (max) and the hidden flag.
A file in a plugin's skills folder fills in a SkillBase through the SKILL global;
Skills.register supplies the defaults of the missing fields.
The rank of a skill goes from 0 to max, and a character starts every skill at rank 0.
The level of the key stat is added to every roll of the skill, and the character sheet
lists the skill under it.
A skill can name its ranks. ranks is a map of rank IDs to the phrases that describe what
that rank of the skill means, rank_order lists the rank IDs from rank 0 upwards, and
rank_names optionally maps a rank ID to the phrase of its name, which is
skill.rank.<id> otherwise. The default rank_order goes from 'untrained' through
'trained', 'expert' and 'master' to 'legendary', which fits a skill with a max of 4.
-- skills/sh_athletics.lua
SKILL.name = 'skill.athletics.title'
SKILL.description = 'skill.athletics.description'
SKILL.icon = 'fa-person-running'
SKILL.attribute = 'strength'
SKILL.max = 4
SKILL.ranks = {
untrained = 'skill.athletics.untrained',
trained = 'skill.athletics.trained',
expert = 'skill.athletics.expert',
master = 'skill.athletics.master',
legendary = 'skill.athletics.legendary'
}
Summary
Methods
ranks.rank_order at the position of the rank counted from 0.Methods
Returns the phrase that describes a rank of this skill, taken from ranks.
Parameters
- rank Number
Returns
- String phrase, or nil if the skill does not describe that rank
See also
Returns the ID of the named rank that a rank of this skill falls on: the entry of
rank_order at the position of the rank counted from 0. A rank beyond either end of the
list takes the first or the last entry.
Parameters
- rank Number
Returns
- String rank ID, or nil if the skill does not name its ranks or
rankshas no entry for that rank
Returns the phrase that names a rank of this skill, such as 'skill.rank.expert'.
Parameters
- rank Number
Returns
- String phrase, or nil if the skill does not name that rank
See also
Creates a skill definition. Fill in its fields and call register to make it available.
local skill = SkillBase.new('lockpicking')
skill.name = 'skill.lockpicking.title'
skill.description = 'skill.lockpicking.description'
skill.attribute = 'reflexes'
skill:register()
Parameters
- id String unique skill ID; nothing is set when it is not a string
Registers this skill definition under its skill ID.