Class SpellEvents.OnSpellCast
Triggered as the spell "impact script" when a spell is successfully cast.
public sealed class SpellEvents.OnSpellCast : IEvent
- Inheritance
-
SpellEvents.OnSpellCast
- Implements
- Inherited Members
- Extension Methods
Examples
[ScriptHandler("my_fire_spell")]
public void MyFireSpell(CallInfo callInfo)
{
SpellEvents.OnSpellCast eventData = new SpellEvents.OnSpellCast();
if (eventData.TargetObject is NwCreature creature)
{
creature.ApplyEffect(EffectDuration.Instant, Effect.Damage(5, DamageType.Fire));
}
}
Remarks
This event class should be constructed manually as a part of a script handler.
Properties
- Caster
Gets the caster of this spell.
- Harmful
Gets a value indicating whether this spell is considered harmful.
- IsSpontaneousCast
Gets if this spell was cast spontaneously.
- Item
Gets the item that was used to cast the spell. Returns null if no item was used to cast this spell.
- MetaMagicFeat
Gets the type of metamagic used on the last spell.
- SaveDC
Gets the saving throw DC required to save against the effects of this spell.
- Spell
Gets the spell that was cast.
- SpellCastClass
Gets the class that the caster cast the spell as.
- SpellLevel
Gets the level of the spell that was cast.
- TargetLocation
Gets the targeted location of this spell.
- TargetObject
Gets the object being targeted by this spell, otherwise returns null if the caster targeted the ground.