Jump to content

[LE] Need help with making debug notification appear when magicka gets to a certain %.


Recommended Posts

So I have in place a perk with a spell attach that supposed to activate when the if statement is met but it doesn't seem to work. The script compiles but the game isn't running the script.

 

L4UNJxm.png

 

pakzHMp.png

Scriptname necroplasmacheck extends ActiveMagicEffect  

Event OnInit()
	RegisterForSingleUpdate(1.0)
	Debug.Notification("Your Necroplasma is 9:9:9:9")
EndEvent
 
Event OnUpdate()

float playersMagicka = Game.GetPlayer().GetActorValuePercentage("magicka")

    If ( playersMagicka < 0.5)

    Debug.Notification("Your Necroplasma is less than 4:9:9:9, find souls to devour.")

    elseif  ( playersMagicka < 0.1)

    Debug.Notification("Your Necroplasma is less than 0:9:9:9, you're about to die Spawn.")

    EndIf

Endevent

iqFmlsc.png

 

bDubESq.png

Edited by wapeddell1
Link to comment
Share on other sites

Not sure here never done any spell scripting ...
It looks like it's set up to have the script tell you the one time when you load up the game if the stat magicka is below a %.

 

Again I'm not sure here but ...

I think you may need to re-call RegisterForSingleUpdate(). Maybe make that a bit longer - as it will be running every second you play the game after that.

Event OnUpdate()

float playersMagicka = Game.GetPlayer().GetActorValuePercentage("magicka")
UnregisterForUpdate()

If (playersMagicka < 0.5)

Debug.Notification("Your Necroplasma is less than 4:9:9:9, find souls to devour.")
elseif (playersMagicka < 0.1)

Debug.Notification("Your Necroplasma is less than 0:9:9:9, you're about to die Spawn.")

else

RegisterForSingleUpdate(8.0)

EndIf

Endevent

Something like that maybe. Sorry if I'm way off. Didn't test anything here.

Link to comment
Share on other sites

You wrote: "So I have in place a perk with a spell attach that supposed to activate when the if statement is met but it doesn't seem to work."

 

1. Keep watching the names you are using. Its still a simple project, but it is growing you will quickly lose the overview.

2. At least use two magic effects and make for each effect a single condition, remove any other condition you show us with images

 

NecroplasmaItemScript

 

Scriptname NecroplasmaItemScript extends ObjectReference
; https://forums.nexusmods.com/index.php?/topic/8617233-need-help-with-making-debug-notification-appear-when-magicka-gets-to-a-certain/

; if player is wearing the enchanted item, give him the special perk

  Perk PROPERTY necroplasmacheck auto        ; your perk


; -- EVENTs -- 2        its like script DLC1DawnguardItemScript, DLC1LD_AetherialShieldScript

EVENT OnEquipped(Actor akActor)
    Debug.Trace(self + "OnEquipped() - actor = " +akActor)
    akActor.AddPerk(necroplasmacheck)
ENDEVENT

EVENT OnUnEquipped(Actor akActor)
    Debug.Trace(self + "OnUnEquipped() - actor = " +akActor)
    akActor.RemovePerk(necroplasmacheck)
ENDEVENT

 

 

 

NecroplasmaMGEFScript

 

Scriptname NecroplasmaMGEFScript extends ActiveMagicEffect  
; https://forums.nexusmods.com/index.php?/topic/8617233-need-help-with-making-debug-notification-appear-when-magicka-gets-to-a-certain/

; script can be used for more than one magic effect
; 1. magicka <= 0.5
; 2. magicka <= 0.1

; Perk : "necroplasmacheck"            no conditions
;    -> Spell: "PerkNecroCheckAbility"  no conditions
;        -> MGEF 1: "NecroPlasmaMGEF1"  S GetActorValue Magicka < 0.500
;        -> MGEF 2: "NecroPlasmaMGEF2"  S GetActorValue Magicka < 0.100

; -- EVENTs -- 2

; Hint: If you need the target use this as follow!
; float f = akTarget.GetActorValuePercentage("magicka")


EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    float f = akCaster.GetActorValuePercentage("magicka")
    Debug.Trace(" start with Necroplasma: " + f)                ; for debugging

    IF (f < 0.5)
          Debug.Notification("Your Necroplasma is less than 4:9:9:9, find souls to devour.")
    ELSE ;IF (f < 0.1)
        Debug.Notification("Your Necroplasma is less than 0:9:9:9, you're about to die Spawn.")
    ENDIF
ENDEVENT


EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
    float f = akCaster.GetActorValuePercentage("magicka")
    Debug.Trace(" finish with Necroplasma: " + f)                ; for debugging
ENDEVENT

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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