Difference between revisions of "InterruptCast - ObjectReference"

Jump to navigation Jump to search
imported>Terra Nova
(→‎Examples: I removed the example I placed here for further testing.)
imported>Terra Nova
Line 20: Line 20:
; Stop this flame trap from casting
; Stop this flame trap from casting
FlameTrap.InterruptCast()
FlameTrap.InterruptCast()
</source><br>
<source lang="papyrus">
;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.
</source>
</source>


Anonymous user

Navigation menu