Actor
Part of openmw.types
Usage:
local Actor = require('openmw.types').Actor
Type types
| types.Actor |
Common #Actor functions for Creature, NPC, and Player. |
Type Actor
| Actor.EQUIPMENT_SLOT |
Available #EQUIPMENT_SLOT values. |
| Actor.STANCE | |
| Actor.activeEffects(actor) |
Return the active magic effects (#ActorActiveEffects) currently affecting the given actor. |
| Actor.activeSpells(actor) |
Return the active spells (#ActorActiveSpells) currently affecting the given actor. |
| Actor.canMove(object) |
Returns true if the object is an actor and is able to move. |
| Actor.getCurrentSpeed(actor) |
Current speed. |
| Actor.getEquipment(actor, slot) |
Get equipment. |
| Actor.getPathfindingAgentBounds(actor) |
Agent bounds to be used for pathfinding functions. |
| Actor.getRunSpeed(actor) |
Speed of running. |
| Actor.getSelectedEnchantedItem(actor) |
Get currently selected enchanted item |
| Actor.getSelectedSpell(actor) |
Get currently selected spell |
| Actor.getStance(actor) |
Returns the current stance (whether a weapon/spell is readied), see the list of #STANCE values. |
| Actor.getWalkSpeed(actor) |
Speed of walking. |
| Actor.hasEquipped(actor, item) |
Returns |
| Actor.inventory(actor) |
Actor inventory. |
| Actor.isOnGround(actor) |
Is the actor standing on ground. |
| Actor.isSwimming(actor) |
Is the actor in water. |
| Actor.objectIsInstance(object) |
Whether the object is an actor. |
| Actor.setEquipment(actor, equipment) |
Set equipment. |
| Actor.setSelectedEnchantedItem(actor, item) |
Set currently selected enchanted item, equipping it if applicable |
| Actor.setSelectedSpell(actor, spell) |
Set selected spell |
| Actor.setStance(actor, stance) |
Sets the current stance (whether a weapon/spell is readied), see the list of #STANCE values. |
| Actor.spells(actor) |
Return the spells (#ActorSpells) of the given actor. |
| Actor.stats |
The actor's stats. |
Type ActorActiveEffects
| ActorActiveEffects:getEffect(effectId, extraParam) |
Get a specific active effect on the actor. |
| ActorActiveEffects:modify(value, effectId, extraParam) |
Permanently modifies the magnitude of an active effect by increasing it by the provided value. |
| ActorActiveEffects:remove(effectId, extraParam) |
Completely removes the active effect from the actor. |
| ActorActiveEffects:set(value, effectId, extraParam) |
Permanently modifies the magnitude of an active effect to be exactly equal to the provided value. |
Type ActorActiveSpells
| ActorActiveSpells:isSpellActive(spellOrId) |
Get whether a specific spell is active on the actor. |
| ActorActiveSpells:remove(spellOrId) |
Remove the given spell and all its effects from the given actor's active spells. |
Type ActorSpells
| ActorSpells:add(spellOrId) |
Add spell (only in global scripts or on self). |
| ActorSpells:clear() |
Remove all spells (only in global scripts or on self). |
| ActorSpells:remove(spellOrId) |
Remove spell (only in global scripts or on self). |
Type ActorStats
| ActorStats.attributes | |
| ActorStats.dynamic | |
| ActorStats.level(actor) |
Level (returns #LevelStat) |
Type AttributeStat
| AttributeStat.base |
The actor's base attribute value. |
| AttributeStat.damage |
The amount the attribute has been damaged. |
| AttributeStat.modified |
The actor's current attribute value (read-only.) |
| AttributeStat.modifier |
The attribute's modifier. |
Type AttributeStats
| AttributeStats.agility(actor) |
Agility (returns #AttributeStat) |
| AttributeStats.endurance(actor) |
Endurance (returns #AttributeStat) |
| AttributeStats.intelligence(actor) |
Intelligence (returns #AttributeStat) |
| AttributeStats.luck(actor) |
Luck (returns #AttributeStat) |
| AttributeStats.personality(actor) |
Personality (returns #AttributeStat) |
| AttributeStats.speed(actor) |
Speed (returns #AttributeStat) |
| AttributeStats.strength(actor) |
Strength (returns #AttributeStat) |
| AttributeStats.willpower(actor) |
Willpower (returns #AttributeStat) |
Type DynamicStat
| DynamicStat.base | |
| DynamicStat.current | |
| DynamicStat.modifier |
Type DynamicStats
| DynamicStats.fatigue(actor) |
Fatigue (returns #DynamicStat) |
| DynamicStats.health(actor) |
Health (returns #DynamicStat) |
| DynamicStats.magicka(actor) |
Magicka (returns #DynamicStat) |
Type EQUIPMENT_SLOT
Type LevelStat
| LevelStat.current |
The actor's current level. |
| LevelStat.progress |
The NPC's level progress (read-only.) |
Type STANCE
| STANCE.Nothing |
Default stance |
| STANCE.Spell |
Magic stance |
| STANCE.Weapon |
Weapon stance |
Type SkillStat
| SkillStat.base |
The NPC's base skill value. |
| SkillStat.damage |
The amount the skill has been damaged. |
| SkillStat.modified |
The NPC's current skill value (read-only.) |
| SkillStat.modifier |
The skill's modifier. |
| SkillStat.progress |
[0-1] The NPC's skill progress. |
Type SkillStats
Type types
Field(s)
- #Actor types.Actor
-
Common #Actor functions for Creature, NPC, and Player.
Type Actor
Common functions for Creature, NPC, and Player.
Field(s)
- #EQUIPMENT_SLOT Actor.EQUIPMENT_SLOT
-
Available #EQUIPMENT_SLOT values.
Used in
Actor.equipment(obj)andActor.setEquipment(obj, eqp).
- Actor.activeEffects(actor)
-
Return the active magic effects (#ActorActiveEffects) currently affecting the given actor.
Parameter
-
openmw.core#GameObject actor:
Return value
-
- Actor.activeSpells(actor)
-
Return the active spells (#ActorActiveSpells) currently affecting the given actor.
Parameter
-
openmw.core#GameObject actor:
Return value
-
- Actor.canMove(object)
-
Returns true if the object is an actor and is able to move.
For dead, paralyzed, or knocked down actors it returns false.
Parameter
-
openmw.core#GameObject object:
Return value
#boolean:
-
- Actor.getCurrentSpeed(actor)
-
Current speed.
Parameter
-
openmw.core#GameObject actor:
Return value
#number:
-
- Actor.getEquipment(actor, slot)
-
Get equipment.
Has two overloads: 1) With a single argument: returns a table
slot-> openmw.core#GameObject of currently equipped items. See #EQUIPMENT_SLOT. Returns empty table if the actor doesn't have equipment slots. 2) With two arguments: returns an item equipped to the given slot.Parameters
-
openmw.core#GameObject actor: -
#number slot: Optional number of the equipment slot
Return value
-
- Actor.getPathfindingAgentBounds(actor)
-
Agent bounds to be used for pathfinding functions.
Parameter
-
openmw.core#GameObject actor:
Return value
#table: with
shapeTypeandhalfExtents -
- Actor.getRunSpeed(actor)
-
Speed of running.
For dead actors it still returns a positive value.
Parameter
-
openmw.core#GameObject actor:
Return value
#number:
-
- Actor.getSelectedEnchantedItem(actor)
-
Get currently selected enchanted item
Parameter
-
openmw.core#GameObject actor:
Return value
openmw.core#GameObject, nil enchanted item or nil
-
- Actor.getSelectedSpell(actor)
-
Get currently selected spell
Parameter
-
openmw.core#GameObject actor:
Return value
openmw.core#Spell, nil
-
- Actor.getStance(actor)
-
Returns the current stance (whether a weapon/spell is readied), see the list of #STANCE values.
Parameter
-
openmw.core#GameObject actor:
Return value
#number:
-
- Actor.getWalkSpeed(actor)
-
Speed of walking.
For dead actors it still returns a positive value.
Parameter
-
openmw.core#GameObject actor:
Return value
#number:
-
- Actor.hasEquipped(actor, item)
-
Returns
trueif the item is equipped on the actor.Parameters
-
openmw.core#GameObject actor: -
openmw.core#GameObject item:
Return value
#boolean:
-
- Actor.inventory(actor)
-
Actor inventory.
Parameter
-
openmw.core#GameObject actor:
Return value
-
- Actor.isOnGround(actor)
-
Is the actor standing on ground.
Can be called only from a local script.
Parameter
-
openmw.core#GameObject actor:
Return value
#boolean:
-
- Actor.isSwimming(actor)
-
Is the actor in water.
Can be called only from a local script.
Parameter
-
openmw.core#GameObject actor:
Return value
#boolean:
-
- Actor.objectIsInstance(object)
-
Whether the object is an actor.
Parameter
-
openmw.core#GameObject object:
Return value
#boolean:
-
- Actor.setEquipment(actor, equipment)
-
Set equipment.
Keys in the table are equipment slots (see #EQUIPMENT_SLOT). Each value can be either a
GameObjector recordId. Raises an error if the actor doesn't have equipment slots and table is not empty. Can be used only in local scripts and only on self.Parameters
-
openmw.core#GameObject actor: -
#EquipmentTable equipment:
Usage:
local self = require('openmw.self') local Actor = require('openmw.types').Actor Actor.setEquipment(self, {}) -- unequip all -
- Actor.setSelectedEnchantedItem(actor, item)
-
Set currently selected enchanted item, equipping it if applicable
Parameters
-
openmw.core#GameObject actor: -
openmw.core#GameObject item: enchanted item
-
- Actor.setSelectedSpell(actor, spell)
-
Set selected spell
Parameters
-
openmw.core#GameObject actor: -
openmw.core#Spell spell: Spell (can be nil)
-
- Actor.setStance(actor, stance)
-
Sets the current stance (whether a weapon/spell is readied), see the list of #STANCE values.
Can be used only in local scripts on self.
Parameters
-
openmw.core#GameObject actor: -
#number stance:
-
- Actor.spells(actor)
-
Return the spells (#ActorSpells) of the given actor.
Parameter
-
openmw.core#GameObject actor:
Return value
-
- #ActorStats Actor.stats
-
The actor's stats.
Type ActorActiveEffects
Read-only list of effects currently affecting the actor.
Usages:
-- print active effects for _, effect in pairs(Actor.activeEffects(self)) do print('Active Effect: '..effect.id..', attribute='..tostring(effect.affectedAttribute)..', skill='..tostring(effect.affectedSkill)..', magnitude='..tostring(effect.magnitude)) end-- Check for a specific effect local effect = Actor.activeEffects(self):getEffect(core.magic.EFFECT_TYPE.Telekinesis) if effect then print(effect.id..', attribute='..tostring(effect.affectedAttribute)..', skill='..tostring(effect.affectedSkill)..', magnitude='..tostring(effect.magnitude)) else print('No Telekinesis effect') end-- Check for a specific effect targeting a specific attribute. local effect = Actor.activeEffects(self):getEffect(core.magic.EFFECT_TYPE.FortifyAttribute, core.ATTRIBUTE.Luck) if effect then print(effect.id..', attribute='..tostring(effect.affectedAttribute)..', skill='..tostring(effect.affectedSkill)..', magnitude='..tostring(effect.magnitude)) else print('No Fortify Luck effect') end
Field(s)
- ActorActiveEffects:getEffect(effectId, extraParam)
-
Get a specific active effect on the actor.
Parameters
-
#string effectId: effect ID -
#string extraParam: Optional skill or attribute ID
Return value
openmw.core#ActiveEffect: if such an effect is active, nil otherwise
-
- ActorActiveEffects:modify(value, effectId, extraParam)
-
Permanently modifies the magnitude of an active effect by increasing it by the provided value.
This adds the effect to the list of active effects if not already active.
Parameters
-
#number value: -
#string effectId: effect ID -
#string extraParam: Optional skill or attribute ID
-
- ActorActiveEffects:remove(effectId, extraParam)
-
Completely removes the active effect from the actor.
This removes both the effects incurred by active spells and effect added by console, mwscript, or luascript.
Parameters
-
#string effectId: effect ID -
#string extraParam: Optional skill or attribute ID
-
- ActorActiveEffects:set(value, effectId, extraParam)
-
Permanently modifies the magnitude of an active effect to be exactly equal to the provided value.
This adds the effect to the list of active effects if not already active. Note that although the modification is permanent, the magnitude will not stay equal to the value if any active spells with this effects are added/removed.
Parameters
-
#number value: -
#string effectId: effect ID -
#string extraParam: Optional skill or attribute ID
-
Type ActorActiveSpells
Read-only list of spells currently affecting the actor.
Usages:
-- print active spells for _, spell in pairs(Actor.activeSpells(self)) do print('Active Spell: '..tostring(spell)) end-- Check for a specific spell if Actor.activeSpells(self):isSpellActive('bound longbow') then print('Player has bound longbow') else print('Player does not have bound longbow') end
Field(s)
- ActorActiveSpells:isSpellActive(spellOrId)
-
Get whether a specific spell is active on the actor.
Parameter
-
#any spellOrId: openmw.core#Spell or string spell id
Return value
true if spell is active, false otherwise
-
- ActorActiveSpells:remove(spellOrId)
-
Remove the given spell and all its effects from the given actor's active spells.
Parameter
-
#any spellOrId: openmw.core#Spell or string spell id
-
Type ActorSpells
List of spells with additional functions add/remove/clear (modification are allowed only in global scripts or on self).
Usages:
-- print available spells local mySpells = types.Actor.spells(self) for _, spell in pairs(mySpells) do print(spell.id) end-- print available spells (equivalent) local mySpells = types.Actor.spells(self) for i = 1, #mySpells do print(mySpells[i].id) end-- add ALL spells that exist in the world local mySpells = types.Actor.spells(self) for _, spell in pairs(core.magic.spells) do if spell.type == core.magic.SPELL_TYPE.Spell then mySpells:add(spell) end end-- add specific spell types.Actor.spells(self):add('thunder fist')-- check specific spell local mySpells = types.Actor.spells(self) if mySpells['thunder fist'] then print('I have thunder fist') end
Field(s)
- ActorSpells:add(spellOrId)
-
Add spell (only in global scripts or on self).
Parameter
-
#any spellOrId: openmw.core#Spell or string spell id
-
- ActorSpells:clear()
-
Remove all spells (only in global scripts or on self).
- ActorSpells:remove(spellOrId)
-
Remove spell (only in global scripts or on self).
Parameter
-
#any spellOrId: openmw.core#Spell or string spell id
-
Type ActorStats
Field(s)
- ActorStats.level(actor)
-
Level (returns #LevelStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
Type AttributeStat
Field(s)
- #number AttributeStat.base
-
The actor's base attribute value.
- #number AttributeStat.damage
-
The amount the attribute has been damaged.
- #number AttributeStat.modified
-
The actor's current attribute value (read-only.)
- #number AttributeStat.modifier
-
The attribute's modifier.
Type AttributeStats
Field(s)
- AttributeStats.agility(actor)
-
Agility (returns #AttributeStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- AttributeStats.endurance(actor)
-
Endurance (returns #AttributeStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- AttributeStats.intelligence(actor)
-
Intelligence (returns #AttributeStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- AttributeStats.luck(actor)
-
Luck (returns #AttributeStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- AttributeStats.personality(actor)
-
Personality (returns #AttributeStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- AttributeStats.speed(actor)
-
Speed (returns #AttributeStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- AttributeStats.strength(actor)
-
Strength (returns #AttributeStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- AttributeStats.willpower(actor)
-
Willpower (returns #AttributeStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
Type DynamicStat
Field(s)
- #number DynamicStat.base
- #number DynamicStat.current
- #number DynamicStat.modifier
Type DynamicStats
Field(s)
- DynamicStats.fatigue(actor)
-
Fatigue (returns #DynamicStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- DynamicStats.health(actor)
-
Health (returns #DynamicStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- DynamicStats.magicka(actor)
-
Magicka (returns #DynamicStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
Type EQUIPMENT_SLOT
Field(s)
- #number EQUIPMENT_SLOT.Ammunition
- #number EQUIPMENT_SLOT.Amulet
- #number EQUIPMENT_SLOT.Belt
- #number EQUIPMENT_SLOT.Boots
- #number EQUIPMENT_SLOT.CarriedLeft
- #number EQUIPMENT_SLOT.CarriedRight
- #number EQUIPMENT_SLOT.Cuirass
- #number EQUIPMENT_SLOT.Greaves
- #number EQUIPMENT_SLOT.Helmet
- #number EQUIPMENT_SLOT.LeftGauntlet
- #number EQUIPMENT_SLOT.LeftPauldron
- #number EQUIPMENT_SLOT.LeftRing
- #number EQUIPMENT_SLOT.Pants
- #number EQUIPMENT_SLOT.RightGauntlet
- #number EQUIPMENT_SLOT.RightPauldron
- #number EQUIPMENT_SLOT.RightRing
- #number EQUIPMENT_SLOT.Robe
- #number EQUIPMENT_SLOT.Shirt
- #number EQUIPMENT_SLOT.Skirt
Type EquipmentTable
Map from values of #EQUIPMENT_SLOT to items openmw.core#GameObjects
EquipmentTable is a map of #number to openmw.core#GameObject.
Type LevelStat
Field(s)
- #number LevelStat.current
-
The actor's current level.
- #number LevelStat.progress
-
The NPC's level progress (read-only.)
Type STANCE
Field(s)
- #number STANCE.Nothing
-
Default stance
- #number STANCE.Spell
-
Magic stance
- #number STANCE.Weapon
-
Weapon stance
Type SkillStat
Field(s)
- #number SkillStat.base
-
The NPC's base skill value.
- #number SkillStat.damage
-
The amount the skill has been damaged.
- #number SkillStat.modified
-
The NPC's current skill value (read-only.)
- #number SkillStat.modifier
-
The skill's modifier.
- #number SkillStat.progress
-
[0-1] The NPC's skill progress.
Type SkillStats
Field(s)
- SkillStats.acrobatics(actor)
-
Acrobatics (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.alchemy(actor)
-
Alchemy (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.alteration(actor)
-
Alteration (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.armorer(actor)
-
Armorer (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.athletics(actor)
-
Athletics (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.axe(actor)
-
Axe (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.block(actor)
-
Block (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.bluntweapon(actor)
-
Blunt Weapon (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.conjuration(actor)
-
Conjuration (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.destruction(actor)
-
Destruction (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.enchant(actor)
-
Enchant (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.handtohand(actor)
-
Hand To Hand (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.heavyarmor(actor)
-
Heavy Armor (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.illusion(actor)
-
Illusion (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.lightarmor(actor)
-
Light Armor (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.longblade(actor)
-
Long Blade (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.marksman(actor)
-
Marksman (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.mediumarmor(actor)
-
Medium Armor (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.mercantile(actor)
-
Mercantile (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.mysticism(actor)
-
Mysticism (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.restoration(actor)
-
Restoration (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.security(actor)
-
Security (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.shortblade(actor)
-
Short Blade (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.sneak(actor)
-
Sneak (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.spear(actor)
-
Spear (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.speechcraft(actor)
-
Speechcraft (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-
- SkillStats.unarmored(actor)
-
Unarmored (returns #SkillStat)
Parameter
-
openmw.core#GameObject actor:
Return value
-