Interface SpellCasting
Basic spell casting interface
Usage
require('openmw.interfaces').SpellCasting
Type SpellCasting
| SpellCasting.addApplyMagicEffectsHandler(handler) |
(Local only) Add a new applyMagicEffects handler for this actor. |
| SpellCasting.applyMagicEffects(options) |
(Local only) Apply new magic effects on this actor. |
| SpellCasting.explodeSpell(spellCast, options) |
(Local and Global) Explodes a spell at the given location |
| SpellCasting.inflict(spellCast, target, range) |
(Local and Global) Inflicts a spell on the target following vanilla rules, such as filtering by range, and policing recastable effects. |
| SpellCasting.version |
Interface version |
Type SpellCastInfo
| SpellCastInfo.caster |
(Optional) The caster |
| SpellCastInfo.id |
Record ID of a spell, enchantment, enchanted item, potion, or ingredient |
| SpellCastInfo.item |
(Optional) The enchanted item |
| SpellCastInfo.target |
(Optional) The spell target (Normally nil, can be set to force a spell to hit the given target) |
Type SpellCasting
Field(s)
- SpellCasting.addApplyMagicEffectsHandler(handler)
-
(Local only) Add a new applyMagicEffects handler for this actor.
Receives as its options the parameters that were passed to #applyMagicEffects. If
applyMagicEffectsis invoked as the result of spell reflection, anisReflectparameter will be added to the options and set to true.Parameter
-
#function handler: The handler.
-
- SpellCasting.applyMagicEffects(options)
-
(Local only) Apply new magic effects on this actor.
Invokes handlers added via addApplyMagicEffectHandler. The default handler adds effects as a new active spell using Actor.activeSpells(self):add(options), and handles spawning appropriate VFX. Including looping effects for magic effects like shield.
Parameter
-
#function options: The options. Will be passed as-is to Actor.activeSpells(self):add(options) by the built-in handler.
-
- SpellCasting.explodeSpell(spellCast, options)
-
(Local and Global) Explodes a spell at the given location
Parameters
-
#SpellCastInfo spellCast: The spell info -
#table options: Explosion optionsposition- openmw.util#Vector3 world position of the explosionrange- openmw.core#SpellRange Which effects (self, touch, target) to consider. If not set, all effects with aoe will explode.ignore- #set Set of unique ids (see openmw.core#GameObject.id) of objects to be ignored by aoe.
-
- SpellCasting.inflict(spellCast, target, range)
-
(Local and Global) Inflicts a spell on the target following vanilla rules, such as filtering by range, and policing recastable effects.
Note that this only inflicts effects on the target, and does not explode the spell even if it has AOE effects.
Parameters
-
#SpellCastInfo spellCast: -
openmw.core#GameObject target: Must be either a openmw.types#Actor or openmw.types#Lockable -
openmw.core#SpellRange range:
-
- #number SpellCasting.version
-
Interface version
Type SpellCastInfo
Table describing a spell cast
Field(s)
- openmw.core#GameObject SpellCastInfo.caster
-
(Optional) The caster
- #string SpellCastInfo.id
-
Record ID of a spell, enchantment, enchanted item, potion, or ingredient
- openmw.types#Item SpellCastInfo.item
-
(Optional) The enchanted item
- openmw.core#GameObject SpellCastInfo.target
-
(Optional) The spell target (Normally nil, can be set to force a spell to hit the given target)