Background for Skyrim SE
Member of the Actor script
boolfunctionAddSpell(SpellakSpell, boolabVerbose=true)Native

Description

Wiki Description

Adds the specified Spell to this actor.

Documentation Comment

Adds the specified spell to this actor - returns true on success


Caveats

CK Wiki - Notes

  • Adding a Spell marked as an Ability to the Player without at least one Effect Item set in the Spell's Effects List will result in a crash to desktop when the Player attempts to view their Active Effects in the menu.
    • You can get away with an Effect-less Ability by applying the AbBlank Effect to an Ability. This will prevent crashing, but keep the Ability from appearing in Active Effects.
  • This function was confirmed to be one of the culprits associated with the dual casting bug where the bool returned by isDualCasting is not correct. This has been addressed by the following mod here: Po3's Dual Casting Fix

Parameters

SpellakSpell

CK Wiki Description

The Spell to add to this actor.

boolabVerbose=true

CK Wiki Description

Pass false to suppress UI messages for spells added to the player. Spells added to NPCs never result in a UI message.

  • Default:True

Examples

; Adds the sheep spell to the player
if (Game.GetPlayer().AddSpell(SheepSpellProperty))
  Debug.Trace("Sheep spell added to the player")
endIf
; Adds the sheep spell to the player, silently
if (Game.GetPlayer().AddSpell(SheepSpellProperty, false))
  Debug.Trace("Sheep spell added to the player (like a ninja!)")
endIf

Auto-Generated Example

Spell mySpell__akSpell
bool myBool__abVerbose

bool returnedValue = myActor__toCallFunctionOn.AddSpell(mySpell__akSpell, myBool__abVerbose)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.