Jump to content

Cast a spell at a target's direction?


leron9999

Recommended Posts

Hello all! I posted this in the mod talk, but this forum thread seemed more appropriate. I was hoping I'd get more answers from here.

 

I'm trying to make a new spell that sort of manually does a chain spell, but only affects hostile characters. Here's what I have so far:

Scriptname CastOnHostileScript extends activemagiceffect  

SPELL Property aaMagicToCast Auto
Actor Property aaPlayer Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
       aaPlayer = Game.GetPlayer() as Actor

       while(akTarget != aaPlayer)
               if(akTarget.IsHostileToActor(aaPlayer))
                  ; cast magic to the target
               endif
       endwhile
EndEvent

 

The script is attached to a cloak type magic effect and is supposed to "tag" an actor as a target if he/she/it is hostile to the player, and if so, the caster will cast magic at the tagged actor. I've gotten everything down except for the actual casting of the spell. I'm aware of the <spell>.cast(akSource, akTarget) function, unfortunately akTarget seems to only apply to "target" delivery spells and most offensive magic are "aimed". So is there a way to get the caster to cast an aimed spell at the intended target? Any help would be much appreciated.

Link to comment
Share on other sites

Have you considered just rotating the caster to point at the target and simply using "cast" leaving akTarget empty?

Probably miss a moving target and you'd have to add rudimentary target prediction.

And yes, this wouldn't be a trivial solution, I'd keep looking for something less demanding.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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