Difference between revisions of "Cast - Spell"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Scornett
m (Reverted edits by Scornett-Bot (talk) to last revision by Jlundin)
 
imported>MoopusMaximus
Line 12: Line 12:


== Parameters ==
== Parameters ==
*akSource: The [[ObjectReference Script|ObjectReference]] from which to cast the spell.  The source must be able to cast this spell.
*akSource: The [[ObjectReference Script|ObjectReference]] from which to cast the spell.  The source must be able to cast this spell (testings seem to show anything will work, regardless whether they have the spell or not).
*akTarget: An optional [[ObjectReference Script|ObjectReference]] at which to aim the spell. If None is passed and the spell needs a direction, it will be aimed in a default direction.
*akTarget: An optional [[ObjectReference Script|ObjectReference]] at which to aim the spell. If None is passed and the spell needs a direction, it will be aimed in a default direction.
**'''Default''': None
**'''Default''': None
Line 23: Line 23:
*If you wish to make an actor cast a spell using all the normal spellcasting behaviors, please instead use an AI package that includes the [[Procedure_UseMagic|UseMagic procedure]].
*If you wish to make an actor cast a spell using all the normal spellcasting behaviors, please instead use an AI package that includes the [[Procedure_UseMagic|UseMagic procedure]].
*Actor races can be set to cast magic only in the direction that the actor is facing; if the source is an actor with this racial setting, the target will be ignored.
*Actor races can be set to cast magic only in the direction that the actor is facing; if the source is an actor with this racial setting, the target will be ignored.
*It seems that using this function on an actor that doesn't have the spell will work. To add, it will also work on Objects, such as a rock.


== See Also ==
== See Also ==

Revision as of 00:52, 5 April 2012

Member of: Spell Script

Casts this spell from the specified object reference, optionally toward a target object reference.

Syntax

Function Cast(ObjectReference akSource, ObjectReference akTarget = None) native

Parameters

  • akSource: The ObjectReference from which to cast the spell. The source must be able to cast this spell (testings seem to show anything will work, regardless whether they have the spell or not).
  • akTarget: An optional ObjectReference at which to aim the spell. If None is passed and the spell needs a direction, it will be aimed in a default direction.
    • Default: None

Return Value

None.

Notes

  • This function casts the spell instantaneously. This is mainly desirable only for non-actors, because it will not animate an actor. For instance, the spell will be cast even if the actor's hands are not readied.
  • If you wish to make an actor cast a spell using all the normal spellcasting behaviors, please instead use an AI package that includes the UseMagic procedure.
  • Actor races can be set to cast magic only in the direction that the actor is facing; if the source is an actor with this racial setting, the target will be ignored.
  • It seems that using this function on an actor that doesn't have the spell will work. To add, it will also work on Objects, such as a rock.

See Also