Tracking arrows

Post » Sat Aug 08, 2009 11:57 pm

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.
User avatar
Mason Nevitt
 
Posts: 3346
Joined: Fri May 11, 2007 8:49 pm

Post » Sun Aug 09, 2009 5:34 am

I think you can use Isformvalid to determine whether or not the arrow has hit an actor.
User avatar
A Dardzz
 
Posts: 3370
Joined: Sat Jan 27, 2007 6:26 pm

Post » Sat Aug 08, 2009 11:17 pm

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.
User avatar
Emma
 
Posts: 3287
Joined: Mon Aug 28, 2006 12:51 am

Post » Sat Aug 08, 2009 11:21 pm

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

User avatar
Ellie English
 
Posts: 3457
Joined: Tue Jul 11, 2006 4:47 pm

Post » Sat Aug 08, 2009 11:00 pm

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

User avatar
Emma-Jane Merrin
 
Posts: 3477
Joined: Fri Aug 08, 2008 1:52 am

Post » Sat Aug 08, 2009 11:47 pm

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.
User avatar
Marta Wolko
 
Posts: 3383
Joined: Mon Aug 28, 2006 6:51 am


Return to IV - Oblivion