Package openmw.core
Defines functions and types that are available in local, global and menu scripts.
Usage
local core = require('openmw.core')
Type core
| core.API_REVISION |
The revision of OpenMW Lua API. |
| core.contentFiles |
#ContentFiles: functions working with the list of currently loaded content files. |
| core.dialogue |
#Dialogue: Dialogue |
| core.factions |
#Factions: Factions |
| core.getFormId(contentFile, index) |
Construct FormId string from content file name and the index in the file. |
| core.getGMST(setting) |
Get a GMST setting from content files. |
| core.getGameDifficulty() |
The game's difficulty setting. |
| core.getGameTime() |
Game time in seconds. |
| core.getGameTimeScale() |
The scale of game time relative to simulation time. |
| core.getRealFrameDuration() |
Frame duration in seconds. |
| 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. |
| core.l10n(context, fallbackLocale) |
Return l10n formatting function for the given context. |
| core.land |
#Land: Functions for interacting with land data |
| core.magic |
#Magic: spells and spell effects |
| core.mwscripts |
#MWScripts: MWScripts |
| core.quit() |
Terminates the game and quits to the OS. |
| core.regions |
#Regions: Regions |
| core.sendGlobalEvent(eventName, eventData) |
Send an event to global scripts. |
| core.sound |
#Sound: Sounds and Speech |
| core.stats |
#Stats: stats |
| core.weather |
#Weather: Weather |
Type ActiveEffect
| ActiveEffect.affectedAttribute |
Optional attribute ID |
| ActiveEffect.affectedSkill |
Optional skill ID |
| ActiveEffect.id |
Effect id string |
| ActiveEffect.magnitude |
current magnitude of the effect. Will be set to 0 when effect is removed or expires. |
| ActiveEffect.magnitudeBase | |
| ActiveEffect.magnitudeModifier | |
| ActiveEffect.name |
Localized name of the effect |
Type ActiveSpell
| ActiveSpell.activeSpellId |
A number uniquely identifying this active spell within the affected actor's list of active spells. |
| ActiveSpell.affectsBaseValues |
If set, this spell affects the base values of affected stats, rather than modifying current values. |
| ActiveSpell.caster |
The caster object, or nil if the spell has no defined caster |
| ActiveSpell.effects |
The active effects (#ActiveSpellEffect) of this spell. |
| ActiveSpell.fromEquipment |
If set, this spell is tied to an equipped item and can only be ended by unequipping the item. |
| ActiveSpell.id |
Record id of the spell or item used to cast the spell |
| ActiveSpell.item |
The enchanted item used to cast the spell, or nil if the spell was not cast from an enchanted item. Note that if the spell was cast for a single-use enchantment such as a scroll, this will be nil. |
| ActiveSpell.name |
The spell or item display name |
| ActiveSpell.stackable |
If set, this spell can be applied multiple times. If not set, the same spell can only be applied once from the same source (where source is determined by caster + item). In vanilla rules, consumables are stackable while spells and enchantments are not. |
| ActiveSpell.temporary |
If set, this spell effect is temporary and should end on its own. Either after a single application or after its duration has run out. |
Type ActiveSpellEffect
| ActiveSpellEffect.affectedAttribute |
Optional attribute ID |
| ActiveSpellEffect.affectedSkill |
Optional skill ID |
| ActiveSpellEffect.duration |
Total duration in seconds of this spell effect, should not be confused with remaining duration. Or nil if the effect is not temporary. |
| ActiveSpellEffect.durationLeft |
Remaining duration in seconds of this spell effect, or nil if the effect is not temporary. |
| ActiveSpellEffect.id |
Magic effect id |
| ActiveSpellEffect.index |
Index of this effect within the original list of #MagicEffectWithParams of the spell/enchantment/potion this effect came from. |
| ActiveSpellEffect.magnitudeThisFrame |
The magnitude of the effect in the current frame. This will be a new random number between minMagnitude and maxMagnitude every frame. Or nil if the effect has no magnitude. |
| ActiveSpellEffect.maxMagnitude |
The maximum magnitude of this effect, or nil if the effect has no magnitude. |
| ActiveSpellEffect.minMagnitude |
The minimum magnitude of this effect, or nil if the effect has no magnitude. |
| ActiveSpellEffect.name |
Localized name of the effect |
Type Attribute
| Attribute.record(recordId) |
Returns a read-only #AttributeRecord |
| Attribute.records |
A read-only list of all #AttributeRecords in the world database, may be indexed by recordId. Implements iterables#List of #AttributeRecord. |
Type AttributeRecord
| AttributeRecord.description |
Human-readable description |
| AttributeRecord.icon |
VFS path to the icon |
| AttributeRecord.id |
Record id |
| AttributeRecord.name |
Human-readable name |
Type Cell
| Cell:getAll(type) |
Get all objects of given type from the cell; Only available from global scripts. |
| 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.id |
Unique record ID of the cell, based on cell name for interiors and the worldspace for exteriors, or the formID of the cell for ESM4 cells. |
| 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 |
| Cell.name |
Name of the cell (can be empty string). |
| Cell.pathGrid |
The cell's #PathGrid if it has one. |
| Cell.region |
Region of the cell. |
| Cell.waterLevel |
The water level of the cell. (nil if cell has no water). |
| Cell.worldSpaceId |
Id of the world space. |
Type ContentFiles
| ContentFiles.has(contentFile) |
Check if the content file with given name present in the load order. |
| ContentFiles.indexOf(contentFile) |
Return the index of a specific content file in the load order (or |
| ContentFiles.list |
The current load order (list of content file names). |
Type Dialogue
| Dialogue.greeting |
#DialogueRecords functions for greeting read-only records. |
| Dialogue.journal |
#DialogueRecords functions for journal (quest) read-only records. |
| Dialogue.persuasion |
#DialogueRecords functions for persuasion read-only records. |
| Dialogue.topic |
#DialogueRecords functions for topic read-only records. |
| Dialogue.voice |
#DialogueRecords functions for voice read-only records. |
Type DialogueRecord
| DialogueRecord.id |
Record identifier |
| DialogueRecord.infos |
A read-only list containing all #DialogueRecordInfos for this record, in order. |
| DialogueRecord.name |
Same as id, but with upper cases preserved. |
| DialogueRecord.questName |
Non-nil only for journal records with available value. Holds the quest name for this journal entry. Same info may be available under |
Type DialogueRecordInfo
| DialogueRecordInfo.filterActorClass |
Speaker class allowing for this info entry to appear. |
| DialogueRecordInfo.filterActorDisposition |
Minimum speaker disposition allowing for this info entry to appear. |
| DialogueRecordInfo.filterActorFaction |
Faction of which the speaker must be a member for this info entry to appear. |
| DialogueRecordInfo.filterActorFactionRank |
Minimum speaker's rank in their faction allowing for this info entry to appear. |
| DialogueRecordInfo.filterActorGender |
Speaker gender allowing for this info entry to appear: "male" or "female". |
| DialogueRecordInfo.filterActorId |
Speaker ID allowing for this info entry to appear. |
| DialogueRecordInfo.filterActorRace |
Speaker race allowing for this info entry to appear. |
| DialogueRecordInfo.filterPlayerCell |
Cell name prefix of location where the player must be for this info entry to appear. |
| DialogueRecordInfo.filterPlayerFaction |
Faction of which the player must be a member for this info entry to appear. |
| DialogueRecordInfo.filterPlayerFactionRank |
Minimum player's rank in their faction allowing for this info entry to appear. |
| DialogueRecordInfo.id |
Identifier for this info entry. Is unique only within the #DialogueRecord it belongs to. |
| DialogueRecordInfo.isQuestFinished |
True if this info entry has the "Finished" flag checked. |
| DialogueRecordInfo.isQuestName |
True if this info entry has the "Quest Name" flag checked. |
| DialogueRecordInfo.isQuestRestart |
True if this info entry has the "Restart" flag checked. |
| DialogueRecordInfo.questStage |
Quest stage (same as in openmw_types#PlayerQuest.stage) this info entry is associated with. |
| DialogueRecordInfo.resultScript |
MWScript (full script text) executed when this info is chosen. |
| DialogueRecordInfo.sound |
Sound file path for this info entry. |
| DialogueRecordInfo.text |
Text associated with this info entry. |
Type DialogueRecords
| DialogueRecords.records |
A read-only list of all #DialogueRecords in the world database, may be indexed by recordId, which doesn't have to be lowercase. |
Type Effects
| Effects.records |
Map from #MagicEffectId to #MagicEffect |
Type Enchantment
| Enchantment.autocalcFlag |
If set, the casting cost should be computed based on the effect list rather than read from the cost field |
| Enchantment.charge |
Charge capacity. Should not be confused with current charge. |
| Enchantment.cost | |
| Enchantment.effects |
The effects (#MagicEffectWithParams) of the enchantment |
| Enchantment.id |
Enchantment id |
| Enchantment.type |
Type EnchantmentType
| EnchantmentType.CastOnStrike |
Enchantment is cast on strike, if there is enough charge. |
| EnchantmentType.CastOnUse |
Enchantment is cast when used, if there is enough charge. |
| EnchantmentType.CastOnce |
Enchantment can be cast once, destroying the enchanted item. |
| EnchantmentType.ConstantEffect |
Enchantment is always active when equipped. |
Type Enchantments
| Enchantments.records |
A read-only list of all #Enchantment records in the world database, may be indexed by recordId. |
Type FactionRank
| FactionRank.attributeValues |
Attributes values required to get this rank. |
| FactionRank.factionReaction |
Reaction of faction members if player is in this faction. |
| FactionRank.favouredSkillValue |
Secondary skill value required to get this rank. |
| FactionRank.name |
Faction name Rank display name |
| FactionRank.primarySkillValue |
Primary skill value required to get this rank. |
Type FactionRecord
| FactionRecord.attributes |
A read-only list containing IDs of attributes to advance ranks in the faction. |
| FactionRecord.hidden |
If true, the faction won't show in the player's skills menu |
| FactionRecord.id |
Faction id |
| FactionRecord.name |
Faction name |
| FactionRecord.ranks |
A read-only list containing data for all ranks in the faction, in order. |
| FactionRecord.reactions |
A read-only map containing reactions of other factions to this faction. |
| FactionRecord.skills |
A read-only list containing IDs of skills to advance ranks in the faction. |
Type Factions
| Factions.records |
A read-only list of all #FactionRecords in the world database. |
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 |
| GameObject.contentFile |
Lower cased file name of the content file that defines this object; nil for dynamically created objects. |
| 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 world coordinates. |
| GameObject.globalVariable |
Global Variable associated with this object(read only). |
| 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.owner |
Ownership information |
| GameObject.parentContainer |
Container or actor that contains (or has in inventory) this object. It is nil if the object is in a cell. |
| 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 |
| GameObject.rotation |
Object rotation. |
| GameObject.scale |
Object scale. |
| GameObject:sendEvent(eventName, eventData) |
Send local event to the object. |
| GameObject:setScale(scale) |
Sets the object's scale. |
| GameObject:split(count) |
Splits a stack of items. |
| GameObject.startingPosition |
The object original position |
| GameObject.startingRotation |
The object original rotation |
| 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. |
| Inventory:isResolved() |
Checks if the inventory has a resolved item list. |
| Inventory:resolve() |
Will resolve the inventory, filling it with levelled items if applicable, making its contents permanent. |
Type Land
| Land.getHeightAt(position, cellOrId) |
Get the terrain height at a given location. |
| Land.getTextureAt(position, cellOrId) |
Get the terrain texture at a given location. |
Type MWScriptRecord
| MWScriptRecord.id |
MWScript id |
| MWScriptRecord.text |
MWScript content |
Type MWScripts
| MWScripts.records |
A read-only list of all #MWScriptRecords in the world database. |
Type Magic
| Magic.EFFECT_TYPE |
Possible #MagicEffectId values |
| Magic.ENCHANTMENT_TYPE |
Possible #EnchantmentType values |
| Magic.RANGE |
Possible #SpellRange values |
| Magic.SPELL_TYPE |
Possible #SpellType values |
| Magic.effects |
#Effects: Magic Effects |
| Magic.enchantments |
#Enchantments: Enchantments |
| Magic.spells |
#Spells: Spells |
Type MagicEffect
| MagicEffect.areaSound |
Identifier of the sound used for AOE spells |
| MagicEffect.areaStatic |
Identifier of the vfx static used for AOE spells |
| MagicEffect.baseCost | |
| MagicEffect.bolt |
Identifier of the projectile used for ranged spells |
| MagicEffect.boltSound |
Identifier of the projectile sound used for ranged spells |
| MagicEffect.castSound |
Identifier of the sound used for casting |
| MagicEffect.castStatic |
Identifier of the vfx static used for casting |
| MagicEffect.casterLinked |
If set, it is implied the magic effect links back to the caster in some way and should end immediately or never be applied if the caster dies or is not an actor. |
| MagicEffect.color | |
| MagicEffect.continuousVfx |
Whether the magic effect's vfx should loop or not |
| MagicEffect.harmful |
If set, the effect is considered harmful and should elicit a hostile reaction from affected NPCs. |
| MagicEffect.hasDuration |
If set, the magic effect has a duration. As an example, divine intervention has no duration while fire damage does. |
| MagicEffect.hasMagnitude |
If set, the magic effect depends on a magnitude. As an example, cure common disease has no magnitude while chameleon does. |
| MagicEffect.hitSound |
Identifier of the sound used on hit |
| MagicEffect.hitStatic |
Identifier of the vfx static used on hit |
| MagicEffect.icon |
Effect Icon Path |
| MagicEffect.id |
Effect ID |
| MagicEffect.isAppliedOnce |
If set, the magic effect is applied fully on cast, rather than being continuously applied over the effect's duration. For example, chameleon is applied once, while fire damage is continuously applied for the duration. |
| MagicEffect.name |
Localized name of the effect |
| MagicEffect.nonRecastable |
If set, this effect cannot be re-applied until it has ended. This is used by bound equipment spells. |
| MagicEffect.particle |
Identifier of the particle texture |
| MagicEffect.school |
Skill ID that is this effect's school |
Type MagicEffectId
Type MagicEffectWithParams
| MagicEffectWithParams.affectedAttribute |
Optional attribute ID |
| MagicEffectWithParams.affectedSkill |
Optional skill ID |
| MagicEffectWithParams.area | |
| MagicEffectWithParams.duration | |
| MagicEffectWithParams.effect | |
| MagicEffectWithParams.id |
ID of the associated #MagicEffect |
| MagicEffectWithParams.index |
Index of this effect within the original list of #MagicEffectWithParams of the spell/enchantment/potion this effect came from. |
| MagicEffectWithParams.magnitudeMax | |
| MagicEffectWithParams.magnitudeMin | |
| MagicEffectWithParams.range |
Type MagicSchoolData
| MagicSchoolData.areaSound |
VFS path to the area sound |
| MagicSchoolData.boltSound |
VFS path to the bolt sound |
| MagicSchoolData.castSound |
VFS path to the cast sound |
| MagicSchoolData.failureSound |
VFS path to the failure sound |
| MagicSchoolData.hitSound |
VFS path to the hit sound |
| MagicSchoolData.name |
Human-readable name |
Type ObjectOwner
| ObjectOwner.factionId |
Faction who owns the object (nil if missing). Global and self scripts can set the value. |
| ObjectOwner.factionRank |
Rank required to be allowed to pick up the object ( |
| ObjectOwner.recordId |
NPC who owns the object (nil if missing). Global and self scripts can set the value. |
Type PathGrid
| PathGrid:getPoints() |
Get all points in this path grid. |
Type PathGridPoint
| PathGridPoint.autoGenerated |
True if this node was automatically generated in the editor. |
| PathGridPoint.connections |
A list of points connected to this point. |
| PathGridPoint.relativePosition |
The point's position relative to the cell's origin. An exterior cell's origin is its southwest corner. |
Type RegionRecord
| RegionRecord.id |
Region ID |
| RegionRecord.mapColor |
Editor map color for this region. |
| RegionRecord.name |
Region display name |
| RegionRecord.records | |
| RegionRecord.sleepList |
A leveled creature list used when sleeping outdoors in this region |
| RegionRecord.sounds |
A read-only list of ambient sound references for this region. Each reference includes a chance and a resolved link to the full sound record. |
| RegionRecord.weatherProbabilities |
A table mapping WeatherRecord.recordIds to their probability (0–100), should sum to 100.
Valid weather ids include:
|
Type RegionSoundRef
| RegionSoundRef.chance |
Multiplicative percentage used to determine whether to play the sound |
| RegionSoundRef.soundId |
Sound record ID |
Type Skill
| Skill.record(recordId) |
Returns a read-only #SkillRecord |
| Skill.records |
A read-only list of all #SkillRecords in the world database, may be indexed by recordId. Implements iterables#List of #SkillRecord. |
Type SkillRecord
| SkillRecord.attribute |
The id of the skill's governing attribute |
| SkillRecord.description |
Human-readable description |
| SkillRecord.icon |
VFS path to the icon |
| SkillRecord.id |
Record id |
| SkillRecord.name |
Human-readable name |
| SkillRecord.school |
Optional magic school |
| SkillRecord.skillGain |
Table of the 4 possible skill gain values. See SkillProgression#SkillUseType. |
| SkillRecord.specialization |
Skill specialization. Either combat, magic, or stealth. |
Type Sound
| Sound.isEnabled() |
Checks if sound system is enabled (any functions to play sounds are no-ops when it is disabled). |
| Sound.isSayActive(object) |
Check if an animated voiceover is playing |
| Sound.isSoundFilePlaying(fileName, object) |
Check if sound file is playing on given object |
| Sound.isSoundPlaying(soundId, object) |
Check if sound is playing on given object |
| Sound.playSound3d(soundId, object, options) |
Play a 3D sound, attached to object In local scripts can be used only on self. |
| Sound.playSoundFile3d(fileName, object, options) |
Play a 3D sound file, attached to object In local scripts can be used only on self. |
| Sound.records |
List of all #SoundRecords. |
| Sound.say(fileName, object, text) |
Play an animated voiceover. |
| Sound.stopSay(fileName, object) |
Stop an animated voiceover In local scripts can be used only on self. |
| Sound.stopSound3d(soundId, object) |
Stop a 3D sound, attached to object In local scripts can be used only on self. |
| Sound.stopSoundFile3d(fileName, object) |
Stop a 3D sound file, attached to object In local scripts can be used only on self. |
Type SoundRecord
| SoundRecord.fileName |
Normalized path to sound file in VFS |
| SoundRecord.id |
Sound id |
| SoundRecord.maxRange |
Raw maximal range value, from 0 to 255 |
| SoundRecord.minRange |
Raw minimal range value, from 0 to 255 |
| SoundRecord.volume |
Raw sound volume, from 0 to 255 |
Type Spell
| Spell.alwaysSucceedFlag |
If set, the spell should ignore skill checks and always succeed. |
| Spell.autocalcFlag |
If set, the casting cost should be computed based on the effect list rather than read from the cost field |
| Spell.cost | |
| Spell.effects |
The effects (#MagicEffectWithParams) of the spell |
| Spell.id |
Spell id |
| Spell.name |
Spell name |
| Spell.starterSpellFlag |
If set, the spell can be selected as a player's starting spell. |
| Spell.type |
Type SpellRange
| SpellRange.Self |
Applied on self |
| SpellRange.Target |
Ranged spell |
| SpellRange.Touch |
On touch |
Type SpellType
| SpellType.Ability |
Innate 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 Spells
| Spells.records |
List of all #Spells. |
Type Stats
| Stats.Attribute |
#Attribute functions |
| Stats.Skill |
#Skill functions |
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 Weather
| Weather.changeWeather(regionId, The) |
Change the weather |
| Weather.getCurrent() |
Get the current weather |
| Weather.getCurrentStormDirection() |
Get the current storm direction taking weather transition into account. |
| Weather.getCurrentSunLightDirection() |
Get the current direction of the light of the sun. |
| Weather.getCurrentSunPercentage() |
Get the current sun percentage taking weather transition into account. |
| Weather.getCurrentSunVisibility() |
Get the current sun visibility taking weather transition into account. |
| Weather.getCurrentWindSpeed() |
Get the current wind speed taking weather transition into account. |
| Weather.getNext() |
Get the next weather if any |
| Weather.getTransition() |
Get current weather transition value |
| Weather.records |
List of all #WeatherRecords. |
Type WeatherRecord
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. See the actual value at the top of the page.
- #ContentFiles core.contentFiles
-
#ContentFiles: functions working with the list of currently loaded content files.
- #Dialogue core.dialogue
-
#Dialogue: Dialogue
- #Factions core.factions
-
#Factions: Factions
- core.getFormId(contentFile, index)
-
Construct FormId string from content file name and the index in the file.
In ESM3 games (e.g. Morrowind) FormIds are used to reference game objects. In ESM4 games (e.g. Skyrim) FormIds are used both for game objects and as record ids.
Parameters
-
#string contentFile: -
#number index:
Return value
#string:
Usages
if obj.recordId == core.getFormId('Skyrim.esm', 0x4d7da) then ... end-- In ESM3 content files (e.g. Morrowind) ids are human-readable strings obj.owner.factionId = 'blades' -- In ESM4 (e.g. Skyrim) ids should be constructed using `core.getFormId`: obj.owner.factionId = core.getFormId('Skyrim.esm', 0x72834)-- local scripts local obj = nearby.getObjectByFormId(core.getFormId('Morrowind.esm', 128964))-- global scripts local obj = world.getObjectByFormId(core.getFormId('Morrowind.esm', 128964))
-
- core.getGMST(setting)
-
Get a GMST setting from content files.
Parameter
-
#string setting: Setting name
Return value
#any:
-
- core.getGameDifficulty()
-
The game's difficulty setting.
Return value
#number:
- core.getGameTime()
-
Game time in seconds.
Return value
#number:
- core.getGameTimeScale()
-
The scale of game time relative to simulation time.
Return value
#number:
- core.getRealFrameDuration()
-
Frame duration in seconds.
Not available in global scripts.
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.
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 messagesIf 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
- #MWScript core.mwscripts
-
#MWScripts: MWScripts
- core.quit()
-
Terminates the game and quits to the OS.
Should be used only for testing purposes.
- #Regions core.regions
-
#Regions: Regions
- core.sendGlobalEvent(eventName, eventData)
-
Send an event to global scripts.
Note: in menu scripts, errors if the game is not running (check openmw.menu#menu.getState)
Parameters
-
#string eventName: -
eventData:
-
- #Sound core.sound
-
#Sound: Sounds and Speech
- #Stats core.stats
-
#Stats: stats
- #Weather core.weather
-
#Weather: Weather
Type ActiveEffect
Field(s)
- #string ActiveEffect.affectedAttribute
-
Optional attribute ID
- #string ActiveEffect.affectedSkill
-
Optional skill ID
- #string ActiveEffect.id
-
Effect id string
- #number ActiveEffect.magnitude
-
current magnitude of the effect. Will be set to 0 when effect is removed or expires.
- #number ActiveEffect.magnitudeBase
- #number ActiveEffect.magnitudeModifier
- #string ActiveEffect.name
-
Localized name of the effect
Type ActiveSpell
Field(s)
- #number ActiveSpell.activeSpellId
-
A number uniquely identifying this active spell within the affected actor's list of active spells.
- #boolean ActiveSpell.affectsBaseValues
-
If set, this spell affects the base values of affected stats, rather than modifying current values.
- #GameObject ActiveSpell.caster
-
The caster object, or nil if the spell has no defined caster
- #list<#ActiveSpellEffect> ActiveSpell.effects
-
The active effects (#ActiveSpellEffect) of this spell.
- #boolean ActiveSpell.fromEquipment
-
If set, this spell is tied to an equipped item and can only be ended by unequipping the item.
- #string ActiveSpell.id
-
Record id of the spell or item used to cast the spell
- #GameObject ActiveSpell.item
-
The enchanted item used to cast the spell, or nil if the spell was not cast from an enchanted item. Note that if the spell was cast for a single-use enchantment such as a scroll, this will be nil.
- #string ActiveSpell.name
-
The spell or item display name
- #boolean ActiveSpell.stackable
-
If set, this spell can be applied multiple times. If not set, the same spell can only be applied once from the same source (where source is determined by caster + item). In vanilla rules, consumables are stackable while spells and enchantments are not.
- #boolean ActiveSpell.temporary
-
If set, this spell effect is temporary and should end on its own. Either after a single application or after its duration has run out.
Type ActiveSpellEffect
Field(s)
- #string ActiveSpellEffect.affectedAttribute
-
Optional attribute ID
- #string ActiveSpellEffect.affectedSkill
-
Optional skill ID
- #number ActiveSpellEffect.duration
-
Total duration in seconds of this spell effect, should not be confused with remaining duration. Or nil if the effect is not temporary.
- #number ActiveSpellEffect.durationLeft
-
Remaining duration in seconds of this spell effect, or nil if the effect is not temporary.
- #string ActiveSpellEffect.id
-
Magic effect id
- #number ActiveSpellEffect.index
-
Index of this effect within the original list of #MagicEffectWithParams of the spell/enchantment/potion this effect came from.
- #number ActiveSpellEffect.magnitudeThisFrame
-
The magnitude of the effect in the current frame. This will be a new random number between minMagnitude and maxMagnitude every frame. Or nil if the effect has no magnitude.
- #number ActiveSpellEffect.maxMagnitude
-
The maximum magnitude of this effect, or nil if the effect has no magnitude.
- #number ActiveSpellEffect.minMagnitude
-
The minimum magnitude of this effect, or nil if the effect has no magnitude.
- #string ActiveSpellEffect.name
-
Localized name of the effect
Type Attribute
core.stats.Attribute
Usages
local record = core.stats.Attribute.records['example_recordid']local record = core.stats.Attribute.records[1]
Field(s)
- Attribute.record(recordId)
-
Returns a read-only #AttributeRecord
Parameter
-
#string recordId:
Return value
-
- #list<#AttributeRecord> Attribute.records
-
A read-only list of all #AttributeRecords in the world database, may be indexed by recordId. Implements iterables#List of #AttributeRecord.
Type AttributeRecord
Field(s)
- #string AttributeRecord.description
-
Human-readable description
- #string AttributeRecord.icon
-
VFS path to the icon
- #string AttributeRecord.id
-
Record id
- #string AttributeRecord.name
-
Human-readable name
Type Cell
A cell of the game world.
Field(s)
- Cell:getAll(type)
-
Get all objects of given type from the cell; Only available from global scripts.
Parameter
-
type: (optional) object type (see openmw.types#types)
Return value
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.
- #string Cell.id
-
Unique record ID of the cell, based on cell name for interiors and the worldspace for exteriors, or the formID of the cell for ESM4 cells.
- #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
-
#GameObject object:
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 weather).
- #string Cell.name
-
Name of the cell (can be empty string).
- #PathGrid Cell.pathGrid
-
The cell's #PathGrid if it has one.
- #string Cell.region
-
Region of the cell.
- #number Cell.waterLevel
-
The water level of the cell. (nil if cell has no water).
- #string Cell.worldSpaceId
-
Id of the world space.
Type ContentFiles
Functions working with the list of currently loaded content files.
Field(s)
- ContentFiles.has(contentFile)
-
Check if the content file with given name present in the load order.
Parameter
-
#string contentFile:
Return value
#boolean:
-
- ContentFiles.indexOf(contentFile)
-
Return the index of a specific content file in the load order (or
nilif there is no such content file).Parameter
-
#string contentFile:
Return value
#number:
-
- #list<#string> ContentFiles.list
-
The current load order (list of content file names).
Type Dialogue
Field(s)
- Dialogue.greeting
-
#DialogueRecords functions for greeting read-only records.
Usages
--print ids of all greeting records for _, greetingRecord in pairs(core.dialogue.greeting.records) do print(greetingRecord.id) end--print all NPC lines for "greeting 0" for idx, greetingInfo in pairs(core.dialogue.greeting.records["greeting 0"].infos) do print(idx, greetingInfo.text) end
- Dialogue.journal
-
#DialogueRecords functions for journal (quest) read-only records.
Usages
--print the name of the record, which is a capitalized version of its id print(core.dialogue.journal.records["ms_fargothring"].name) -- MS_FargothRing--print ids of all journal records for _, journalRecord in pairs(core.dialogue.journal.records) do print(journalRecord.id) end--print quest names for all quests the player has inside a player script for _, quest in pairs(types.Player.quests(self)) do print(quest.id, core.dialogue.journal.records[quest.id].questName) end
- Dialogue.persuasion
-
#DialogueRecords functions for persuasion read-only records.
Usages
--print ids of all persuasion records for _, persuasionRecord in pairs(core.dialogue.persuasion.records) do print(persuasionRecord.id) end--print all NPC lines for "admire success" for idx, persuasionInfo in pairs(core.dialogue.persuasion.records["admire success"].infos) do print(idx, persuasionInfo.text) end
- Dialogue.topic
-
#DialogueRecords functions for topic read-only records.
Usages
--print ids of all topic records for _, topicRecord in pairs(core.dialogue.topic.records) do print(topicRecord.id) end--print all NPC lines for "vivec" for idx, topicInfo in pairs(core.dialogue.topic.records["vivec"].infos) do print(idx, topicInfo.text) end
- Dialogue.voice
-
#DialogueRecords functions for voice read-only records.
Usages
--print ids of all voice records for _, voiceRecord in pairs(core.dialogue.voice.records) do print(voiceRecord.id) end--print all NPC lines & sounds for "flee" for idx, voiceInfo in pairs(core.dialogue.voice.records["flee"].infos) do print(idx, voiceInfo.text, voiceInfo.sound) end
Type DialogueRecord
Depending on which store this read-only dialogue record is from, it may either be a journal, topic, greeting, persuasion or voice.
Usages
local journalId = core.dialogue.journal.records['A2_4_MiloGone'].id -- "a2_4_milogone"local journalName = core.dialogue.journal.records['A2_4_MiloGone'].name -- "A2_4_MiloGone"local questName = core.dialogue.journal.records['A2_4_MiloGone'].questName -- "Mehra Milo and the Lost Prophecies"
Field(s)
- #string DialogueRecord.id
-
Record identifier
- #list<#DialogueRecordInfo> DialogueRecord.infos
-
A read-only list containing all #DialogueRecordInfos for this record, in order.
- #string DialogueRecord.name
-
Same as id, but with upper cases preserved.
- #string DialogueRecord.questName
-
Non-nil only for journal records with available value. Holds the quest name for this journal entry. Same info may be available under
infos[1].textas well, but this variable is made for convenience.
Type DialogueRecordInfo
Holds the read-only data for one of many info entries inside a dialogue record.
Depending on the type of the dialogue record (journal, topic, greeting, persuasion or voice), it could be, for example, a single journal entry or a NPC dialogue line.
Usages
--Variable `aa` below is "Congratulations, %PCName. You are now %PCName the %NextPCRank." in vanilla MW: local aa = core.dialogue.topic.records['advancement'].infos[100].text--Variable `bb` below is "sound/vo/a/f/fle_af003.mp3" in vanilla MW: local bb = core.dialogue.voice.records['flee'].infos[149].sound
Field(s)
- #string DialogueRecordInfo.filterActorClass
-
Speaker class allowing for this info entry to appear.
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria.
- #number DialogueRecordInfo.filterActorDisposition
-
Minimum speaker disposition allowing for this info entry to appear.
Always nil for journal records. Otherwise is a nonnegative number, with the zero value representing no conditions, i.e. no filtering applied using these criteria.
- #string DialogueRecordInfo.filterActorFaction
-
Faction of which the speaker must be a member for this info entry to appear.
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria. Can return an empty string - this means that the actor must not be a member of any faction for this filtering to apply.
- #number DialogueRecordInfo.filterActorFactionRank
-
Minimum speaker's rank in their faction allowing for this info entry to appear.
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria. Rank index starts from 1, matching the value in openmw_types#NPC.getFactionRank
- #string DialogueRecordInfo.filterActorGender
-
Speaker gender allowing for this info entry to appear: "male" or "female".
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria.
- #string DialogueRecordInfo.filterActorId
-
Speaker ID allowing for this info entry to appear.
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria.
- #string DialogueRecordInfo.filterActorRace
-
Speaker race allowing for this info entry to appear.
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria.
- #string DialogueRecordInfo.filterPlayerCell
-
Cell name prefix of location where the player must be for this info entry to appear.
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria. "Prefix" means that the cell's name starting with this value shall pass the filtering. For example:
filterPlayerCellbeing "Seyda Neen" does apply to the cell "Seyda Neen, Fargoth's House".
- #string DialogueRecordInfo.filterPlayerFaction
-
Faction of which the player must be a member for this info entry to appear.
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria.
- #number DialogueRecordInfo.filterPlayerFactionRank
-
Minimum player's rank in their faction allowing for this info entry to appear.
Always nil for journal records. Otherwise the nil value represents no conditions, i.e. no filtering applied using these criteria. Rank index starts from 1, matching the value in openmw_types#NPC.getFactionRank
- #string DialogueRecordInfo.id
-
Identifier for this info entry. Is unique only within the #DialogueRecord it belongs to.
- #boolean DialogueRecordInfo.isQuestFinished
-
True if this info entry has the "Finished" flag checked.
Non-nil only for journal records.
- #boolean DialogueRecordInfo.isQuestName
-
True if this info entry has the "Quest Name" flag checked.
Non-nil only for journal records. If true, then the #DialogueRecord, to which this info entry belongs, should have this info entry's DialogueRecordInfo.text value available in its DialogueRecord.questName.
- #boolean DialogueRecordInfo.isQuestRestart
-
True if this info entry has the "Restart" flag checked.
Non-nil only for journal records.
- #number DialogueRecordInfo.questStage
-
Quest stage (same as in openmw_types#PlayerQuest.stage) this info entry is associated with.
Non-nil only for journal records.
- #string DialogueRecordInfo.resultScript
-
MWScript (full script text) executed when this info is chosen.
Always nil for journal records or if there is no value set.
- #string DialogueRecordInfo.sound
-
Sound file path for this info entry.
Always nil for journal records or if there is no sound set.
- #string DialogueRecordInfo.text
-
Text associated with this info entry.
Type DialogueRecords
Field(s)
- #list<#DialogueRecord> DialogueRecords.records
-
A read-only list of all #DialogueRecords in the world database, may be indexed by recordId, which doesn't have to be lowercase.
Implements iterables#List of #DialogueRecord.
Usages
local record = core.dialogue.journal.records['ms_fargothring']local record = core.dialogue.journal.records['MS_FargothRing']local record = core.dialogue.journal.records[1]local record = core.dialogue.topic.records[1]local record = core.dialogue.topic.records['background']local record = core.dialogue.greeting.records[1]local record = core.dialogue.greeting.records['greeting 0']local record = core.dialogue.persuasion.records[1]local record = core.dialogue.persuasion.records['admire success']local record = core.dialogue.voice.records[1]local record = core.dialogue.voice.records["flee"]
Type Effects
Field(s)
- #map<#number,#MagicEffect> Effects.records
-
Map from #MagicEffectId to #MagicEffect
Usages
-- Print all harmful effects for _, effect in pairs(core.magic.effects.records) do if effect.harmful then print(effect.name) end end-- Look up the record of a specific effect and print its icon local mgef = core.magic.effects.records[core.magic.EFFECT_TYPE.Reflect] print('Reflect Icon: '..tostring(mgef.icon))
Type Enchantment
Usage
-- Getting the enchantment of an arbitrary item, if it has one
local function getRecord(item)
if item.type and item.type.record then
return item.type.record(item)
end
return nil
end
local function getEnchantment(item)
local record = getRecord(item)
if record and record.enchant then
return core.magic.enchantments.records[record.enchant]
end
return nil
end
Field(s)
- #boolean Enchantment.autocalcFlag
-
If set, the casting cost should be computed based on the effect list rather than read from the cost field
- #number Enchantment.charge
-
Charge capacity. Should not be confused with current charge.
- #number Enchantment.cost
- #list<#MagicEffectWithParams> Enchantment.effects
-
The effects (#MagicEffectWithParams) of the enchantment
- #string Enchantment.id
-
Enchantment id
- #number Enchantment.type
Type EnchantmentType
core.magic.ENCHANTMENT_TYPE
Field(s)
- #number EnchantmentType.CastOnStrike
-
Enchantment is cast on strike, if there is enough charge.
- #number EnchantmentType.CastOnUse
-
Enchantment is cast when used, if there is enough charge.
- #number EnchantmentType.CastOnce
-
Enchantment can be cast once, destroying the enchanted item.
- #number EnchantmentType.ConstantEffect
-
Enchantment is always active when equipped.
Type Enchantments
Field(s)
- #list<#Enchantment> Enchantments.records
-
A read-only list of all #Enchantment records in the world database, may be indexed by recordId.
Implements iterables#List and iterables#Map of #Enchantment.
Usages
local enchantment = core.magic.enchantments.records['marara's boon'] -- get by idlocal enchantment = core.magic.enchantments.records[1] -- get by index-- Print all enchantments with constant effect for _, ench in pairs(core.magic.enchantments.records) do if ench.type == core.magic.ENCHANTMENT_TYPE.ConstantEffect then print(ench.id) end end
Type FactionRank
Faction rank data record
Field(s)
- #list<#number> FactionRank.attributeValues
-
Attributes values required to get this rank.
- #number FactionRank.factionReaction
-
Reaction of faction members if player is in this faction.
- #number FactionRank.favouredSkillValue
-
Secondary skill value required to get this rank.
- #string FactionRank.name
-
Faction name Rank display name
- #number FactionRank.primarySkillValue
-
Primary skill value required to get this rank.
Type FactionRecord
Faction data record
Field(s)
- #list<#string> FactionRecord.attributes
-
A read-only list containing IDs of attributes to advance ranks in the faction.
- #boolean
-
If true, the faction won't show in the player's skills menu
- #string FactionRecord.id
-
Faction id
- #string FactionRecord.name
-
Faction name
- #list<#FactionRank> FactionRecord.ranks
-
A read-only list containing data for all ranks in the faction, in order.
- #map<#string,#number> FactionRecord.reactions
-
A read-only map containing reactions of other factions to this faction.
- #list<#string> FactionRecord.skills
-
A read-only list containing IDs of skills to advance ranks in the faction.
Type Factions
Field(s)
- #list<#FactionRecord> Factions.records
-
A read-only list of all #FactionRecords in the world database.
Usages
local record = core.factions.records['example_recordid']local record = core.factions.records[1]
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
cellis nil.
- #string GameObject.contentFile
-
Lower cased file name of the content file that defines this object; nil for dynamically created objects.
- #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 world coordinates.
Return value
- #string GameObject.globalVariable
-
Global Variable associated with this object(read only).
- 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
-
#any dest: #Inventory or #GameObject
Usages
item:moveInto(types.Actor.inventory(actor))item:moveInto(types.Container.content(container))item:moveInto(container)
-
- #ObjectOwner GameObject.owner
-
Ownership information
- #GameObject GameObject.parentContainer
-
Container or actor that contains (or has in inventory) this object. It is nil if the object is in a cell.
- 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
addScriptCan be called only from a global script.Parameter
-
#string scriptPath: Path to the script in OpenMW virtual filesystem.
-
- openmw.util#Transform GameObject.rotation
-
Object rotation.
- #number GameObject.scale
-
Object scale.
- GameObject:sendEvent(eventName, eventData)
-
Send local event to the object.
Parameters
-
#string eventName: -
eventData:
-
- GameObject:setScale(scale)
-
Sets the object's scale.
Can be called only from a global script.
Parameter
-
#number scale: Scale desired in game.
-
- GameObject:split(count)
-
Splits a stack of items.
Original stack is reduced by
count. Returns a new stack withcountitems. Can be called only from a global script.Parameter
-
#number count: The number of items to return.
Return value
Usage
-- take 50 coins from `money` and put to the container `cont` money:split(50):moveInto(types.Container.content(cont)) -
- openmw.util#Vector3 GameObject.startingPosition
-
The object original position
- openmw.util#Transform GameObject.startingRotation
-
The object original rotation
- 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 usingposition. -
openmw.util#Vector3 position: New position. -
#TeleportOptions options: (optional) Either table #TeleportOptions or openmw.util#Transform 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
Usage
inventory:find('gold_001') -
- Inventory:findAll(recordId)
-
Get all items with given recordId from the inventory.
Parameter
-
#string recordId:
Return value
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
-
type: (optional) items type (see openmw.types#types)
Return value
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) -
- Inventory:isResolved()
-
Checks if the inventory has a resolved item list.
Return value
#boolean:
Usage
inventory:isResolved()
- Inventory:resolve()
-
Will resolve the inventory, filling it with levelled items if applicable, making its contents permanent.
Must be used in a global script.
Usage
inventory:resolve()
Type Land
Field(s)
- Land.getHeightAt(position, cellOrId)
-
Get the terrain height at a given location.
Parameters
-
openmw.util#Vector3 position: -
#any cellOrId: cell or cell id in their exterior world space to query
Return value
#number:
-
- Land.getTextureAt(position, cellOrId)
-
Get the terrain texture at a given location.
As textures are blended and multiple textures can be at one specific position the texture whose center is closest to the position will be returned.
Parameters
-
openmw.util#Vector3 position: -
#any cellOrId: cell or cell id in their exterior world space to query
Return values
-
#nil, #string: Texture path or nil if one isn't defined
-
#nil, #string: Plugin name or nil if failed to retrieve the texture
-
Type MWScript
Type MWScriptRecord
MWScript data record
Field(s)
- #string MWScriptRecord.id
-
MWScript id
- #string MWScriptRecord.text
-
MWScript content
Type MWScripts
Field(s)
- #list<#MWScriptRecord> MWScripts.records
-
A read-only list of all #MWScriptRecords in the world database.
Usages
local record = core.mwscripts.records['example_recordid']local record = core.mwscripts.records[1]
Type Magic
Field(s)
- #MagicEffectId Magic.EFFECT_TYPE
-
Possible #MagicEffectId values
- #EnchantmentType Magic.ENCHANTMENT_TYPE
-
Possible #EnchantmentType values
- #SpellRange Magic.RANGE
-
Possible #SpellRange values
- #SpellType Magic.SPELL_TYPE
-
Possible #SpellType values
- #Effects Magic.effects
-
#Effects: Magic Effects
- #Enchantments Magic.enchantments
-
#Enchantments: Enchantments
- #Spells Magic.spells
-
#Spells: Spells
Type MagicEffect
Field(s)
- #string MagicEffect.areaSound
-
Identifier of the sound used for AOE spells
- #string MagicEffect.areaStatic
-
Identifier of the vfx static used for AOE spells
- #number MagicEffect.baseCost
- #string MagicEffect.bolt
-
Identifier of the projectile used for ranged spells
- #string MagicEffect.boltSound
-
Identifier of the projectile sound used for ranged spells
- #string MagicEffect.castSound
-
Identifier of the sound used for casting
- #string MagicEffect.castStatic
-
Identifier of the vfx static used for casting
- #boolean MagicEffect.casterLinked
-
If set, it is implied the magic effect links back to the caster in some way and should end immediately or never be applied if the caster dies or is not an actor.
- #boolean MagicEffect.continuousVfx
-
Whether the magic effect's vfx should loop or not
- #boolean MagicEffect.harmful
-
If set, the effect is considered harmful and should elicit a hostile reaction from affected NPCs.
- #boolean MagicEffect.hasDuration
-
If set, the magic effect has a duration. As an example, divine intervention has no duration while fire damage does.
- #boolean MagicEffect.hasMagnitude
-
If set, the magic effect depends on a magnitude. As an example, cure common disease has no magnitude while chameleon does.
- #string MagicEffect.hitSound
-
Identifier of the sound used on hit
- #string MagicEffect.hitStatic
-
Identifier of the vfx static used on hit
- #string MagicEffect.icon
-
Effect Icon Path
- #string MagicEffect.id
-
Effect ID
- #boolean MagicEffect.isAppliedOnce
-
If set, the magic effect is applied fully on cast, rather than being continuously applied over the effect's duration. For example, chameleon is applied once, while fire damage is continuously applied for the duration.
- #string MagicEffect.name
-
Localized name of the effect
- #boolean MagicEffect.nonRecastable
-
If set, this effect cannot be re-applied until it has ended. This is used by bound equipment spells.
- #string MagicEffect.particle
-
Identifier of the particle texture
- #string MagicEffect.school
-
Skill ID that is this effect's school
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)
- #string MagicEffectWithParams.affectedAttribute
-
Optional attribute ID
- #string MagicEffectWithParams.affectedSkill
-
Optional skill ID
- #number MagicEffectWithParams.area
- #number MagicEffectWithParams.duration
- #string MagicEffectWithParams.id
-
ID of the associated #MagicEffect
- #number MagicEffectWithParams.index
-
Index of this effect within the original list of #MagicEffectWithParams of the spell/enchantment/potion this effect came from.
- #number MagicEffectWithParams.range
Type MagicSchoolData
Field(s)
- #string MagicSchoolData.areaSound
-
VFS path to the area sound
- #string MagicSchoolData.boltSound
-
VFS path to the bolt sound
- #string MagicSchoolData.castSound
-
VFS path to the cast sound
- #string MagicSchoolData.failureSound
-
VFS path to the failure sound
- #string MagicSchoolData.hitSound
-
VFS path to the hit sound
- #string MagicSchoolData.name
-
Human-readable name
Type ObjectList
List of GameObjects.
Implements iterables#List of #GameObject
ObjectList is a list of #GameObject.
Type ObjectOwner
Object owner information
Field(s)
- #string ObjectOwner.factionId
-
Faction who owns the object (nil if missing). Global and self scripts can set the value.
- #number ObjectOwner.factionRank
-
Rank required to be allowed to pick up the object (
nilif any rank is allowed). Global and self scripts can set the value.
- #string ObjectOwner.recordId
-
NPC who owns the object (nil if missing). Global and self scripts can set the value.
Type PathGrid
A cell's path grid marking traversable paths.
Field(s)
- PathGrid:getPoints()
-
Get all points in this path grid.
Return value
#list<#PathGridPoint>: A list of #PathGridPoints.
Type PathGridPoint
A point in a cell's path grid.
Field(s)
- #boolean PathGridPoint.autoGenerated
-
True if this node was automatically generated in the editor.
- #list<#PathGridPoint> PathGridPoint.connections
-
A list of points connected to this point.
- openmw.util#Vector3 PathGridPoint.relativePosition
-
The point's position relative to the cell's origin. An exterior cell's origin is its southwest corner.
Type RegionRecord
A read-only list of all #RegionRecords in the world database.
Usages
local record = core.regions.records['bitter coast region']local record = core.regions.records[1] - Region data recordprint(region.weatherProbabilities["rain"])
Field(s)
- #string RegionRecord.id
-
Region ID
- openmw.util#Color RegionRecord.mapColor
-
Editor map color for this region.
- #string RegionRecord.name
-
Region display name
- #string RegionRecord.sleepList
-
A leveled creature list used when sleeping outdoors in this region
- #list<#RegionSoundRef> RegionRecord.sounds
-
A read-only list of ambient sound references for this region. Each reference includes a chance and a resolved link to the full sound record.
- #table RegionRecord.weatherProbabilities
-
A table mapping WeatherRecord.recordIds to their probability (0–100), should sum to 100. Valid weather ids include:
"clear","cloudy","foggy","overcast","rain","thunderstorm","ashstorm","blight","snow","blizzard"
Type RegionSoundRef
Region sound reference
Field(s)
- #number RegionSoundRef.chance
-
Multiplicative percentage used to determine whether to play the sound
- #string RegionSoundRef.soundId
-
Sound record ID
Type Regions
Type Skill
core.stats.Skill
Usages
local record = core.stats.Skill.records['example_recordid']local record = core.stats.Skill.records[1]
Field(s)
- Skill.record(recordId)
-
Returns a read-only #SkillRecord
Parameter
-
#string recordId:
Return value
-
- #list<#SkillRecord> Skill.records
-
A read-only list of all #SkillRecords in the world database, may be indexed by recordId. Implements iterables#List of #SkillRecord.
Type SkillRecord
Field(s)
- #string SkillRecord.attribute
-
The id of the skill's governing attribute
- #string SkillRecord.description
-
Human-readable description
- #string SkillRecord.icon
-
VFS path to the icon
- #string SkillRecord.id
-
Record id
- #string SkillRecord.name
-
Human-readable name
- #MagicSchoolData SkillRecord.school
-
Optional magic school
- #table SkillRecord.skillGain
-
Table of the 4 possible skill gain values. See SkillProgression#SkillUseType.
- #string SkillRecord.specialization
-
Skill specialization. Either combat, magic, or stealth.
Type Sound
Field(s)
- Sound.isEnabled()
-
Checks if sound system is enabled (any functions to play sounds are no-ops when it is disabled).
It can not be enabled or disabled during runtime.
Return value
#boolean:
Usage
local enabled = core.sound.isEnabled();
- Sound.isSayActive(object)
-
Check if an animated voiceover is playing
Parameter
-
#GameObject object: Object on which we want to check an animated voiceover
Return value
#boolean:
Usage
local isActive = isSayActive(object); -
- Sound.isSoundFilePlaying(fileName, object)
-
Check if sound file is playing on given object
Parameters
-
#string fileName: Path to sound file in VFS -
#GameObject object: Object on which we want to check sound
Return value
#boolean:
Usage
local isPlaying = core.sound.isSoundFilePlaying("Sound\\test.mp3", object); -
- Sound.isSoundPlaying(soundId, object)
-
Check if sound is playing on given object
Parameters
-
#string soundId: ID of Sound record to check -
#GameObject object: Object on which we want to check sound
Return value
#boolean:
Usage
local isPlaying = core.sound.isSoundPlaying("shock bolt", object); -
- Sound.playSound3d(soundId, object, options)
-
Play a 3D sound, attached to object
In local scripts can be used only on self.
Parameters
-
#string soundId: ID of Sound record to play -
#GameObject object: Object to which we attach the sound -
#table options: An optional table with additional optional arguments. Can contain:timeOffset- a floating point number >= 0, to some time (in second) from beginning of sound file (default: 0);volume- a floating point number >= 0, to set a sound volume (default: 1);pitch- a floating point number >= 0, to set a sound pitch (default: 1);loop- a boolean, to set if sound should be repeated when it ends (default: false);
Usage
local params = { timeOffset=0.1, volume=0.3, loop=false, pitch=1.0 }; core.sound.playSound3d("shock bolt", object, params) -
- Sound.playSoundFile3d(fileName, object, options)
-
Play a 3D sound file, attached to object
In local scripts can be used only on self.
Parameters
-
#string fileName: Path to sound file in VFS -
#GameObject object: Object to which we attach the sound -
#table options: An optional table with additional optional arguments. Can contain:timeOffset- a floating point number >= 0, to some time (in second) from beginning of sound file (default: 0);volume- a floating point number >= 0, to set a sound volume (default: 1);pitch- a floating point number >= 0, to set a sound pitch (default: 1);loop- a boolean, to set if sound should be repeated when it ends (default: false);
Usage
local params = { timeOffset=0.1, volume=0.3, loop=false, pitch=1.0 }; core.sound.playSoundFile3d("Sound\\test.mp3", object, params) -
- #list<#SoundRecord> Sound.records
-
List of all #SoundRecords.
Usages
local sound = core.sound.records['Ashstorm'] -- get by idlocal sound = core.sound.records[1] -- get by index-- Print all sound files paths for _, sound in pairs(core.sound.records) do print(sound.fileName) end
- Sound.say(fileName, object, text)
-
Play an animated voiceover.
In local scripts can be used only on self.
Parameters
-
#string fileName: Path to sound file in VFS -
#GameObject object: Object on which we want to play an animated voiceover -
#string text: Subtitle text (optional)
Usages
-- play voiceover for object and print messagebox core.sound.say("Sound\\Vo\\Misc\\voice.mp3", object, "Subtitle text")-- play voiceover for object, without messagebox core.sound.say("Sound\\Vo\\Misc\\voice.mp3", object)
-
- Sound.stopSay(fileName, object)
-
Stop an animated voiceover
In local scripts can be used only on self.
Parameters
-
#string fileName: Path to sound file in VFS -
#GameObject object: Object on which we want to stop an animated voiceover
Usage
core.sound.stopSay(object); -
- Sound.stopSound3d(soundId, object)
-
Stop a 3D sound, attached to object
In local scripts can be used only on self.
Parameters
-
#string soundId: ID of Sound record to stop -
#GameObject object: Object on which we want to stop sound
Usage
core.sound.stopSound("shock bolt", object); -
- Sound.stopSoundFile3d(fileName, object)
-
Stop a 3D sound file, attached to object
In local scripts can be used only on self.
Parameters
-
#string fileName: Path to sound file in VFS -
#GameObject object: Object on which we want to stop sound
Usage
core.sound.stopSoundFile("Sound\\test.mp3", object); -
Type SoundRecord
Field(s)
- #string SoundRecord.fileName
-
Normalized path to sound file in VFS
- #string SoundRecord.id
-
Sound id
- #number SoundRecord.maxRange
-
Raw maximal range value, from 0 to 255
- #number SoundRecord.minRange
-
Raw minimal range value, from 0 to 255
- #number SoundRecord.volume
-
Raw sound volume, from 0 to 255
Type Spell
Field(s)
- #boolean Spell.alwaysSucceedFlag
-
If set, the spell should ignore skill checks and always succeed.
- #boolean Spell.autocalcFlag
-
If set, the casting cost should be computed based on the effect list rather than read from the cost field
- #number Spell.cost
- #list<#MagicEffectWithParams> Spell.effects
-
The effects (#MagicEffectWithParams) of the spell
- #string Spell.id
-
Spell id
- #string Spell.name
-
Spell name
- #boolean Spell.starterSpellFlag
-
If set, the spell can be selected as a player's starting spell.
- #number Spell.type
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
-
Innate 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 Spells
Field(s)
- #list<#Spell> Spells.records
-
List of all #Spells.
Usages
local spell = core.magic.spells.records['thunder fist'] -- get by idlocal spell = core.magic.spells.records[1] -- get by index-- Print all powers for _, spell in pairs(core.magic.spells.records) do if spell.type == core.magic.SPELL_TYPE.Power then print(spell.name) end end
Type Stats
Field(s)
- #Attribute Stats.Attribute
-
#Attribute functions
- #Skill Stats.Skill
-
#Skill functions
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#Transform TeleportOptions.rotation
-
New rotation; if missing, then the current rotation is used.
Type Weather
Field(s)
- Weather.changeWeather(regionId, The)
-
Change the weather
Parameters
-
#string regionId: -
#WeatherData The: weather to change to
-
- Weather.getCurrent()
-
Get the current weather
Return value
- Weather.getCurrentStormDirection()
-
Get the current storm direction taking weather transition into account.
Return value
- Weather.getCurrentSunLightDirection()
-
Get the current direction of the light of the sun.
Return value
- Weather.getCurrentSunPercentage()
-
Get the current sun percentage taking weather transition into account.
Return value
#number:
- Weather.getCurrentSunVisibility()
-
Get the current sun visibility taking weather transition into account.
Return value
#number:
- Weather.getCurrentWindSpeed()
-
Get the current wind speed taking weather transition into account.
Return value
#number:
- Weather.getNext()
-
Get the next weather if any
Return value
#any: can be nil
- Weather.getTransition()
-
Get current weather transition value
Return value
#number:
- #list<#WeatherRecord> Weather.records
-
List of all #WeatherRecords.
Usages
local weather = core.weather.records['Cloudy'] -- get by idlocal weather = core.weather.records[1] -- get by index-- Print all storms for _, weather in pairs(core.weather.records) do if weather.isStorm then print(weather.name) end end
Type WeatherData
Type WeatherRecord
Extends #userdata
Weather data
Field(s)
- #table WeatherRecord.ambientColor
-
A table with the keys "sunrise", "day", "sunset" and "night". Each is a openmw.util#Color.
- #string WeatherRecord.ambientLoopSoundID
- #number WeatherRecord.cloudSpeed
- #string WeatherRecord.cloudTexture
- #table WeatherRecord.fogColor
-
A table with the keys "sunrise", "day", "sunset" and "night". Each is a openmw.util#Color.
- #number WeatherRecord.glareView
- #boolean WeatherRecord.isStorm
- #table WeatherRecord.landFogDepth
-
A table with the keys "sunrise", "day", "sunset" and "night"
- #string WeatherRecord.name
- #string WeatherRecord.particleEffect
-
Will return nil if weather has no particleEffect
- #number WeatherRecord.rainDiameter
- #string WeatherRecord.rainEffect
-
Will return nil if weather has no rainEffect
- #number WeatherRecord.rainEntranceSpeed
- #string WeatherRecord.rainLoopSoundID
- #number WeatherRecord.rainMaxHeight
- #number WeatherRecord.rainMaxRaindrops
- #number WeatherRecord.rainMinHeight
- #number WeatherRecord.rainSpeed
- #string WeatherRecord.recordId
- #number WeatherRecord.scriptId
- #table WeatherRecord.skyColor
-
A table with the keys "sunrise", "day", "sunset" and "night". Each is a openmw.util#Color.
- #table WeatherRecord.sunColor
-
A table with the keys "sunrise", "day", "sunset" and "night". Each is a openmw.util#Color.
- #table WeatherRecord.thunderSoundID
-
An array containing the recordIds of the thunder sounds
- #number WeatherRecord.windSpeed