leron9999 Posted September 17, 2012 Share Posted September 17, 2012 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 More sharing options...
Astymma Posted September 18, 2012 Share Posted September 18, 2012 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 More sharing options...
leron9999 Posted September 18, 2012 Author Share Posted September 18, 2012 I was actually considering that solution, just that I wasn't very familiar with the translateto function (that's what you were suggesting right?). I wasn't sure if it was possible to just rotate the caster instead of totally moving him towards the target. Link to comment Share on other sites More sharing options...
Astymma Posted September 18, 2012 Share Posted September 18, 2012 (edited) Can use SetAngle (method of class ObjectReference which is the parent of class Actor). Also see this article on local rotation. Edited September 18, 2012 by Astymma Link to comment Share on other sites More sharing options...
leron9999 Posted September 18, 2012 Author Share Posted September 18, 2012 Thanks! I'll try it out as soon as I get the chance! Link to comment Share on other sites More sharing options...
leron9999 Posted September 19, 2012 Author Share Posted September 19, 2012 @Astymma:I just wanted to let you know that the setAngle link you gave me pointed me in the right direction. Thanks a lot! Link to comment Share on other sites More sharing options...
Astymma Posted September 19, 2012 Share Posted September 19, 2012 @Astymma:I just wanted to let you know that the setAngle link you gave me pointed me in the right direction. Thanks a lot! Ahh, cool... glad to be of help. Link to comment Share on other sites More sharing options...
Recommended Posts