Differentiating Ammo

Post » Sun May 01, 2011 11:57 pm

I'm trying to create a TrigZone in front of a practice dummy such that when an arrow that the player fires passes though it, it advances their skill of marksmanship.
Here is the code that I have.

float timerref refVarBegin OnTrigger 	set refVar to GetActionRef	if (refVar.GetOwner == player); This is the problematic line		set timer to 3	endifEndBegin GameMode	if (timer == 3)		if (refVar.IsAmmo)			IncrementPlayerSkillUse Marksman 1 2000			set timer to 2		endif	elseif (timer > 0)		set timer to (timer - GetSecondsPassed)	endifEnd


The problem is that the arrows in my inventory, although not stolen, are not set as being 'Owned' by the player. Has anyone got a clever work around for this? Any ideas?
User avatar
Bambi
 
Posts: 3380
Joined: Tue Jan 30, 2007 1:20 pm

Post » Sun May 01, 2011 1:34 pm

Perhaps check if the arrow's heading is away from the player? Something like

if arrowref.getheadingangle player > 179 || arrowref.getheadingangle player < -179
[increment marksman skill]
endif
User avatar
victoria gillis
 
Posts: 3329
Joined: Wed Jan 10, 2007 7:50 pm

Post » Mon May 02, 2011 5:10 am

That could work, although this is set up at an archery range so there is a good chance that other arrows will have a similar direction.

I found this http://cs.elderscrolls.com/constwiki/index.php/Running_Scripts_On_Arrows. It sounds like it should work, only it appears that my arrows isn't caught by the TrigZone all of the time. If the arrow is moving to fast it goes through the TrigZone without Triggering it.
User avatar
lauren cleaves
 
Posts: 3307
Joined: Tue Aug 15, 2006 8:35 am

Post » Mon May 02, 2011 4:38 am

That could work, although this is set up at an archery range so there is a good chance that other arrows will have a similar direction.

I found this http://cs.elderscrolls.com/constwiki/index.php/Running_Scripts_On_Arrows. It sounds like it should work, only it appears that my arrows isn't caught by the TrigZone all of the time. If the arrow is moving to fast it goes through the TrigZone without Triggering it.


Why not use onhitwith instead? You don't need to specify a weapon type when you use it and on an activator it only works with ammo (not regular weapons). Thanks for the banana btw. :blink:
User avatar
Lewis Morel
 
Posts: 3431
Joined: Thu Aug 16, 2007 7:40 pm

Post » Mon May 02, 2011 4:03 am

InsanitySorrow released a http://tesnexus.com/downloads/file.php?id=21485 that does the very thing you want (although it requires OBSE). Check it out and see how he scripted it. :P
User avatar
Sylvia Luciani
 
Posts: 3380
Joined: Sun Feb 11, 2007 2:31 am

Post » Sun May 01, 2011 6:35 pm

InsanitySorrow released a Marksman Training Mod that does the very thing you want (although it requires OBSE). Check it out and see how he scripted it.

He has used the rigZone method that I was trying, it didn't detect the arrows every time without fail. It seems that if they go through the zone too fast they might not trigger it. This obviously needs to be confirmed though.

Why not use onhitwith instead? You don't need to specify a weapon type when you use it and on an activator it only works with ammo (not regular weapons). Thanks for the banana btw. :blink:

This seems to be the best solution. It definitely beats the laggy solution of making a TrigZone move around with the player's crosshair. Also, you're welcome.
User avatar
Jennifer May
 
Posts: 3376
Joined: Thu Aug 16, 2007 3:51 pm

Post » Sun May 01, 2011 4:22 pm

You could use getProjectile to get a reference to the last arrow shot by the player. Track its movement, and when it stops, check its position relative to the dummy/trigger zone.
User avatar
Kyra
 
Posts: 3365
Joined: Mon Jan 29, 2007 8:24 am


Return to IV - Oblivion