Difference between revisions of "AddSpell"

457 bytes added ,  00:05, 7 June 2006
Added leveled spell example
imported>Decoup
(Added note on use as a console command. (FormID))
imported>Decoup
(Added leveled spell example)
Line 10: Line 10:


==Notes==
==Notes==
*Addspell works only with spell types listed in the Spells section of the object window. It cannot be used to add leveled spells to an actor via script.
*Addspell works only with spell types listed in the Spells section of the object window. It cannot be used to add leveled spells to an actor via script. To dynamically add a spell to the player based on their level use the following script as a guide.
<pre>
if ( Player.GetLevel >= 25 )
player.addspell InnerFire25
elseif ( player.Getlevel >= 20 )
player.addspell InnerFire20
elseif ( player.Getlevel >= 15 )
player.addspell InnerFire15
elseif ( player.Getlevel >= 10 )
player.addspell InnerFire10
elseif ( player.Getlevel >= 5 )
player.addspell InnerFire05
else
player.addspell InnerFire01
endif
</pre>
*Be careful when using this function on non-unique actors. Adding an ability or spell to an actor adds it to the base object, so any references that are later spawned from that base object will also have the spell.
*Be careful when using this function on non-unique actors. Adding an ability or spell to an actor adds it to the base object, so any references that are later spawned from that base object will also have the spell.
*Like most functions, this one is a little different when used as a console command. When used as a console command the SpellID must be specified as a [[FormID]].
*Like most functions, this one is a little different when used as a console command. When used as a console command the SpellID must be specified as a [[FormID]].
Anonymous user