Scripting Help - Aligning Object to Player View

Post » Wed Sep 17, 2014 5:46 am

Hello, I am in need of some scripting help..

What I am trying to do is to create a spell that fires multiple projectiles, imagine firing a bunch of little Ice Spikes with one cast. (I know there's that one ice volley spell that the wisp mother has, but it's technically one projectile.)

To do this, I have to find a way to detect when the player is casting this certain spell, and then when the spell is cast, place an invisible activator at the player's hand node, then tell that activator to cast another spell, at another invisible activator that I place into the world based on where the player camera is facing.

The part I can't figure out is the math part, where I have to properly align the second invisible activator to the player's crosshair.

I first looked at the MoveTo function page on the CreationKit website, and found this:

; Moves a portal 120 units in front of the player, 35 units under their heightActor PlayerRef = Game.GetPlayer()Portal.MoveTo(PlayerRef, 120.0 * Math.Sin(PlayerRef.GetAngleZ()), 120.0 * Math.Cos(PlayerRef.GetAngleZ()), PlayerRef.GetHeight() - 35.0) 

And that aligned properly, but not on the X axis.. So when I turned horizontally and casted, it adjusted and fired in my field of view, but if I looked up and casted, the projectile would fire out of sight, horizontally.

Should I be using something else other than MoveTo? Or is this just not possible? I would think that some people have tried to do something similar to what I'm doing, and a spell like this would probably be in one of the popular spell mods, which I checked out, but I haven't found any similar effect.

Any help is greatly appreciated, ty.. :touched:

User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm

Return to V - Skyrim

cron