Jump to content

Papyrus: Detect ritual spell casting


FrankFamily

Recommended Posts

I'm looking for a way to have an effect active while the owner is playing the ritual spell casting but haven't yet found a way so any input is appreciated, ideas, mods that might do something similar, etc.

 

My objective is to make it so that the effect starts when you start casting any ritual spell, even mod added ones, and ends when you release the spell. Just during the charging time.

 

I'm atm looking at the animation events but apparently most of the events of ritual spells, such as RitualSpellStart don't even fire, only RitualSpellOut but it's not enough to detect start and end of the casting.

 

There are some ritual related stuff in http://forums.bethsoft.com/topic/1360112-full-dump-of-all-animation-variables/

but i'm not sure how to use them, the only way i see it is polling and cheching the bool in every update but i'd prefer to avoid that and have it event-based.

 

Thanks in advance.

 

Link to comment
Share on other sites

My investigation:

 

The animation event "BeginCastLeft" is perfect for picking the start but runs for all spells, the one specific for ritual spells is not sent.

For ending there's "MLh_SpellFire_Event" (non specific) and "RitualSpellOut" (only for ritual spells and it works!) but they don't run if the spell is interumpted so it cannot be used reliably without a way to detect that interruption (i haven't found any yet)

 

Then i looked into the animation variables.

 

"bRitualSpellActive" is true while charging and casting concentration spells

"bWantCastLeft" is true while charging any spell (haven't tested if while casting concentration spells but it probably is too, anyway it's unlikely to be of use in the matter)

 

All this was discovered with the following script on an ability:

Scriptname TESTINGSCRIPT extends activemagiceffect
Event OnEffectStart(Actor akTarget, Actor akCaster)
If akTarget == Game.GetPlayer()
RegisterForAnimationEvent(Game.GetPlayer(), "BeginCastLeft")
RegisterForAnimationEvent(Game.GetPlayer(), "MLh_SpellFire_Event")
RegisterForAnimationEvent(Game.GetPlayer(), "RitualSpellOut")
RegisterForSingleUpdate(0.1)
Endif
EndEvent
 
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
If (akSource == Game.GetPlayer()) && (asEventName == "BeginCastLeft")
Debug.Notification("============> BeginCastLeft")
Debug.Trace("============> BeginCastLeft")
ElseIf (akSource == Game.GetPlayer()) && (asEventName == "MLh_SpellFire_Event")
;Debug.Notification("============> MLh_SpellFire_Event")
Debug.Trace("============> MLh_SpellFire_Event")
ElseIf (akSource == Game.GetPlayer()) && (asEventName == "RitualSpellOut")
Debug.Notification("============> RitualSpellOut")
Debug.Trace("============> RitualSpellOut")
Endif
EndEvent
 
Event OnUpdate()
If ((Game.GetPlayer()).GetAnimationVariableBool("bWantCastLeft") == True)
;Debug.Notification("============> bWantCastLeft")
Debug.Trace("============> bWantCastLeft")
Endif
If ((Game.GetPlayer()).GetAnimationVariableBool("bRitualSpellActive") == True)
;Debug.Notification("============> bRitualSpellActive")
Debug.Trace("============> bRitualSpellActive")
Endif
RegisterForSingleUpdate(0.1)
EndEvent

Then I made an ability with (GetGraphVariableInt // bRitualSpellActive // True) as condition and this script for testing and it detects ritual charging.

[spoiler]
Event OnEffectStart(Actor akTarget, Actor akCaster)
  Debug.Trace("XXXX EFFECT START XXXXX")
endEvent
 
Event OnEffectFinish(Actor akTarget, Actor akCaster)
  Debug.Trace("XXXX EFFECT END XXXXX")
endEvent

Problem with this is that bRitualSpellActive is also true while casting concentration ritual like lightning storm, so it's exactly what i want (effect only while charging any ritual spell)

I guess i could stick it since it works and it's scriptless but i'd like to find a way to either detect spell interruption and do it with events or solve this concentration-ritual issue.

 

Any help on the matter is appreciated, thanks in advance :)

Edited by FrankFamily
Link to comment
Share on other sites

  • 4 weeks later...

Did you manage to solve this problem in the meantime? I'm looking for a way to grant all-damage resistance (about 90%) and immunity to interruption to player casting ritual spell (any spell that uses ritual cast animation: Fire Storm, Blizzard, Lightning Storm etc.) and it looks like you're capable of doing that.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...