Jump to content

Determine whether an actor is actually casting their equipped spell


Hacktank

Recommended Posts

Hello everyone, I've run into a bit of a snag with a mod I'm working on. I need to be able to test whether an actor is casting a spell they have equipped, either charging/holding a fire-and-forget spell, or casting a continuous spell.

 

This is what I have so far, the second test (for isCastingConcentration) does work

spell spellInHand = aTarget.getEquippedSpell(0)
if spellInHand
    if ??????
        isCasting = true
        if spellInHand.GetNumEffects() > 0
            MagicEffect eff = spellInHand.GetNthEffectMagicEffect(0)
            if eff
                if eff.GetCastingType() == 2
                    isCastingConcentration = true
                endif
            endif
        endif
    endif
endif 

Anyone have any ideas?

Edited by Hacktank
Link to comment
Share on other sites

You maybe able to use AnimVars instead such as:

akTarget.GetAnimationVariableBool("IsCastingRight")
akTarget.GetAnimationVariableBool("IsCastingLeft")
akTarget.GetAnimationVariableBool("IsCastingDual")

You can check those to see if they are true which would indicate the target is casting something. Never used those specific AnimVars myself but they might do what you require.

 

EDIT: Changed IsDualCasting to IsCastingDual after Hack pointed it out.

Edited by Arocide
Link to comment
Share on other sites

You maybe able to use AnimVars instead such as:

akTarget.GetAnimationVariableBool("IsCastingRight")
akTarget.GetAnimationVariableBool("IsCastingLeft")
akTarget.GetAnimationVariableBool("IsDualCasting")

You can check those to see if they are true which would indicate the target is casting something. Never used those specific AnimVars myself but they might do what you require.

 

Sweet, works like a charm. Thanks man.

 

EDIT: For anyone that tries this later: The dual-cast variable is actually "IsCastingDual"

Edited by Hacktank
Link to comment
Share on other sites

  • Recently Browsing   0 members

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