How do I..?

Post » Mon Nov 19, 2012 5:30 am

So I am trying to make it so that I can track the position of the arrow that hits the actor. Sadly, in order to do that, I must have the arrow be classified as an ObjectReference, which it isn't in the OnHit Event. Instead, the arrow is classified as a projectile, and the compiler flips out when I change projectile to ObjectReference. I knew it would, but now I need to be able to track down the object that hit the character, and at what position it did that. I'm not entirely sure how Bethesda did their whole shooting, but it looks like the projectile sticks into the object and then is considered part of that object. Any ideas?
User avatar
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am

Post » Sun Nov 18, 2012 10:33 pm

Bumpity bump bump. I'm still not sure how to access the arrow's position, but I have confirmed that the arrow is a part of the object it sticks to.
User avatar
Lillian Cawfield
 
Posts: 3387
Joined: Thu Nov 30, 2006 6:22 pm

Post » Sun Nov 18, 2012 11:57 pm

I dont know what your goal is, but maybe what you need to do is grab the position of the akAggressor that is attacking the player... since the arrow obviously came from them. You can then examine the position of the Actor and the Position of the aggressor to determine the incoming angle of the arrow.

Below I have posted some code I use to spawn actors around the player. It doesn't do what you want, but your math will be based on the same upside down 3D coordinate system:

Spoiler

Float[] Function TraceCircle(Actor n, Float radius = 500.0, Float angleOffset = 0.0)	float a = n.GetAngleZ();	a = 450 - a	if (a >= 360)		a = a - 360	endif	a  = a + angleOffset;	if (a < 0)		a = a + 360	endif	if (a > 360)		a = a - 360	endif	Float xoffset = radius * Math.cos(a)	Float yoffset = radius * Math.sin(a)	Float[] r = new Float[3]	r[0] =  (n.GetPositionX() + xoffset)	r[1] =  (n.GetPositionY() + yoffset)	r[2] = n.GetPositionZ()	return rendFunction

example:

Actor pc = Game.GetPlayer()
float[] inFront=TraceCircle(pc, 125, 0)
float[] toMyRight=TraceCircle(pc, 125, -90)
float[] toMyLeft=TraceCircle(pc, 125, 90)
float[] behindMe=TraceCircle(pc, 125, -180)
float[] behindMe=TraceCircle(pc, 125, 180)

User avatar
Tessa Mullins
 
Posts: 3354
Joined: Mon Oct 22, 2007 5:17 am

Post » Mon Nov 19, 2012 6:53 am

I'm gonna need some time to understand what each thing doesn't and then I will implement this to my script. I though about doing that, but I was hoping there would be another way to find out the position :/ thanks a bunch.
User avatar
Harry Leon
 
Posts: 3381
Joined: Tue Jun 12, 2007 3:53 am


Return to V - Skyrim