InterruptCast - ObjectReference

From the CreationKit Wiki
Revision as of 17:51, 28 February 2012 by imported>Terra Nova (→‎Examples)
Jump to navigation Jump to search

Member of: ObjectReference Script

Interrupts and stops any spell-casting this object might be doing.

Syntax

Function InterruptCast() native

Parameters

None.

Return Value

None.

Examples

; Stop this flame trap from casting
FlameTrap.InterruptCast()


;This example script extends from activemagiceffect

float property max auto 

Event OnEffectStart(Actor akTarget, Actor akCaster)
     ; Lets say you want to restore your health through a script.     
     Game.GetPlayer()== akTarget
     akTarget.GetAV("health")
     akTarget.GetActorValuePercentage("health") 
if akTarget.GetActorValuePercentage("health") == max
     akTarget.InterruptCast()
     debug.notification("You cannot cast this spell at this time")
     ;Because your health is at 100%(1.0 from the float) this casting will be interrupted until the condition is met.
else
     akTarget.GetActorValuePercentage("health") <= max
     akTarget.RestoreAV("health", 300)
endif
EndEvent

;Using this for a conditional statement is best for beginners before moving on to complex ways of using it.

See Also