Package openmw.coreΒΆ

openmw.core defines functions and types that are available in both local and global scripts.

Usage:

local core = require('openmw.core')

Type core

core.API_REVISION

The revision of OpenMW Lua API.

core.ATTRIBUTE

Possible #ATTRIBUTE values

core.SKILL

Possible #SKILL values

core.getGMST(setting)

Get a GMST setting from content files.

core.getGameTime()

Game time in seconds.

core.getGameTimeScale()

The scale of game time relative to simulation time.

core.getRealTime()

Real time in seconds; starting point is not fixed (can be time since last reboot), use only for measuring intervals.

core.getSimulationTime()

Simulation time in seconds.

core.getSimulationTimeScale()

The scale of simulation time relative to real time.

core.isWorldPaused()

Whether the world is paused (onUpdate doesn't work when the world is paused).

core.l10n(context, fallbackLocale)

Return l10n formatting function for the given context.

core.magic

#Magic: spells and spell effects

core.quit()

Terminates the game and quits to the OS.

core.sendGlobalEvent(eventName, eventData)

Send an event to global scripts.

Type ATTRIBUTE

ATTRIBUTE.Agility

"agility"

ATTRIBUTE.Endurance

"endurance"

ATTRIBUTE.Intelligence

"intelligence"

ATTRIBUTE.Luck

"luck"

ATTRIBUTE.Personality

"personality"

ATTRIBUTE.Speed

"speed"

ATTRIBUTE.Strength

"strength"

ATTRIBUTE.Willpower

"willpower"

Type ActiveEffect

ActiveEffect.affectedAttribute

#ATTRIBUTE or nil

ActiveEffect.affectedSkill

#SKILL or nil

ActiveEffect.id

Effect id string

ActiveEffect.magnitude
ActiveEffect.magnitudeBase
ActiveEffect.magnitudeModifier
ActiveEffect.name

Localized name of the effect

Type Cell

Cell:getAll(type)

Get all objects of given type from the cell.

Cell.gridX

Index of the cell by X (only for exteriors).

Cell.gridY

Index of the cell by Y (only for exteriors).

Cell.hasSky

True if in this cell sky should be rendered.

Cell:hasTag(tag)

Returns true if the cell has given tag.

Cell.hasWater

True if the cell contains water.

Cell.isExterior

Whether the cell is an exterior cell. "Exterior" means grid of cells where the player can seamless walk from one cell to another without teleports. QuasiExterior (interior with sky) is not an exterior.

Cell:isInSameSpace(object)

Returns true either if the cell contains the object or if the cell is an exterior and the object is also in an exterior.

Cell.isQuasiExterior

(DEPRECATED, use hasTag("QuasiExterior")) Whether the cell is a quasi exterior (like interior but with the sky and the wheather).

Cell.name

Name of the cell (can be empty string).

Cell.region

Region of the cell.

Cell.worldSpaceId

Id of the world space.

Type GameObject

GameObject:activateBy(actor)

Activate the object.

GameObject:addScript(scriptPath, initData)

Add new local script to the object.

GameObject.cell

The cell where the object currently is. During loading a game and for objects in an inventory or a container cell is nil.

GameObject.count

Count (>1 means a stack of objects).

GameObject.enabled

Whether the object is enabled or disabled. Global scripts can set the value. Items in containers or inventories can't be disabled.

GameObject:getBoundingBox()

The axis aligned bounding box in local coordinates.

GameObject:hasScript(scriptPath)

Whether a script with given path is attached to this object.

GameObject.id

A unique id of this object (not record id), can be used as a key in a table.

GameObject:isValid()

Does the object still exist and is available.

GameObject:moveInto(dest)

Moves object into a container or an inventory.

GameObject.ownerFactionId

Faction who owns the object (nil if missing). Global and self scripts can set the value.

GameObject.ownerFactionRank

Rank required to be allowed to pick up the object. Global and self scripts can set the value.

GameObject.ownerRecordId

NPC who owns the object (nil if missing). Global and self scripts can set the value.

GameObject.position

Object position.

GameObject.recordId

Returns record ID of the object in lowercase.

GameObject:remove(count)

Removes an object or reduces a stack of objects.

GameObject:removeScript(scriptPath)

Removes script that was attached by addScript Can be called only from a global script.

GameObject.rotation

Object rotation (ZXY order).

GameObject:sendEvent(eventName, eventData)

Send local event to the object.

GameObject:split(count)

Splits a stack of items.

GameObject:teleport(cellOrName, position, options)

Moves object to given cell and position.

GameObject.type

Type of the object (one of the tables from the package openmw.types#types).

Type Inventory

Inventory:countOf(recordId)

The number of items with given recordId.

Inventory:find(recordId)

Get first item with given recordId from the inventory.

Inventory:findAll(recordId)

Get all items with given recordId from the inventory.

Inventory:getAll(type)

Get all items of given type from the inventory.

Type Magic

Magic.EFFECT_TYPE

Possible #MagicEffectId values

Magic.RANGE

Possible #SpellRange values

Magic.SCHOOL

Possible #MagicSchool values

Magic.SPELL_TYPE

Possible #SpellType values

Magic.effects

Map from #MagicEffectId to #MagicEffect

Magic.spells

List of all #Spells.

Type MagicEffect

MagicEffect.Effect

id string

MagicEffect.baseCost
MagicEffect.color
MagicEffect.harmful
MagicEffect.name

Localized name of the effect

MagicEffect.school

#MagicSchool

Type MagicEffectId

MagicEffectId.AbsorbAttribute

"absorbattribute"

MagicEffectId.AbsorbFatigue

"absorbfatigue"

MagicEffectId.AbsorbHealth

"absorbhealth"

MagicEffectId.AbsorbMagicka

"absorbmagicka"

MagicEffectId.AbsorbSkill

"absorbskill"

MagicEffectId.AlmsiviIntervention

"almsiviintervention"

MagicEffectId.Blind

"blind"

MagicEffectId.BoundBattleAxe

"boundbattleaxe"

MagicEffectId.BoundBoots

"boundboots"

MagicEffectId.BoundCuirass

"boundcuirass"

MagicEffectId.BoundDagger

"bounddagger"

MagicEffectId.BoundGloves

"boundgloves"

MagicEffectId.BoundHelm

"boundhelm"

MagicEffectId.BoundLongbow

"boundlongbow"

MagicEffectId.BoundLongsword

"boundlongsword"

MagicEffectId.BoundMace

"boundmace"

MagicEffectId.BoundShield

"boundshield"

MagicEffectId.BoundSpear

"boundspear"

MagicEffectId.Burden

"burden"

MagicEffectId.CalmCreature

"calmcreature"

MagicEffectId.CalmHumanoid

"calmhumanoid"

MagicEffectId.Chameleon

"chameleon"

MagicEffectId.Charm

"charm"

MagicEffectId.CommandCreature

"commandcreature"

MagicEffectId.CommandHumanoid

"commandhumanoid"

MagicEffectId.Corprus

"corprus"

MagicEffectId.CureBlightDisease

"cureblightdisease"

MagicEffectId.CureCommonDisease

"curecommondisease"

MagicEffectId.CureCorprusDisease

"curecorprusdisease"

MagicEffectId.CureParalyzation

"cureparalyzation"

MagicEffectId.CurePoison

"curepoison"

MagicEffectId.DamageAttribute

"damageattribute"

MagicEffectId.DamageFatigue

"damagefatigue"

MagicEffectId.DamageHealth

"damagehealth"

MagicEffectId.DamageMagicka

"damagemagicka"

MagicEffectId.DamageSkill

"damageskill"

MagicEffectId.DemoralizeCreature

"demoralizecreature"

MagicEffectId.DemoralizeHumanoid

"demoralizehumanoid"

MagicEffectId.DetectAnimal

"detectanimal"

MagicEffectId.DetectEnchantment

"detectenchantment"

MagicEffectId.DetectKey

"detectkey"

MagicEffectId.DisintegrateArmor

"disintegratearmor"

MagicEffectId.DisintegrateWeapon

"disintegrateweapon"

MagicEffectId.Dispel

"dispel"

MagicEffectId.DivineIntervention

"divineintervention"

MagicEffectId.DrainAttribute

"drainattribute"

MagicEffectId.DrainFatigue

"drainfatigue"

MagicEffectId.DrainHealth

"drainhealth"

MagicEffectId.DrainMagicka

"drainmagicka"

MagicEffectId.DrainSkill

"drainskill"

MagicEffectId.ExtraSpell

"extraspell"

MagicEffectId.Feather

"feather"

MagicEffectId.FireDamage

"firedamage"

MagicEffectId.FireShield

"fireshield"

MagicEffectId.FortifyAttack

"fortifyattack"

MagicEffectId.FortifyAttribute

"fortifyattribute"

MagicEffectId.FortifyFatigue

"fortifyfatigue"

MagicEffectId.FortifyHealth

"fortifyhealth"

MagicEffectId.FortifyMagicka

"fortifymagicka"

MagicEffectId.FortifyMaximumMagicka

"fortifymaximummagicka"

MagicEffectId.FortifySkill

"fortifyskill"

MagicEffectId.FrenzyCreature

"frenzycreature"

MagicEffectId.FrenzyHumanoid

"frenzyhumanoid"

MagicEffectId.FrostDamage

"frostdamage"

MagicEffectId.FrostShield

"frostshield"

MagicEffectId.Invisibility

"invisibility"

MagicEffectId.Jump

"jump"

MagicEffectId.Levitate

"levitate"

MagicEffectId.Light

"light"

MagicEffectId.LightningShield

"lightningshield"

MagicEffectId.Lock

"lock"

MagicEffectId.Mark

"mark"

MagicEffectId.NightEye

"nighteye"

MagicEffectId.Open

"open"

MagicEffectId.Paralyze

"paralyze"

MagicEffectId.Poison

"poison"

MagicEffectId.RallyCreature

"rallycreature"

MagicEffectId.RallyHumanoid

"rallyhumanoid"

MagicEffectId.Recall

"recall"

MagicEffectId.Reflect

"reflect"

MagicEffectId.RemoveCurse

"removecurse"

MagicEffectId.ResistBlightDisease

"resistblightdisease"

MagicEffectId.ResistCommonDisease

"resistcommondisease"

MagicEffectId.ResistCorprusDisease

"resistcorprusdisease"

MagicEffectId.ResistFire

"resistfire"

MagicEffectId.ResistFrost

"resistfrost"

MagicEffectId.ResistMagicka

"resistmagicka"

MagicEffectId.ResistNormalWeapons

"resistnormalweapons"

MagicEffectId.ResistParalysis

"resistparalysis"

MagicEffectId.ResistPoison

"resistpoison"

MagicEffectId.ResistShock

"resistshock"

MagicEffectId.RestoreAttribute

"restoreattribute"

MagicEffectId.RestoreFatigue

"restorefatigue"

MagicEffectId.RestoreHealth

"restorehealth"

MagicEffectId.RestoreMagicka

"restoremagicka"

MagicEffectId.RestoreSkill

"restoreskill"

MagicEffectId.Sanctuary

"sanctuary"

MagicEffectId.Shield

"shield"

MagicEffectId.ShockDamage

"shockdamage"

MagicEffectId.Silence

"silence"

MagicEffectId.SlowFall

"slowfall"

MagicEffectId.Soultrap

"soultrap"

MagicEffectId.Sound

"sound"

MagicEffectId.SpellAbsorption

"spellabsorption"

MagicEffectId.StuntedMagicka

"stuntedmagicka"

MagicEffectId.SummonAncestralGhost

"summonancestralghost"

MagicEffectId.SummonBear

"summonbear"

MagicEffectId.SummonBonelord

"summonbonelord"

MagicEffectId.SummonBonewalker

"summonbonewalker"

MagicEffectId.SummonBonewolf

"summonbonewolf"

MagicEffectId.SummonCenturionSphere

"summoncenturionsphere"

MagicEffectId.SummonClannfear

"summonclannfear"

MagicEffectId.SummonCreature04

"summoncreature04"

MagicEffectId.SummonCreature05

"summoncreature05"

MagicEffectId.SummonDaedroth

"summondaedroth"

MagicEffectId.SummonDremora

"summondremora"

MagicEffectId.SummonFabricant

"summonfabricant"

MagicEffectId.SummonFlameAtronach

"summonflameatronach"

MagicEffectId.SummonFrostAtronach

"summonfrostatronach"

MagicEffectId.SummonGoldenSaint

"summongoldensaint"

MagicEffectId.SummonGreaterBonewalker

"summongreaterbonewalker"

MagicEffectId.SummonHunger

"summonhunger"

MagicEffectId.SummonScamp

"summonscamp"

MagicEffectId.SummonSkeletalMinion

"summonskeletalminion"

MagicEffectId.SummonStormAtronach

"summonstormatronach"

MagicEffectId.SummonWingedTwilight

"summonwingedtwilight"

MagicEffectId.SummonWolf

"summonwolf"

MagicEffectId.SunDamage

"sundamage"

MagicEffectId.SwiftSwim

"swiftswim"

MagicEffectId.Telekinesis

"telekinesis"

MagicEffectId.TurnUndead

"turnundead"

MagicEffectId.Vampirism

"vampirism"

MagicEffectId.WaterBreathing

"waterbreathing"

MagicEffectId.WaterWalking

"waterwalking"

MagicEffectId.WeaknessToBlightDisease

"weaknesstoblightdisease"

MagicEffectId.WeaknessToCommonDisease

"weaknesstocommondisease"

MagicEffectId.WeaknessToCorprusDisease

"weaknesstocorprusdisease"

MagicEffectId.WeaknessToFire

"weaknesstofire"

MagicEffectId.WeaknessToFrost

"weaknesstofrost"

MagicEffectId.WeaknessToMagicka

"weaknesstomagicka"

MagicEffectId.WeaknessToNormalWeapons

"weaknesstonormalweapons"

MagicEffectId.WeaknessToPoison

"weaknesstopoison"

MagicEffectId.WeaknessToShock

"weaknesstoshock"

Type MagicEffectWithParams

MagicEffectWithParams.affectedAttribute

#ATTRIBUTE or nil

MagicEffectWithParams.affectedSkill

#SKILL or nil

MagicEffectWithParams.area
MagicEffectWithParams.effect

#MagicEffect

MagicEffectWithParams.magnitudeMax
MagicEffectWithParams.magnitudeMin
MagicEffectWithParams.range

Type MagicSchool

MagicSchool.Alteration

Alteration

MagicSchool.Conjuration

Conjuration

MagicSchool.Destruction

Destruction

MagicSchool.Illusion

Illusion

MagicSchool.Mysticism

Mysticism

MagicSchool.Restoration

Restoration

Type SKILL

SKILL.Acrobatics

"acrobatics"

SKILL.Alchemy

"alchemy"

SKILL.Alteration

"alteration"

SKILL.Armorer

"armorer"

SKILL.Athletics

"athletics"

SKILL.Axe

"axe"

SKILL.Block

"block"

SKILL.BluntWeapon

"bluntweapon"

SKILL.Conjuration

"conjuration"

SKILL.Destruction

"destruction"

SKILL.Enchant

"enchant"

SKILL.HandToHand

"handtohand"

SKILL.HeavyArmor

"heavyarmor"

SKILL.Illusion

"illusion"

SKILL.LightArmor

"lightarmor"

SKILL.LongBlade

"longblade"

SKILL.Marksman

"marksman"

SKILL.MediumArmor

"mediumarmor"

SKILL.Mercantile

"mercantile"

SKILL.Mysticism

"mysticism"

SKILL.Restoration

"restoration"

SKILL.Security

"security"

SKILL.ShortBlade

"shortblade"

SKILL.Sneak

"sneak"

SKILL.Spear

"spear"

SKILL.Speechcraft

"speechcraft"

SKILL.Unarmored

"unarmored"

Type Spell

Spell.cost
Spell.effects

The effects (#MagicEffectWithParams) of the spell

Spell.id

Spell id

Spell.name

Spell name

Spell.type

#SpellType

Type SpellRange

SpellRange.Self

Applied on self

SpellRange.Target

Ranged spell

SpellRange.Touch

On touch

Type SpellType

SpellType.Ability

Inert ability, always in effect

SpellType.Blight

Blight disease

SpellType.Curse

Curse

SpellType.Disease

Common disease

SpellType.Power

Power, can be used once a day

SpellType.Spell

Normal spell, must be cast and costs mana

Type TeleportOptions

TeleportOptions.onGround

If true, adjust destination position to the ground.

TeleportOptions.rotation

New rotation; if missing, then the current rotation is used.

Type core

Field(s)

#number core.API_REVISION

The revision of OpenMW Lua API.

It is an integer that is incremented every time the API is changed.

#ATTRIBUTE core.ATTRIBUTE

Possible #ATTRIBUTE values

#SKILL core.SKILL

Possible #SKILL values

core.getGMST(setting)

Get a GMST setting from content files.

Parameter

  • #string setting : Setting name

Return value

#any:

core.getGameTime()

Game time in seconds.

Return value

#number:

core.getGameTimeScale()

The scale of game time relative to simulation time.

Return value

#number:

core.getRealTime()

Real time in seconds; starting point is not fixed (can be time since last reboot), use only for measuring intervals.

For Unix time use os.time().

Return value

#number:

core.getSimulationTime()

Simulation time in seconds.

The number of simulation seconds passed in the game world since starting a new game.

Return value

#number:

core.getSimulationTimeScale()

The scale of simulation time relative to real time.

Return value

#number:

core.isWorldPaused()

Whether the world is paused (onUpdate doesn't work when the world is paused).

Return value

#boolean:

core.l10n(context, fallbackLocale)

Return l10n formatting function for the given context.

Localisation files (containing the message names and translations) should be stored in VFS as files of the form l10n/<ContextName>/<Locale>.yaml.

See Localisation for details of the localisation file structure.

When calling the l10n formatting function, if no localisation can be found for any of the requested locales then the message key will be returned instead (and formatted, if possible). This makes it possible to use the source strings as message identifiers.

If you do not use the source string as a message identifier you should instead make certain to include a fallback locale with a complete set of messages.

Parameters

  • #string context : l10n context; recommended to use the name of the mod.

               This must match the <ContextName> directory in the VFS which stores the localisation files.
    
  • #string fallbackLocale : The source locale containing the default messages

                              If omitted defaults to "en".
    

Return value

#function:

Usages:

  • # DataFiles/l10n/MyMod/en.yaml
    good_morning: 'Good morning.'
    you_have_arrows: |-
      {count, plural,
        one {You have one arrow.}
        other {You have {count} arrows.}
      }
  • # DataFiles/l10n/MyMod/de.yaml
    good_morning: "Guten Morgen."
    you_have_arrows: |-
      {count, plural,
        one {Du hast ein Pfeil.}
        other {Du hast {count} Pfeile.}
      }
    "Hello {name}!": "Hallo {name}!"
  • -- Usage in Lua
    local myMsg = core.l10n('MyMod', 'en')
    print( myMsg('good_morning') )
    print( myMsg('you_have_arrows', {count=5}) )
    print( myMsg('Hello {name}!', {name='World'}) )
#Magic core.magic

#Magic: spells and spell effects

core.quit()

Terminates the game and quits to the OS.

Should be used only for testing purposes.

core.sendGlobalEvent(eventName, eventData)

Send an event to global scripts.

Parameters

  • #string eventName :

  • eventData :

Type ATTRIBUTE

core.ATTRIBUTE

Field(s)

#string ATTRIBUTE.Agility

"agility"

#string ATTRIBUTE.Endurance

"endurance"

#string ATTRIBUTE.Intelligence

"intelligence"

#string ATTRIBUTE.Luck

"luck"

#string ATTRIBUTE.Personality

"personality"

#string ATTRIBUTE.Speed

"speed"

#string ATTRIBUTE.Strength

"strength"

#string ATTRIBUTE.Willpower

"willpower"

Type ActiveEffect

Field(s)

#any ActiveEffect.affectedAttribute

#ATTRIBUTE or nil

#any ActiveEffect.affectedSkill

#SKILL or nil

#string ActiveEffect.id

Effect id string

#number ActiveEffect.magnitude
#number ActiveEffect.magnitudeBase
#number ActiveEffect.magnitudeModifier
#string ActiveEffect.name

Localized name of the effect

Type Cell

A cell of the game world.

Field(s)

Cell:getAll(type)

Get all objects of given type from the cell.

Parameter

Return value

#ObjectList:

Usage:

local type = require('openmw.types')
local all = cell:getAll()
local weapons = cell:getAll(types.Weapon)
#number Cell.gridX

Index of the cell by X (only for exteriors).

#number Cell.gridY

Index of the cell by Y (only for exteriors).

#boolean Cell.hasSky

True if in this cell sky should be rendered.

Cell:hasTag(tag)

Returns true if the cell has given tag.

Parameter

  • #string tag : One of "QuasiExterior", "NoSleep".

Return value

#boolean:

#boolean Cell.hasWater

True if the cell contains water.

#boolean Cell.isExterior

Whether the cell is an exterior cell. "Exterior" means grid of cells where the player can seamless walk from one cell to another without teleports. QuasiExterior (interior with sky) is not an exterior.

Cell:isInSameSpace(object)

Returns true either if the cell contains the object or if the cell is an exterior and the object is also in an exterior.

Parameter

Return value

#boolean:

Usage:

if obj1.cell:isInSameSpace(obj2) then
    dist = (obj1.position - obj2.position):length()
else
    -- the distance can't be calculated because the coordinates are in different spaces
end
#boolean Cell.isQuasiExterior

(DEPRECATED, use hasTag("QuasiExterior")) Whether the cell is a quasi exterior (like interior but with the sky and the wheather).

#string Cell.name

Name of the cell (can be empty string).

#string Cell.region

Region of the cell.

#string Cell.worldSpaceId

Id of the world space.

Type GameObject

Extends #userdata

Any object that exists in the game world and has a specific location.

Player, actors, items, and statics are game objects.

Field(s)

GameObject:activateBy(actor)

Activate the object.

Parameter

  • #GameObject actor : The actor who activates the object

Usage:

local self = require('openmw.self')
object:activateBy(self)
GameObject:addScript(scriptPath, initData)

Add new local script to the object.

Can be called only from a global script. Script should be specified in a content file (omwgame/omwaddon/omwscripts) with a CUSTOM flag. Scripts can not be attached to Statics.

Parameters

  • #string scriptPath : Path to the script in OpenMW virtual filesystem.

  • #table initData : (optional) Initialization data to be passed to onInit. If missed then Lua initialization data from content files will be used (if exists for this script).

#Cell GameObject.cell

The cell where the object currently is. During loading a game and for objects in an inventory or a container cell is nil.

#number GameObject.count

Count (>1 means a stack of objects).

#boolean GameObject.enabled

Whether the object is enabled or disabled. Global scripts can set the value. Items in containers or inventories can't be disabled.

GameObject:getBoundingBox()

The axis aligned bounding box in local coordinates.

Return value

openmw.util#Box:

GameObject:hasScript(scriptPath)

Whether a script with given path is attached to this object.

Can be called only from a global script.

Parameter

  • #string scriptPath : Path to the script in OpenMW virtual filesystem.

Return value

#boolean:

#string GameObject.id

A unique id of this object (not record id), can be used as a key in a table.

GameObject:isValid()

Does the object still exist and is available.

Returns true if the object exists and loaded, and false otherwise. If false, then every access to the object will raise an error.

Return value

#boolean:

GameObject:moveInto(dest)

Moves object into a container or an inventory.

Enables if was disabled. Can be called only from a global script.

Parameter

Usage:

item:moveInto(types.Actor.inventory(actor))
#string GameObject.ownerFactionId

Faction who owns the object (nil if missing). Global and self scripts can set the value.

#number GameObject.ownerFactionRank

Rank required to be allowed to pick up the object. Global and self scripts can set the value.

#string GameObject.ownerRecordId

NPC who owns the object (nil if missing). Global and self scripts can set the value.

openmw.util#Vector3 GameObject.position

Object position.

#string GameObject.recordId

Returns record ID of the object in lowercase.

GameObject:remove(count)

Removes an object or reduces a stack of objects.

Can be called only from a global script.

Parameter

  • #number count : (optional) the number of items to remove (if not specified then the whole stack)

GameObject:removeScript(scriptPath)

Removes script that was attached by addScript Can be called only from a global script.

Parameter

  • #string scriptPath : Path to the script in OpenMW virtual filesystem.

openmw.util#Vector3 GameObject.rotation

Object rotation (ZXY order).

GameObject:sendEvent(eventName, eventData)

Send local event to the object.

Parameters

  • #string eventName :

  • eventData :

GameObject:split(count)

Splits a stack of items.

Original stack is reduced by count. Returns a new stack with count items. Can be called only from a global script.

Parameter

  • #number count : The number of items to return.

Usage:

-- take 50 coins from `money` and put to the container `cont`
money:split(50):moveInto(types.Container.content(cont))
GameObject:teleport(cellOrName, position, options)

Moves object to given cell and position.

Can be called only from a global script. The effect is not immediate: the position will be updated only in the next frame. Can be called only from a global script. Enables object if it was disabled. Can be used to move objects from an inventory or a container to the world.

Parameters

  • #any cellOrName : A cell to define the destination worldspace; can be either #Cell, or cell name, or an empty string (empty string means the default exterior worldspace). If the worldspace has multiple cells (i.e. an exterior), the destination cell is calculated using position.

  • openmw.util#Vector3 position : New position.

  • #TeleportOptions options : (optional) Either table #TeleportOptions or openmw.util#Vector3 rotation.

#any GameObject.type

Type of the object (one of the tables from the package openmw.types#types).

Type Inventory

Inventory of a player/NPC or a content of a container.

Field(s)

Inventory:countOf(recordId)

The number of items with given recordId.

Parameter

  • #string recordId :

Return value

#number:

Inventory:find(recordId)

Get first item with given recordId from the inventory.

Returns nil if not found.

Parameter

  • #string recordId :

Return value

#GameObject:

Usage:

inventory:find('gold_001')
Inventory:findAll(recordId)

Get all items with given recordId from the inventory.

Parameter

  • #string recordId :

Return value

#ObjectList:

Usage:

for _, item in ipairs(inventory:findAll('common_shirt_01')) do ... end
Inventory:getAll(type)

Get all items of given type from the inventory.

Parameter

Return value

#ObjectList:

Usage:

local types = require('openmw.types')
local self = require('openmw.self')
local playerInventory = types.Actor.inventory(self.object)
local all = playerInventory:getAll()
local weapons = playerInventory:getAll(types.Weapon)

Type Magic

Field(s)

#MagicEffectId Magic.EFFECT_TYPE

Possible #MagicEffectId values

#SpellRange Magic.RANGE

Possible #SpellRange values

#MagicSchool Magic.SCHOOL

Possible #MagicSchool values

#SpellType Magic.SPELL_TYPE

Possible #SpellType values

#map<#number,#MagicEffect> Magic.effects

Map from #MagicEffectId to #MagicEffect

Usage:

-- Print all harmful effects
for _, effect in pairs(core.magic.effects) do
    if effect.harmful then
        print(effect.name)
    end
end
#list<#Spell> Magic.spells

List of all #Spells.

Usages:

  • local spell = core.magic.spells['thunder fist']  -- get by id
  • local spell = core.magic.spells[1]  -- get by index
  • -- Print all powers
    for _, spell in pairs(core.magic.spells) do
        if spell.types == core.magic.SPELL_TYPE.Power then
            print(spell.name)
        end
    end

Type MagicEffect

Field(s)

#string MagicEffect.Effect

id string

#number MagicEffect.baseCost
openmw.util#Color MagicEffect.color
#boolean MagicEffect.harmful
#string MagicEffect.name

Localized name of the effect

#number MagicEffect.school

#MagicSchool

Type MagicEffectId

core.magic.EFFECT_TYPE

Field(s)

#number MagicEffectId.AbsorbAttribute

"absorbattribute"

#number MagicEffectId.AbsorbFatigue

"absorbfatigue"

#number MagicEffectId.AbsorbHealth

"absorbhealth"

#number MagicEffectId.AbsorbMagicka

"absorbmagicka"

#number MagicEffectId.AbsorbSkill

"absorbskill"

#number MagicEffectId.AlmsiviIntervention

"almsiviintervention"

#number MagicEffectId.Blind

"blind"

#number MagicEffectId.BoundBattleAxe

"boundbattleaxe"

#number MagicEffectId.BoundBoots

"boundboots"

#number MagicEffectId.BoundCuirass

"boundcuirass"

#number MagicEffectId.BoundDagger

"bounddagger"

#number MagicEffectId.BoundGloves

"boundgloves"

#number MagicEffectId.BoundHelm

"boundhelm"

#number MagicEffectId.BoundLongbow

"boundlongbow"

#number MagicEffectId.BoundLongsword

"boundlongsword"

#number MagicEffectId.BoundMace

"boundmace"

#number MagicEffectId.BoundShield

"boundshield"

#number MagicEffectId.BoundSpear

"boundspear"

#number MagicEffectId.Burden

"burden"

#number MagicEffectId.CalmCreature

"calmcreature"

#number MagicEffectId.CalmHumanoid

"calmhumanoid"

#number MagicEffectId.Chameleon

"chameleon"

#number MagicEffectId.Charm

"charm"

#number MagicEffectId.CommandCreature

"commandcreature"

#number MagicEffectId.CommandHumanoid

"commandhumanoid"

#number MagicEffectId.Corprus

"corprus"

#number MagicEffectId.CureBlightDisease

"cureblightdisease"

#number MagicEffectId.CureCommonDisease

"curecommondisease"

#number MagicEffectId.CureCorprusDisease

"curecorprusdisease"

#number MagicEffectId.CureParalyzation

"cureparalyzation"

#number MagicEffectId.CurePoison

"curepoison"

#number MagicEffectId.DamageAttribute

"damageattribute"

#number MagicEffectId.DamageFatigue

"damagefatigue"

#number MagicEffectId.DamageHealth

"damagehealth"

#number MagicEffectId.DamageMagicka

"damagemagicka"

#number MagicEffectId.DamageSkill

"damageskill"

#number MagicEffectId.DemoralizeCreature

"demoralizecreature"

#number MagicEffectId.DemoralizeHumanoid

"demoralizehumanoid"

#number MagicEffectId.DetectAnimal

"detectanimal"

#number MagicEffectId.DetectEnchantment

"detectenchantment"

#number MagicEffectId.DetectKey

"detectkey"

#number MagicEffectId.DisintegrateArmor

"disintegratearmor"

#number MagicEffectId.DisintegrateWeapon

"disintegrateweapon"

#number MagicEffectId.Dispel

"dispel"

#number MagicEffectId.DivineIntervention

"divineintervention"

#number MagicEffectId.DrainAttribute

"drainattribute"

#number MagicEffectId.DrainFatigue

"drainfatigue"

#number MagicEffectId.DrainHealth

"drainhealth"

#number MagicEffectId.DrainMagicka

"drainmagicka"

#number MagicEffectId.DrainSkill

"drainskill"

#number MagicEffectId.ExtraSpell

"extraspell"

#number MagicEffectId.Feather

"feather"

#number MagicEffectId.FireDamage

"firedamage"

#number MagicEffectId.FireShield

"fireshield"

#number MagicEffectId.FortifyAttack

"fortifyattack"

#number MagicEffectId.FortifyAttribute

"fortifyattribute"

#number MagicEffectId.FortifyFatigue

"fortifyfatigue"

#number MagicEffectId.FortifyHealth

"fortifyhealth"

#number MagicEffectId.FortifyMagicka

"fortifymagicka"

#number MagicEffectId.FortifyMaximumMagicka

"fortifymaximummagicka"

#number MagicEffectId.FortifySkill

"fortifyskill"

#number MagicEffectId.FrenzyCreature

"frenzycreature"

#number MagicEffectId.FrenzyHumanoid

"frenzyhumanoid"

#number MagicEffectId.FrostDamage

"frostdamage"

#number MagicEffectId.FrostShield

"frostshield"

#number MagicEffectId.Invisibility

"invisibility"

#number MagicEffectId.Jump

"jump"

#number MagicEffectId.Levitate

"levitate"

#number MagicEffectId.Light

"light"

#number MagicEffectId.LightningShield

"lightningshield"

#number MagicEffectId.Lock

"lock"

#number MagicEffectId.Mark

"mark"

#number MagicEffectId.NightEye

"nighteye"

#number MagicEffectId.Open

"open"

#number MagicEffectId.Paralyze

"paralyze"

#number MagicEffectId.Poison

"poison"

#number MagicEffectId.RallyCreature

"rallycreature"

#number MagicEffectId.RallyHumanoid

"rallyhumanoid"

#number MagicEffectId.Recall

"recall"

#number MagicEffectId.Reflect

"reflect"

#number MagicEffectId.RemoveCurse

"removecurse"

#number MagicEffectId.ResistBlightDisease

"resistblightdisease"

#number MagicEffectId.ResistCommonDisease

"resistcommondisease"

#number MagicEffectId.ResistCorprusDisease

"resistcorprusdisease"

#number MagicEffectId.ResistFire

"resistfire"

#number MagicEffectId.ResistFrost

"resistfrost"

#number MagicEffectId.ResistMagicka

"resistmagicka"

#number MagicEffectId.ResistNormalWeapons

"resistnormalweapons"

#number MagicEffectId.ResistParalysis

"resistparalysis"

#number MagicEffectId.ResistPoison

"resistpoison"

#number MagicEffectId.ResistShock

"resistshock"

#number MagicEffectId.RestoreAttribute

"restoreattribute"

#number MagicEffectId.RestoreFatigue

"restorefatigue"

#number MagicEffectId.RestoreHealth

"restorehealth"

#number MagicEffectId.RestoreMagicka

"restoremagicka"

#number MagicEffectId.RestoreSkill

"restoreskill"

#number MagicEffectId.Sanctuary

"sanctuary"

#number MagicEffectId.Shield

"shield"

#number MagicEffectId.ShockDamage

"shockdamage"

#number MagicEffectId.Silence

"silence"

#number MagicEffectId.SlowFall

"slowfall"

#number MagicEffectId.Soultrap

"soultrap"

#number MagicEffectId.Sound

"sound"

#number MagicEffectId.SpellAbsorption

"spellabsorption"

#number MagicEffectId.StuntedMagicka

"stuntedmagicka"

#number MagicEffectId.SummonAncestralGhost

"summonancestralghost"

#number MagicEffectId.SummonBear

"summonbear"

#number MagicEffectId.SummonBonelord

"summonbonelord"

#number MagicEffectId.SummonBonewalker

"summonbonewalker"

#number MagicEffectId.SummonBonewolf

"summonbonewolf"

#number MagicEffectId.SummonCenturionSphere

"summoncenturionsphere"

#number MagicEffectId.SummonClannfear

"summonclannfear"

#number MagicEffectId.SummonCreature04

"summoncreature04"

#number MagicEffectId.SummonCreature05

"summoncreature05"

#number MagicEffectId.SummonDaedroth

"summondaedroth"

#number MagicEffectId.SummonDremora

"summondremora"

#number MagicEffectId.SummonFabricant

"summonfabricant"

#number MagicEffectId.SummonFlameAtronach

"summonflameatronach"

#number MagicEffectId.SummonFrostAtronach

"summonfrostatronach"

#number MagicEffectId.SummonGoldenSaint

"summongoldensaint"

#number MagicEffectId.SummonGreaterBonewalker

"summongreaterbonewalker"

#number MagicEffectId.SummonHunger

"summonhunger"

#number MagicEffectId.SummonScamp

"summonscamp"

#number MagicEffectId.SummonSkeletalMinion

"summonskeletalminion"

#number MagicEffectId.SummonStormAtronach

"summonstormatronach"

#number MagicEffectId.SummonWingedTwilight

"summonwingedtwilight"

#number MagicEffectId.SummonWolf

"summonwolf"

#number MagicEffectId.SunDamage

"sundamage"

#number MagicEffectId.SwiftSwim

"swiftswim"

#number MagicEffectId.Telekinesis

"telekinesis"

#number MagicEffectId.TurnUndead

"turnundead"

#number MagicEffectId.Vampirism

"vampirism"

#number MagicEffectId.WaterBreathing

"waterbreathing"

#number MagicEffectId.WaterWalking

"waterwalking"

#number MagicEffectId.WeaknessToBlightDisease

"weaknesstoblightdisease"

#number MagicEffectId.WeaknessToCommonDisease

"weaknesstocommondisease"

#number MagicEffectId.WeaknessToCorprusDisease

"weaknesstocorprusdisease"

#number MagicEffectId.WeaknessToFire

"weaknesstofire"

#number MagicEffectId.WeaknessToFrost

"weaknesstofrost"

#number MagicEffectId.WeaknessToMagicka

"weaknesstomagicka"

#number MagicEffectId.WeaknessToNormalWeapons

"weaknesstonormalweapons"

#number MagicEffectId.WeaknessToPoison

"weaknesstopoison"

#number MagicEffectId.WeaknessToShock

"weaknesstoshock"

Type MagicEffectWithParams

Field(s)

#any MagicEffectWithParams.affectedAttribute

#ATTRIBUTE or nil

#any MagicEffectWithParams.affectedSkill

#SKILL or nil

#number MagicEffectWithParams.area
#MagicEffect MagicEffectWithParams.effect

#MagicEffect

#number MagicEffectWithParams.magnitudeMax
#number MagicEffectWithParams.magnitudeMin
#number MagicEffectWithParams.range

Type MagicSchool

core.magic.SCHOOL

Field(s)

#number MagicSchool.Alteration

Alteration

#number MagicSchool.Conjuration

Conjuration

#number MagicSchool.Destruction

Destruction

#number MagicSchool.Illusion

Illusion

#number MagicSchool.Mysticism

Mysticism

#number MagicSchool.Restoration

Restoration

Type ObjectList

List of GameObjects.

Implements iterables#List of #GameObject

ObjectList is a list of #GameObject.

Type SKILL

core.SKILL

Field(s)

#string SKILL.Acrobatics

"acrobatics"

#string SKILL.Alchemy

"alchemy"

#string SKILL.Alteration

"alteration"

#string SKILL.Armorer

"armorer"

#string SKILL.Athletics

"athletics"

#string SKILL.Axe

"axe"

#string SKILL.Block

"block"

#string SKILL.BluntWeapon

"bluntweapon"

#string SKILL.Conjuration

"conjuration"

#string SKILL.Destruction

"destruction"

#string SKILL.Enchant

"enchant"

#string SKILL.HandToHand

"handtohand"

#string SKILL.HeavyArmor

"heavyarmor"

#string SKILL.Illusion

"illusion"

#string SKILL.LightArmor

"lightarmor"

#string SKILL.LongBlade

"longblade"

#string SKILL.Marksman

"marksman"

#string SKILL.MediumArmor

"mediumarmor"

#string SKILL.Mercantile

"mercantile"

#string SKILL.Mysticism

"mysticism"

#string SKILL.Restoration

"restoration"

#string SKILL.Security

"security"

#string SKILL.ShortBlade

"shortblade"

#string SKILL.Sneak

"sneak"

#string SKILL.Spear

"spear"

#string SKILL.Speechcraft

"speechcraft"

#string SKILL.Unarmored

"unarmored"

Type Spell

Field(s)

#number Spell.cost
#list<#MagicEffectWithParams> Spell.effects

The effects (#MagicEffectWithParams) of the spell

#string Spell.id

Spell id

#string Spell.name

Spell name

#number Spell.type

#SpellType

Type SpellRange

core.magic.RANGE

Field(s)

#number SpellRange.Self

Applied on self

#number SpellRange.Target

Ranged spell

#number SpellRange.Touch

On touch

Type SpellType

core.magic.SPELL_TYPE

Field(s)

#number SpellType.Ability

Inert ability, always in effect

#number SpellType.Blight

Blight disease

#number SpellType.Curse

Curse

#number SpellType.Disease

Common disease

#number SpellType.Power

Power, can be used once a day

#number SpellType.Spell

Normal spell, must be cast and costs mana

Type TeleportOptions

Either table with options or openmw.util#Vector3 rotation.

Field(s)

#boolean TeleportOptions.onGround

If true, adjust destination position to the ground.

openmw.util#Vector3 TeleportOptions.rotation

New rotation; if missing, then the current rotation is used.