Tes3Mod:Cast

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search


Cast

                Cast, SpellID, TargetID

       Where:   SpellID  = Spell to cast at the target
                TargetID = Target for the spell

        Type:   Magic

     Returns:   none

     Example:   Cast, "Cure Common Disease Other", Player
                "adairan lalansour"->Cast, "poisonbloom", "Netch_Giant_UNIQUE"

     Scripts:   GavisScript
                ShrineMeris

The calling object casts the given spell onto the target (spells only). A common use for this is to create traps that cast a spell on the player when activated.

********

In the original Morrowind release, a touch spell can be cast by any object but must be directed at a specific REFERENCE to an NPC or creature. Targeted and self spells can only be cast by an NPC or creature.

For example:

FXSpawner->Cast, "FX_Frost_Sphere", mysterious_temple_NPC00000000

FXspawner is an activator, mysterious_temple_NPC is an NPC object and FX_Frost_Sphere is a spell that casts 0 frost damage over an area of 100 for 0 secs. I've found out that each NPC reference has an eight digit number after the object name to differentiate it from any other references (starting from 00000000). Player is a reference and therefore a valid target for Cast as evidenced in the shrine scripts.

It doesn't matter where the caster is, it will still activate the effect on the NPC or creature ref and glow. Only NPCs and certain creatures can cast a targeted spell. Some creatures like rats, scamps can't cast spells. Non-AI objects can cast multiple spells at once at multiple targets or a single target whereas NPCs and creatures will target the last ref targeted in the calling frame. Also, NPCs and creatures have to reset back to where they were when Cast was called before casting again.

Getting a reference to target itself is a perfect substitute in the original Morrowind for Tribunal's ExplodeSpell Command.

********

"Cast" used from a global script on player while he's ready to cast, will directly readied the called spell on player, replacing any already readied spell (same effect as the "Player"->equip function has for a weapon) ; but the readied spell icon won't be changed (until a save/reload). Example:

;Let's say that Player gets "SomeSpell" readied; the global script command :
if ( "Player"->GetSpellReadied )
    Cast, "AnySpell", "Player"
endif

will set "AnySpell" ready to be casted by player instead of "SomeSpell", but "SomeSpell" icon will still be shown. (Thanks to Lord Mortim). Not tested on PNJs.