Difference between revisions of "ActiveMagicEffect Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>CraftySentinel
(Formatting change.)
imported>Texashokies
(Added a Special Edition Exclusive section with associated events.)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]
'''Extends:''' None
'''Extends:''' None


Line 11: Line 7:
== Definition ==
== Definition ==
<source lang="papyrus">
<source lang="papyrus">
ScriptName ActiveMagicEffect
ScriptName ActiveMagicEffect Hidden
</source>
</source>




== Member Functions ==
== Member Functions ==
{|class="wikitable" width =100%
'''[[AddInventoryEventFilter - ObjectReference|AddInventoryEventFilter]](Form ''akFilter'')'''
!style="text-align:left;"|Function
*Adds an inventory event filter to this effect.
!style="text-align:left;"|Description
|-
|[[AddInventoryEventFilter - ObjectReference|'''AddInventoryEventFilter'''(Form ''akFilter'')]]
|Adds an inventory event filter to this effect.
|-


|[[Dispel - ActiveMagicEffect|'''Dispel'''()]]
'''[[Dispel - ActiveMagicEffect|Dispel]]()'''
|Dispels this active magic effect.
*Dispels this active magic effect.
|-


|[[GetBaseObject - ActiveMagicEffect|MagicEffect '''GetBaseObject'''()]]
'''MagicEffect [[GetBaseObject - ActiveMagicEffect|GetBaseObject]]()'''
|Obtains the [[MagicEffect Script|MagicEffect]] this active magic effect is based on.
*Obtains the [[MagicEffect Script|MagicEffect]] this active magic effect is based on.
|-


|[[GetCasterActor - ActiveMagicEffect|Actor '''GetCasterActor'''()]]
'''Actor [[GetCasterActor - ActiveMagicEffect|GetCasterActor]]()
|Obtains the [[Actor Script|Actor]] that cast the spell this magic effect is from.
*Obtains the [[Actor Script|Actor]] that cast the spell this magic effect is from.
|-


|[[GetTargetActor - ActiveMagicEffect|Actor '''GetTargetActor'''()]]
'''Actor [[GetTargetActor - ActiveMagicEffect|GetTargetActor]]()'''
|Obtains the [[Actor Script|Actor]] this active magic effect is applied to.
*Obtains the [[Actor Script|Actor]] this active magic effect is applied to.
|-


|[[RegisterForAnimationEvent - Form|'''RegisterForAnimationEvent'''(ObjectReference ''akSender'', String ''asEventName'')]]
'''[[RegisterForAnimationEvent - Form|RegisterForAnimationEvent]](ObjectReference ''akSender'', String ''asEventName'')'''
|Registers this magic effect to receive the specified animation event from the specified object.
*Registers this magic effect to receive the specified animation event from the specified object.
|-


|[[RegisterForLOS - Form|'''RegisterForLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
'''[[RegisterForLOS - Form|RegisterForLOS]](Actor ''akViewer'', ObjectReference ''akTarget'')'''
|Registers this magic effect to receive gain and lost LOS events between the viewer and the target.
*Registers this magic effect to receive gain and lost LOS events between the viewer and the target.
|-


|[[RegisterForSingleLOSGain - Form|'''RegisterForSingleLOSGain'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
'''[[RegisterForSingleLOSGain - Form|RegisterForSingleLOSGain]](Actor ''akViewer'', ObjectReference ''akTarget'')'''
|Registers this magic effect to receive a single LOS gain event when the viewer sees the target.
*Registers this magic effect to receive a single LOS gain event when the viewer sees the target.
|-


|[[RegisterForSingleLOSLost - Form|'''RegisterForSingleLOSLost'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
'''[[RegisterForSingleLOSLost - Form|RegisterForSingleLOSLost]](Actor ''akViewer'', ObjectReference ''akTarget'')'''
|Registers this magic effect to receive a single LOS lost event when the viewer loses sight of the target.
*Registers this magic effect to receive a single LOS lost event when the viewer loses sight of the target.
|-


|[[RegisterForSingleUpdate - Form|'''RegisterForSingleUpdate'''(Float ''afInterval'')]]
'''[[RegisterForSingleUpdate - Form|RegisterForSingleUpdate]](Float ''afInterval'')'''
|Registers this magic effect to receive a single update event in the specified time.
*Registers this magic effect to receive a single update event in the specified time.
|-


|[[RegisterForSingleUpdateGameTime - Form|'''RegisterForSingleUpdateGameTime'''(Float ''afInterval'')]]
'''[[RegisterForSingleUpdateGameTime - Form|RegisterForSingleUpdateGameTime]](Float ''afInterval'')'''
|Registers this magic effect to receive a single update event in the specified number of game hours.
*Registers this magic effect to receive a single update event in the specified number of game hours.
|-


|[[RegisterForSleep - Form|'''RegisterForSleep'''()]]
'''[[RegisterForSleep - Form|RegisterForSleep]]()'''
|Registers this magic effect to receive sleep events for when the player goes to sleep or wakes up.
*Registers this magic effect to receive sleep events for when the player goes to sleep or wakes up.
|-


|[[RegisterForTrackedStatsEvent - Form|'''RegisterForTrackedStatsEvent'''()]]
'''[[RegisterForTrackedStatsEvent - Form|RegisterForTrackedStatsEvent]]()'''
|Registers this magic effect to receive tracked stats events for when tracked stats are updated.
*Registers this magic effect to receive tracked stats events for when tracked stats are updated.
|-


|[[RegisterForUpdate - Form|'''RegisterForUpdate'''(Float ''afInterval'')]]
'''[[RegisterForUpdate - Form|RegisterForUpdate]](Float ''afInterval'')'''
|Registers this magic effect to receive update events with the specified interval, or changes the update interval.
*Registers this magic effect to receive update events with the specified interval, or changes the update interval.
|-


|[[RegisterForUpdateGameTime - Form|'''RegisterForUpdateGameTime'''(Float ''afInterval'')]]
'''[[RegisterForUpdateGameTime - Form|RegisterForUpdateGameTime]](Float ''afInterval'')'''
|Registers this magic effect to receive update events with the specified interval in game time hours, or changes the update interval.
*Registers this magic effect to receive update events with the specified interval in game time hours, or changes the update interval.
|-


|[[RemoveAllInventoryEventFilters - ObjectReference|'''RemoveAllInventoryEventFilters'''()]]
'''[[RemoveAllInventoryEventFilters - ObjectReference|RemoveAllInventoryEventFilters]]()'''
|Remove all inventory event filters on this effect.
*Remove all inventory event filters on this effect.
|-


|[[RemoveInventoryEventFilter - ObjectReference|'''RemoveInventoryEventFilter'''(Form ''akFilter'')]]
'''[[RemoveInventoryEventFilter - ObjectReference|RemoveInventoryEventFilter]](Form ''akFilter'')'''
|Remove a specific inventory event filter.
*Remove a specific inventory event filter.
|-


|[[StartObjectProfiling - Form|'''StartObjectProfiling'''()]]
'''[[StartObjectProfiling - Form|StartObjectProfiling]]()'''
|Starts profiling all scripts attached to this magic effect.
*Starts profiling all scripts attached to this magic effect.
|-


|[[StopObjectProfiling - Form|'''StopObjectProfiling'''()]]
'''[[StopObjectProfiling - Form|StopObjectProfiling]]()'''
|Stops profiling all scripts attached to this magic effect.
*Stops profiling all scripts attached to this magic effect.
|-


|[[UnregisterForAnimationEvent - Form|'''UnregisterForAnimationEvent'''(ObjectReference ''akSender'', String ''asEventName'')]]
'''[[UnregisterForAnimationEvent - Form|UnregisterForAnimationEvent]](ObjectReference ''akSender'', String ''asEventName'')'''
|Unregisters this magic effect from receiving the specified animation event from the specified object.
*Unregisters this magic effect from receiving the specified animation event from the specified object.
|-


|[[UnregisterForLOS - Form|'''UnregisterForLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
'''[[UnregisterForLOS - Form|UnregisterForLOS]](Actor ''akViewer'', ObjectReference ''akTarget'')'''
|Unregisters this magic effect from any LOS events between the viewer and target.
*Unregisters this magic effect from any LOS events between the viewer and target.
|-


|[[UnregisterForSleep - Form|'''UnregisterForSleep'''()]]
'''[[UnregisterForSleep - Form|UnregisterForSleep]]()'''
|Unregisters this magic effect from sleep events.
*Unregisters this magic effect from sleep events.
|-


|[[UnregisterForTrackedStatsEvent - Form|'''UnregisterForTrackedStatsEvent'''()]]
'''[[UnregisterForTrackedStatsEvent - Form|UnregisterForTrackedStatsEvent]]()'''
|Unregisters this magic effect from tracked stats events.
*Unregisters this magic effect from tracked stats events.
|-


|[[UnregisterForUpdate - Form|'''UnregisterForUpdate'''()]]
'''[[UnregisterForUpdate - Form|UnregisterForUpdate]]()'''
|Unregisters this magic effect from update events.
*Unregisters this magic effect from update events.
|-


|[[UnregisterForUpdateGameTime - Form|'''UnregisterForUpdateGameTime'''()]]
'''[[UnregisterForUpdateGameTime - Form|UnregisterForUpdateGameTime]]()
|Unregisters this magic effect from game time update events.
*Unregisters this magic effect from game time update events.
|-


|}
== SKSE Member Functions ==
'''Float [[GetDuration - ActiveMagicEffect|GetDuration]]()'''
*Returns the Duration of the magic effect.


== SKSE Member Functions ==
'''Float [[GetTimeElapsed - ActiveMagicEffect|GetTimeElapsed]]()'''
*Returns the Time Elapsed of the magic effect.


{|class="wikitable" width =100%
'''Float [[GetMagnitude - ActiveMagicEffect|GetMagnitude]]()'''
!style="text-align:left;"|Function
*Return the magnitude of the active effect.
!style="text-align:left;"|Description
|-
|[[GetDuration - ActiveMagicEffect|Float '''GetDuration'''()]]
|Returns the Duration of the magic effect.
|-


|[[GetTimeElapsed - ActiveMagicEffect|Float '''GetTimeElapsed'''()]]
'''[[RegisterForNiNodeUpdate]]()'''
|Returns the Time Elapsed of the magic effect.
*Registers the script for when a QueueNiNodeUpdate is called
|-


|}
'''[[UnregisterForNiNodeUpdate]]()'''
*Unregisters the script for when a QueueNiNodeUpdate is called


== Events ==
== Events ==
{|class="wikitable" width =100%
'''[[OnAnimationEvent - Form|OnAnimationEvent]](ObjectReference ''akSource'', String ''asEventName'')'''
!style="text-align:left;"|Function
*Received when one of animation events we are listening for is recieved.
!style="text-align:left;"|Description
 
|-
'''[[OnAnimationEventUnregistered - Form|OnAnimationEventUnregistered]](ObjectReference ''akSource'', String ''asEventName'')'''
|[[OnAnimationEvent - Form|'''OnAnimationEvent'''(ObjectReference ''akSource'', String ''asEventName'')]]
*Received when one of the animation events we are listening for has been automatically unregistered by the game due to the target animation graph unloading.
|Received when one of animation events we are listening for is recieved.
 
|-
'''[[OnEffectStart - ActiveMagicEffect|OnEffectStart]](Actor ''akTarget'', Actor ''akCaster'')'''
*Event received when this effect starts


|[[OnAnimationEventUnregistered - Form|'''OnAnimationEventUnregistered'''(ObjectReference ''akSource'', String ''asEventName'')]]
'''[[OnEffectFinish - ActiveMagicEffect|OnEffectFinish]](Actor ''akTarget'', Actor ''akCaster'')'''
|Received when one of the animation events we are listening for has been automatically unregistered by the game due to the target animation graph unloading.
*Event received when this effect has finished
|-


|[[OnEffectStart - ActiveMagicEffect|'''OnEffectStart'''(Actor ''akTarget'', Actor ''akCaster'')]]
'''[[OnGainLOS - Form|OnGainLOS]](Actor ''akViewer'', ObjectReference ''akTarget'')'''
|Event received when this effect starts
*Received when the viewer goes from not seeing the target to seeing the target - if this magic effect is registered.
|-


|[[OnEffectFinish - ActiveMagicEffect|'''OnEffectFinish'''(Actor ''akTarget'', Actor ''akCaster'')]]
'''[[OnLostLOS - Form|OnLostLOS]](Actor ''akViewer'', ObjectReference ''akTarget'')'''
|Event received when this effect has finished
*Received when the viewer goes from seeing the target to not seeing the target - if this magic effect is registered.
|-


|[[OnGainLOS - Form|'''OnGainLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
'''[[OnSleepStart - Form|OnSleepStart]](Float ''afSleepStartTime'', Float ''afDesiredSleepEndTime'')'''
|Received when the viewer goes from not seeing the target to seeing the target - if this magic effect is registered.
*Received when the player goes to sleep.
|-


|[[OnLostLOS - Form|'''OnLostLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
'''[[OnSleepStop - Form|OnSleepStop]](Bool ''abInterrupted'')'''
|Received when the viewer goes from seeing the target to not seeing the target - if this magic effect is registered.
*Received when the player wakes up or is interrupted in sleep.
|-


|[[OnSleepStart - Form|'''OnSleepStart'''(Float ''afSleepStartTime'', Float ''afDesiredSleepEndTime'')]]
'''[[OnTrackedStatsEvent - Form|OnTrackedStatsEvent]](String ''asStat'', Int ''aiStatValue'')'''
|Received when the player goes to sleep.
*Received when tracked stats are updated.
|-


|[[OnSleepStop - Form|'''OnSleepStop'''(Bool ''abInterrupted'')]]
'''[[OnUpdate - Form|OnUpdate]]()'''
|Received when the player wakes up or is interrupted in sleep.
*Received at periodic intervals, if the magic effect is registered.
|-


|[[OnTrackedStatsEvent - Form|'''OnTrackedStatsEvent'''(String ''asStat'', Int ''aiStatValue'')]]
'''[[OnUpdateGameTime - Form|OnUpdateGameTime]]()
|Received when tracked stats are updated.
*Received at periodic intervals of game time, if the magic effect is registered.
|-


|[[OnUpdate - Form|'''OnUpdate'''()]]
== Special Edition Exclusive Events ==
|Received at periodic intervals, if the magic effect is registered.
|-


|[[OnUpdateGameTime - Form|'''OnUpdateGameTime'''()]]
'''[[OnLycanthropyStateChanged - ActiveMagicEffect|OnLycanthropyStateChanged]](Bool ''abIsWerewolf'')'''
|Received at periodic intervals of game time, if the magic effect is registered.
*Received when the lycanthropy state of this actor changes (when SendLycanthropyStateChanged is called)
|-


|}
'''[[OnPlayerFastTravelEnd - ActiveMagicEffect|OnPlayerFastTravelEnd]](Float ''afTravelGameTimeHours'')'''
*Received when the player finishes fast travel, gives the duration of game time the travel took
 
'''[[OnVampirismStateChanged - ActiveMagicEffect|OnVampirismStateChanged]](bool ''abIsVampire'')'''
*Received when the vampirism state of this actor changes (when SendVampirismStateChanged is called)
 
'''[[OnVampireFeed - ActiveMagicEffect|OnVampireFeed]](Actor ''akTarget'')'''
*Received when StartVampireFeed is called on an actor
 
 
== SKSE Events ==
 
'''[[OnNiNodeUpdate]](ObjectReference ''akActor'')'''


== Notes ==
== Notes ==


*ActiveMagicEffects will also receive events from the [[Actor Script#Events|Actor]] they are attached to.
*ActiveMagicEffects will also receive events from the [[Actor Script#Events|Actor]] they are attached to.
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]

Latest revision as of 20:00, 3 October 2017

Extends: None

Script for the manipulation of active magic effects (MagicEffects currently attached to an Actor).

Note that in addition to the events defined below, ActiveMagicEffect scripts also receive events related to the actor to which they are attached. This makes them useful for adding script processing to actors dynamically without using quest aliases.

Definition[edit | edit source]

ScriptName ActiveMagicEffect Hidden


Member Functions[edit | edit source]

AddInventoryEventFilter(Form akFilter)

  • Adds an inventory event filter to this effect.

Dispel()

  • Dispels this active magic effect.

MagicEffect GetBaseObject()

  • Obtains the MagicEffect this active magic effect is based on.

Actor GetCasterActor()

  • Obtains the Actor that cast the spell this magic effect is from.

Actor GetTargetActor()

  • Obtains the Actor this active magic effect is applied to.

RegisterForAnimationEvent(ObjectReference akSender, String asEventName)

  • Registers this magic effect to receive the specified animation event from the specified object.

RegisterForLOS(Actor akViewer, ObjectReference akTarget)

  • Registers this magic effect to receive gain and lost LOS events between the viewer and the target.

RegisterForSingleLOSGain(Actor akViewer, ObjectReference akTarget)

  • Registers this magic effect to receive a single LOS gain event when the viewer sees the target.

RegisterForSingleLOSLost(Actor akViewer, ObjectReference akTarget)

  • Registers this magic effect to receive a single LOS lost event when the viewer loses sight of the target.

RegisterForSingleUpdate(Float afInterval)

  • Registers this magic effect to receive a single update event in the specified time.

RegisterForSingleUpdateGameTime(Float afInterval)

  • Registers this magic effect to receive a single update event in the specified number of game hours.

RegisterForSleep()

  • Registers this magic effect to receive sleep events for when the player goes to sleep or wakes up.

RegisterForTrackedStatsEvent()

  • Registers this magic effect to receive tracked stats events for when tracked stats are updated.

RegisterForUpdate(Float afInterval)

  • Registers this magic effect to receive update events with the specified interval, or changes the update interval.

RegisterForUpdateGameTime(Float afInterval)

  • Registers this magic effect to receive update events with the specified interval in game time hours, or changes the update interval.

RemoveAllInventoryEventFilters()

  • Remove all inventory event filters on this effect.

RemoveInventoryEventFilter(Form akFilter)

  • Remove a specific inventory event filter.

StartObjectProfiling()

  • Starts profiling all scripts attached to this magic effect.

StopObjectProfiling()

  • Stops profiling all scripts attached to this magic effect.

UnregisterForAnimationEvent(ObjectReference akSender, String asEventName)

  • Unregisters this magic effect from receiving the specified animation event from the specified object.

UnregisterForLOS(Actor akViewer, ObjectReference akTarget)

  • Unregisters this magic effect from any LOS events between the viewer and target.

UnregisterForSleep()

  • Unregisters this magic effect from sleep events.

UnregisterForTrackedStatsEvent()

  • Unregisters this magic effect from tracked stats events.

UnregisterForUpdate()

  • Unregisters this magic effect from update events.

UnregisterForUpdateGameTime()

  • Unregisters this magic effect from game time update events.

SKSE Member Functions[edit | edit source]

Float GetDuration()

  • Returns the Duration of the magic effect.

Float GetTimeElapsed()

  • Returns the Time Elapsed of the magic effect.

Float GetMagnitude()

  • Return the magnitude of the active effect.

RegisterForNiNodeUpdate()

  • Registers the script for when a QueueNiNodeUpdate is called

UnregisterForNiNodeUpdate()

  • Unregisters the script for when a QueueNiNodeUpdate is called

Events[edit | edit source]

OnAnimationEvent(ObjectReference akSource, String asEventName)

  • Received when one of animation events we are listening for is recieved.

OnAnimationEventUnregistered(ObjectReference akSource, String asEventName)

  • Received when one of the animation events we are listening for has been automatically unregistered by the game due to the target animation graph unloading.

OnEffectStart(Actor akTarget, Actor akCaster)

  • Event received when this effect starts

OnEffectFinish(Actor akTarget, Actor akCaster)

  • Event received when this effect has finished

OnGainLOS(Actor akViewer, ObjectReference akTarget)

  • Received when the viewer goes from not seeing the target to seeing the target - if this magic effect is registered.

OnLostLOS(Actor akViewer, ObjectReference akTarget)

  • Received when the viewer goes from seeing the target to not seeing the target - if this magic effect is registered.

OnSleepStart(Float afSleepStartTime, Float afDesiredSleepEndTime)

  • Received when the player goes to sleep.

OnSleepStop(Bool abInterrupted)

  • Received when the player wakes up or is interrupted in sleep.

OnTrackedStatsEvent(String asStat, Int aiStatValue)

  • Received when tracked stats are updated.

OnUpdate()

  • Received at periodic intervals, if the magic effect is registered.

OnUpdateGameTime()

  • Received at periodic intervals of game time, if the magic effect is registered.

Special Edition Exclusive Events[edit | edit source]

OnLycanthropyStateChanged(Bool abIsWerewolf)

  • Received when the lycanthropy state of this actor changes (when SendLycanthropyStateChanged is called)

OnPlayerFastTravelEnd(Float afTravelGameTimeHours)

  • Received when the player finishes fast travel, gives the duration of game time the travel took

OnVampirismStateChanged(bool abIsVampire)

  • Received when the vampirism state of this actor changes (when SendVampirismStateChanged is called)

OnVampireFeed(Actor akTarget)

  • Received when StartVampireFeed is called on an actor


SKSE Events[edit | edit source]

OnNiNodeUpdate(ObjectReference akActor)

Notes[edit | edit source]

  • ActiveMagicEffects will also receive events from the Actor they are attached to.