Interface SkillProgressionΒΆ
Allows to extend or override built-in skill progression mechanics.
Usage:
local I = require('openmw.interfaces')
-- Forbid increasing destruction skill past 50
I.SkillProgression.addSkillLevelUpHandler(function(skillid, options)
if skillid == 'destruction' and types.NPC.stats.skills.destruction(self).base >= 50 then
return false
end
end)
-- Scale sneak skill progression based on active invisibility effects
I.SkillProgression.addSkillUsedHandler(function(skillid, useType, params)
if skillid == 'sneak' and useType == I.SkillProgression.SKILL_USE_TYPES.Sneak_AvoidNotice then
local activeEffects = Actor.activeEffects(self)
local visibility = activeEffects:getEffect(core.magic.EFFECT_TYPE.Chameleon).magnitude / 100
visibility = visibility + activeEffects:getEffect(core.magic.EFFECT_TYPE.Invisibility).magnitude
visibility = 1 - math.min(1, math.max(0, visibility))
local oldSkillGain = params.skillGain
params.skillGain = oldSkillGain * visibility
end
end
Type SkillProgression
| SkillProgression.SKILL_INCREASE_SOURCES | |
| SkillProgression.SKILL_USE_TYPES | |
| SkillProgression.addSkillLevelUpHandler(handler) |
Add new skill level up handler for this actor
If |
| SkillProgression.addSkillUsedHandler(handler) |
Add new skillUsed handler for this actor
If |
| SkillProgression.skillLevelUp(skillid, source) |
Trigger a skill level up, activating relevant handlers |
| SkillProgression.skillUsed(skillid, useType, scale) |
Trigger a skill use, activating relevant handlers |
| SkillProgression.version |
Interface version |
Type SkillLevelUpSource
| SkillLevelUpSource.Book |
book |
| SkillLevelUpSource.Trainer |
trainer |
| SkillLevelUpSource.Usage |
usage |
Type SkillUseType
Type SkillProgression
Field(s)
- SkillProgression.addSkillLevelUpHandler(handler)
-
Add new skill level up handler for this actor If
handler(skillid, source, options)returns false, other handlers (including the default skill level up handler) will be skipped.Where skillid and source are the parameters passed to SkillProgression#skillLevelUp, and options is a modifiable table of skill level up values, and can be modified to change the behavior of later handlers. These values are calculated based on vanilla mechanics. Setting any value to nil will cause that mechanic to be skipped. By default contains these values:
skillIncreaseValue- The numeric amount of skill levels gained.levelUpProgress- The numeric amount of level up progress gained.levelUpAttribute- The string identifying the attribute that should receive points from this skill level up.levelUpAttributeIncreaseValue- The numeric amount of attribute increase points received. This contributes to the amount of each attribute the character receives during a vanilla level up.levelUpSpecialization- The string identifying the specialization that should receive points from this skill level up.levelUpSpecializationIncreaseValue- The numeric amount of specialization increase points received. This contributes to the icon displayed at the level up screen during a vanilla level up.
Parameter
-
#function handler: The handler.
- SkillProgression.addSkillUsedHandler(handler)
-
Add new skillUsed handler for this actor If
handler(skillid, useType, options)returns false, other handlers (including the default skill progress handler) will be skipped.Where skillid and useType are the parameters passed to SkillProgression#skillUsed, and options is a modifiable table of skill progression values, and can be modified to change the behavior of later handlers. By default contains the single value:
skillGain- The numeric amount of skill progress gained, normalized to the range 0 to 1, where 1 is a full level.
Parameter
-
#function handler: The handler.
- SkillProgression.skillLevelUp(skillid, source)
-
Trigger a skill level up, activating relevant handlers
Parameters
-
#string skillid: The id of the skill to level up. -
#SkillLevelUpSource source: The source of the skill increase.
-
- SkillProgression.skillUsed(skillid, useType, scale)
-
Trigger a skill use, activating relevant handlers
Parameters
-
#string skillid: The if of the skill that was used -
#SkillUseType useType: A number from 0 to 3 (inclusive) representing the way the skill was used, with each use type having a different skill progression rate. Available use types and its effect is skill specific. See SkillProgression#skillUseType -
#number scale: A number that linearly scales the skill progress received from this use. Defaults to 1.
-
- #number SkillProgression.version
-
Interface version
Type SkillLevelUpSource
Table of valid sources for skill increases
Field(s)
- #string SkillLevelUpSource.Book
-
book
- #string SkillLevelUpSource.Trainer
-
trainer
- #string SkillLevelUpSource.Usage
-
usage
Type SkillUseType
Table of skill use types defined by morrowind.
Each entry corresponds to an index into the available skill gain values of a openmw.types#SkillRecord
Field(s)
- #number SkillUseType.Acrobatics_Fall
-
1
- #number SkillUseType.Acrobatics_Jump
-
0
- #number SkillUseType.Alchemy_CreatePotion
-
0
- #number SkillUseType.Alchemy_UseIngredient
-
1
- #number SkillUseType.Armor_HitByOpponent
-
0
- #number SkillUseType.Armorer_Repair
-
0
- #number SkillUseType.Athletics_RunOneSecond
-
0
- #number SkillUseType.Athletics_SwimOneSecond
-
0
- #number SkillUseType.Block_Success
-
0
- #number SkillUseType.Enchant_CastOnStrike
-
3
- #number SkillUseType.Enchant_CreateMagicItem
-
2
- #number SkillUseType.Enchant_Recharge
-
0
- #number SkillUseType.Enchant_UseMagicItem
-
1
- #number SkillUseType.Mercantile_Bribe
-
1
- #number SkillUseType.Mercantile_Success
-
0
- #number SkillUseType.Security_DisarmTrap
-
0
- #number SkillUseType.Security_PickLock
-
1
- #number SkillUseType.Sneak_AvoidNotice
-
0
- #number SkillUseType.Sneak_PickPocket
-
1
- #number SkillUseType.Speechcraft_Fail
-
1
- #number SkillUseType.Speechcraft_Success
-
0
- #number SkillUseType.Spellcast_Success
-
0
- #number SkillUseType.Weapon_SuccessfulHit
-
0