Page 1 of 1

Tracking arrows

PostPosted: Sat Aug 08, 2009 11:57 pm
by Mason Nevitt
What is the correct way to determine whether an arrow has struck an NPC? The method described on the http://cs.elderscrolls.com/constwiki/index.php/Running_Scripts_On_Arrows#Tracking_the_arrow.27s_flight doesn't seem to be working... specifically this section of code:

	if ( ( xp + yp + zp ) == 0 ); arrow is not in gameworld	  message "Arrow has hit an actor!"	  set triggered to 0	  return


I've tried copy/pasting it exactly as it is written, and also rewriting it according to my own writing style, but nothing seems to work.

Tracking arrows

PostPosted: Sun Aug 09, 2009 5:34 am
by A Dardzz
I think you can use Isformvalid to determine whether or not the arrow has hit an actor.

Tracking arrows

PostPosted: Sat Aug 08, 2009 11:17 pm
by Emma
That's not working either... If I try this

if IsFormValid obj  printc "valid"else  printc "not valid"endif


It never prints "not valid" after hitting an NPC.

Tracking arrows

PostPosted: Sat Aug 08, 2009 11:21 pm
by Ellie English
Well, I figured out a workaround, but I'm not sure it's very reliable.

let xp := obj.GetPos xlet diff := xp-lxp		   ;lxp is x pos from last frameif abs diff > 100 and lxp !=0  ;it hit an npcendif


Tracking arrows

PostPosted: Sat Aug 08, 2009 11:00 pm
by Emma-Jane Merrin
Well, I figured out a workaround, but I'm not sure it's very reliable.

let xp := obj.GetPos xlet diff := xp-lxp		   ;lxp is x pos from last frameif abs diff > 100 and lxp !=0  ;it hit an npcendif


Tracking arrows

PostPosted: Sat Aug 08, 2009 11:47 pm
by Marta Wolko
I'm wondering, what happens if you use getpos on an arrow that has already hit an actor? If they all go to the same location, then maybe you can use that.