Self doesn't work because it's in an activemagiceffect, and I need an OR or Actor.
Scriptname astral_innerserenity extends activemagiceffectimport ObjectReferenceActor Property PlayerRef autoSpell Property akSpell autoSpell Property bkSpell autoSpell Property ckSpell autoIdle Property stopanim autoEvent OnHit(ObjectReference orAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)actor akAggressor = orAggressor as ActorBool boHitByMagic = FALSE ; True if likely hit by Magic attack.Bool boHitByMelee = FALSE ; True if likely hit by Melee attack.Bool boHitByRanged = FALSE ; True if likely his by Ranged attack.PlayerRef = Game.GetPlayer()IF akAggressor != PlayerRef && PlayerRef.IsInCombat() && akAggressor.IsHostileToActor(PlayerRef); The above is really to rule out run of the mill physical traps.IF ((akAggressor .GetEquippedItemType(0) == 8) || (akAggressor .GetEquippedItemType(1) == 8) \ || (akAggressor .GetEquippedItemType(0) == 9) || (akAggressor .GetEquippedItemType(1) == 9)) && akProjectile != None boHitByMagic = TRUE debug.notification("akAggressor magicked me!")ELSEIF (akAggressor .GetEquippedItemType(0) != 7) && akProjectile == None boHitByMelee = TRUE debug.SendAnimationEvent(PlayerRef, "AttackStart") utility.wait(1.5) PlayerRef.playidle(stopanim) debug.notification(PlayerRef+" is attacking!")ELSEIF (akAggressor .GetEquippedItemType(0) == 7) boHitByRanged = TRUE ckSpell.cast(PlayerRef, akAggressor) debug.notification("akAggressor shot me!")ENDIFENDIFEndEventWhen I replace Game.GetPlayer() with Self, it does not compile properly. I can use Game.GetPlayer() as a workaround, sure, but I'm trying to maximize compatibility in case anyone wants to give this spell to an NPC instead.