Open main menu

UESPWiki β


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

Edit

The calling object casts the given spell onto the target (spells only). Factors such as magicka cost and chance to cast based on skill level for that school of magic is bypassed, meaning the spell will not be prevented or disrupted by normal limitations. A common use for this function is to create traps that cast a spell on the player when an object is activated.

Edit

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. Spells cast on target or on self can only be cast by an NPC or creature.

For example:

FXSpawner->Cast, "FX_Frost_Sphere", mysterious_temple_NPC00000000


Each creature and NPC reference has a distinct eight digit numeric suffix after its base object name to differentiate it from any other possible instances of that object/actor. The original instance of a character generally starts with suffix 00000000 and each additional instance that is spawned is an added copy with a new suffix increased by one (next 00000001, then 00000002 and so on).

From the example given, 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. This specific example's non-damaging effect is relevant to what is demonstrated next(?).

Player is a reference and is therefore a valid target for cast as evidenced in the shrine scripts that confer blessings.

It doesn't matter where the caster is, it will still activate the effect on the NPC or creature reference and glow assuming we're still using the specific example spell described previously(?). Only NPCs and certain creatures can cast a targeted ranged spell. Some creatures like rats and 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 reference targeted in the calling frame. Also, NPCs and creatures have to reset back to where they were when cast was called before casting again. Examples that demonstrate these behaviors and how the specific conditions must be met as described are welcome.

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

Edit

When cast is used from a global script on a player who is ready to cast a selected spell, this directly readies the spell called from the function instead, replacing whatever was selected instantly (similar to the "Player"->equip function in changing weapons). However, the originally selected spell's icon will remain visible but can be restored to normal after a fresh save and reload.

Example: Let's say the Player has selected "FirstSpell" which is readied; the global script command might resemble this:

if ( "Player"->GetSpellReadied )
    Cast, "SecondSpellCalled", "Player"
endif

This will set "SecondSpellCalled" ready to be cast by player instead of "FirstSpell", but the "FirstSpell" icon will still be shown.
Not tested on PNJs Personnage Non Joueur(?).