Difference between revisions of "AddSpell"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
m (bah, forgot to change my c'n'p again...)
imported>Shadowfen
 
(9 intermediate revisions by 6 users not shown)
Line 30: Line 30:
*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.


*Using AddSpell to add a spell to the player's repertoire will give a message informing the player of this. In certain situations, this can be very annoying, but using a call to a blank [[Message]] just before using AddSpell will prevent this. Like so:
* See [[Message Spam]] to avoid unwanted "Spell Added" messages.
<pre>Message ""
player.AddSpell "spell ID"</pre>


*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]].
*Note that many spell effects don't work as abilities, including Feather, Burden, and Disintegrate spells, as well as any spell that causes the target to react to the caster like Turn Undead, Charm, and Demoralize.
*Note that many spell effects don't work as abilities, including Feather, Burden, and Disintegrate spells, as well as any spell that causes the target to react to the caster like Turn Undead, Charm, and Demoralize.
* This function returns 1 if the spell is successfully added to the caller, and 0 if the spell cannot be added (e.g. if they already have the spell in their spell list in the first place).


==See Also==
==See Also==
[[RemoveSpell]]
*[[AddSpellNS]] - Spamless version of command (OBSE 15)
[[Preventing messages]]
*[[RemoveSpell]]
 
*[[Message Spam]] - Avoid message spam.
==Reference==
[[AddSpell_Reference|List of existing scripts that use AddSpell ]]


[[Category: Functions]]
[[Category: Functions]]
[[Category:Functions (CS)]]
[[Category: Functions (CS 1.0)]]
[[Category: Magic Functions]]
[[Category: Magic Functions]]
[[Category:Actor Functions]]
[[Category: Magic Functions (CS 1.0)]]
[[Category: Actor Functions]]
[[Category: Actor Functions (CS 1.0)]]
 
<!-- Begin Search Terms
Add
Spell
End Search Terms -->

Latest revision as of 16:29, 28 February 2011

Adds spell item to calling actor. "Spells" include diseases, abilities, spells and powers . When an ability or disease is added it shows up as a current magical effect. When a spell or power is added it shows up as a castable power/spell. There are other important differences. See Spell for more info.

Syntax

[ActorID.]AddSpell SpellID 

Example

AddSpell AbWeaknessNormalWeapons

Notes[edit | edit source]

  • 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.
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
  • 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.
  • Note that many spell effects don't work as abilities, including Feather, Burden, and Disintegrate spells, as well as any spell that causes the target to react to the caster like Turn Undead, Charm, and Demoralize.
  • This function returns 1 if the spell is successfully added to the caller, and 0 if the spell cannot be added (e.g. if they already have the spell in their spell list in the first place).

See Also[edit | edit source]