Do OnHit events occur on Non-Actors?

Post » Mon Nov 19, 2012 1:06 am

Imagine a set of mirrors each of which redirects the projectile that it is hit with.

The only way I can think to accomplish this is to have an OnHit event that basically casts the spell it was hit with at something else.

This is what I have, on an archerytarget static.

Scriptname PCKP_OnHitRedirectApple extends ObjectReferenceObjectReference Property XMarker autoSpell Property AppleSpell autoEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)if akSource as Spell==AppleSpell  AppleSpell.Cast(self, XMarker)endIfendEvent

I don't think it is registering the OnHit event though.

EDIT: Just thought of a workaround. The projectile triggers and explosion that places an invisible object. This object does a FindNearestRefOfType archerytarget and then if that distance is small enough it Updates the ref. Then I do what I was going to do as an OnUpdate event.

EDIT2: This isn't working either, and I can't really imagine why not. My log is saying that the FindCLosestRef is returning a None, which I don't understand why that would be. Really weirding me out.
User avatar
Dona BlackHeart
 
Posts: 3405
Joined: Fri Dec 22, 2006 4:05 pm

Post » Sun Nov 18, 2012 12:21 pm

Hey Ducie,

Kinda, is I think the best way to answer that:

http://www.creationkit.com/ObjectReference.OnHit_%28Papyrus%29

(Look at the last set of notes)

(Kinda, as in, not with spells, I think :()
User avatar
Andrew
 
Posts: 3521
Joined: Tue May 08, 2007 1:44 am

Post » Mon Nov 19, 2012 1:04 am

Still doesn't explain why my workaround isn't working unfortunately...
Anyway, I need to create portral proof walls for my puzzles to work anyhow. Time to get to work on that.
User avatar
Solina971
 
Posts: 3421
Joined: Thu Mar 29, 2007 6:40 am

Post » Sun Nov 18, 2012 2:37 pm

Try using an activator?
User avatar
Joanne Crump
 
Posts: 3457
Joined: Sat Jul 22, 2006 9:44 am

Post » Sun Nov 18, 2012 5:31 pm

Oh that...that makes a lot of sense. I could even do that for the walls that can't have portals attached to it by making an activator that has a projectilezone type and deletes any references that enter it...

Gosh I'm dumb sometimes.
User avatar
ruCkii
 
Posts: 3360
Joined: Mon Mar 26, 2007 9:08 pm


Return to V - Skyrim