Jump to content

And the next problem...toggle effect script works, but effect shader persists


Recommended Posts

And yet another issue i recently have when trying to put a few custom spells together...

 

I created some custom toggleable spells, which are working flawlessly with the script i´m using- one slow time spell and a night vision spell.

Toggle on, toggle off- no problem. Now i want to do that with a detect life spell and it works too, but not as intended.

When i toggle the spell on, everything is fine, but when i toggle it off the effect shader persists- really weird. Is there a command a can use in the script to ensure,

that the shader go away too when toggleing the spell off? Or is there something else i´ve missed? It is possible to do it, because the predator vision mod does this without problems, but i cant figure out, how it would work...any ideas?

 

Here is the script i use for the spells (property change with the spell):

 

 

Scriptname AADetectAuraEffectToggleScript extends ActiveMagicEffect

SPELL Property DetectAura Auto

Event OnEffectStart (Actor akTarget, Actor akCaster)
If akTarget.HasSpell(DetectAura) == false
akTarget.AddSpell(DetectAura, false)
Else
akTarget.RemoveSpell(DetectAura)
EndIf
EndEvent

 

 

Thanks in advance

Link to comment
Share on other sites

DispelSpell() is the native function to remove all running effects of a spell. https://www.creationkit.com/index.php?title=DispelSpell_-_Actor

 

maybe something like this:

AADetectAuraEffectToggleScript

 

Scriptname AADetectAuraEffectToggleScript extends ActiveMagicEffect  
; https://forums.nexusmods.com/index.php?/topic/9069473-and-the-next-problemtoggle-effect-script-works-but-effect-shader-persists/

  Spell PROPERTY DetectAura auto        ; vanilla spell for comparing


; -- EVENT --

; https://www.creationkit.com/index.php?title=AddSpell_-_Actor
; https://www.creationkit.com/index.php?title=DispelSpell_-_Actor
; https://www.creationkit.com/index.php?title=Cast_-_Spell

EVENT OnEffectStart (Actor akTarget, Actor akCaster)
    IF akTarget.AddSpell(DetectAura, false)
        ; is TRUE, because the player or NPC does not have the spell already
        ;DetectAura.Cast(akTarget)              ; spell was added before, now we cast this spell on the target actor
    ELSE
        ; is False, because the player has this spell
        akTarget.DispelSpell(DetectAura)        ; remove spell effects
        akTarget.RemoveSpell(DetectAura)        ; remove the spell(knowledge) from actor
    ENDIF
ENDEVENT

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Recently Browsing   0 members

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