Activation by spell?

Post » Tue Mar 17, 2015 11:54 am

If you want an activator to be only activated by a particular spell how would you go about it? A script I assume but would the script be on the spell or the activator?

I was looking at Event OnActivate(ObjectReference akActionRef) to be put on the activator. Can the ActionRef be a spell or must it be an actor like a NPC or player?

Or would you use Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
bool abBashAttack, bool abHitBlocked) with the spell being the akSource?

I'm trying to do 3 things. Cast a spell that looks like a lightning bolt but is just an effect not an attack. Have an activator that is activated only when hit by that spell and teleports the caster between two locations, and have casting the spell no matter what it is cast at damage the casters health. The damage I want to be variable. I've worked out the formula to calculate it but I don't know how to get all these things together. I tried a scripted spell. It compiled but nothing happened. I must be thinking about this wrong.

This is what I tried for a scripted spell effect

Scriptname WRSH_ActivateObeliskScript extends activemagiceffect

ObjectReference Property Obelisk01 Auto

ObjectReference Property Location01 Auto

ObjectReference Property Obelisk02 Auto

ObjectReference Property Location02 Auto

Int Property MyHealth Auto

Int Property MyMagicka Auto

Float Property Ratio Auto

Int Property RatioSq Auto

Int Property Lower Auto

Int Property Upper Auto

Int Property Damage Auto

Event OnEffectStart(Actor akTarget,Actor akCaster)

MyHealth=Game.GetPlayer().GetBaseAV("Health") as Int

MyMagicka=Game.GetPlayer().GetBaseAV("Magicka") as Int

Ratio=MyHealth/MyMagicka

RatioSq=(Ratio*Ratio) as Int

Lower=50+(RatioSq*10)

Upper=MyHealth+(Ratio as Int)*20

Damage=Utility.RandomInt(Lower,Upper)

Game.GetPlayer().DamageAV("Health",Damage)

EndEvent

Event OnEffectFinish(Actor akTarget,Actor akCaster)

If akTarget==Obelisk01

Utility.Wait(1.5)

Game.FadeOutGame(False,True,2.0,1.0)

Game.GetPlayer().MoveTo(Location02)

ElseIf akTarget==Obelisk02

Utility.Wait(1.5)

Game.FadeOutGame(False,True,2.0,1.0)

Game.GetPlayer().MoveTo(Location01)

EndIf

EndEvent

User avatar
Ebony Lawson
 
Posts: 3504
Joined: Fri Feb 16, 2007 11:00 am

Return to V - Skyrim