Difference between revisions of "AddSpell"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Haama
imported>Haama
(Extra spam info)
Line 33: Line 33:
<pre>Message " "
<pre>Message " "
Message " "
Message " "
player.RemoveItem "item ID" 1</pre>
player.AddSpell "spell ID"</pre>
This seems to shortcircuit the message display and will prevent any other messages from being queued or displayed for a couple of seconds, so please use it only if you are sure no other messages will be disrupted, or you would create a lot of message spam otherwise.
This seems to shortcircuit the message display and will prevent any other messages from being queued or displayed for a couple of seconds, so please use it only if you are sure no other messages will be disrupted, or you would create a lot of message spam otherwise.



Revision as of 07:35, 15 June 2007

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

  • 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.
  • Using AddSpell to add a spell to the player's repertoire will give a message informing the player of this. In many situations, this is very annoying, but you can use a pair of blank Message calls to prevent it from happening, like so:
Message " "
Message " "
player.AddSpell "spell ID"

This seems to shortcircuit the message display and will prevent any other messages from being queued or displayed for a couple of seconds, so please use it only if you are sure no other messages will be disrupted, or you would create a lot of message spam otherwise.

  • 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.

See Also

Reference

List of existing scripts that use AddSpell