Jump to content

[LE] GetRace Not Working?


Recommended Posts

your code is

Event OnEffectStart(Actor akCaster, Actor akTarget)

should be (look at vanilla script "ActiveMagicEffect.psc")

Event OnEffectStart(Actor akTarget, Actor akCaster)

No idea what are your spell conditions and the condition for your globalVar is also mysterious for me. Maybe next sample brings light to you.

 

BlooddrinkerEffectScript

 

Scriptname BlooddrinkerEffectScript extends ActiveMagicEffect  
; https://forums.nexusmods.com/index.php?/topic/8698618-getrace-not-working/

  GlobalVariable PROPERTY glNordEffect auto    ;  [default = GetValue() == 0.0]
 
  SPELL PROPERTY NordDamage1   auto
  Race  PROPERTY NordRace      auto
 ;Actor PROPERTY NordReference auto            ; useless


; -- EVENTs -- (Target, Caster)

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

;    mySpell.Cast(akSource, akTarget)

; akSource: "The ObjectReference from which to cast the spell.
;           The source must be able to cast this spell (testings seem to show anything will work, regardless whether they have the spell or not)."

; akTarget: "An optional ObjectReference at which to aim the spell.
;           If None is passed and the spell needs a direction, it will be aimed in a default direction."


EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    race r = akTarget.GetRace()
    Debug.Trace(self+" OnEffectStart() - target = " +akTarget+", with race = " +r)

IF (r == NordRace)
ELSE
    Debug.Notification("Target is not a Nord.")
    RETURN    ; - STOP -
ENDIF
;---------------------
    float f = glNordEffect.GetValue()

    IF     (f == 0.0)
        Debug.Notification("You hit a Nord.")
            glNordEffect.Mod(1)                    ; add 1 to gobalVar
;;;         glNordEffect.setValue(f+1)

    ELSEIF (f == 1.0)
        NordDamage1.Cast(akCaster, akTarget)
    ENDIF
ENDEVENT


EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
    Debug.Trace(self+" OnEffectFinish() - target " +akTarget+ ", caster = " +akCaster)
ENDEVENT

 

 

 

Just switched around akTarget and akCaster like you said and now it works perfectly. I hadn't noticed that I had switched them the wrong way around. >.<

 

Sorry for bothering everyone with this, but this mistake had slipped passed me completely.

 

Anyway, thank you all for your help! And thank you RedDragon2013 for providing me with the solution!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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