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> | ||
Revision as of 17:51, 28 February 2012
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.