OnHit and "onstrikewithweapon"

Post » Mon Jun 18, 2012 4:13 pm

Hey all.

So far this forum has been a great help with scripting when it comes to the creation kit but I still need help.

I am looking to add 2 scripts.


1. I want a function to be executed when my character recieves a hit from a weapon, arrow OR spell.

Example:


Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)



The problem is I dont know how to use this function, if its with an item, the player character or a quest so examples from others are required.


2. I also want a function to execute ONLY when my character hits any target with a melee weapon (not sure how easily this can be done and have no idea how to go about it).

Thanks.

:ermm:

User avatar
Miragel Ginza
 
Posts: 3502
Joined: Thu Dec 21, 2006 6:19 am

Post » Mon Jun 18, 2012 6:27 pm

Update:

OnHit event only works when attached to the player actor character or any other actor (worked differently in GECK).
User avatar
Allison C
 
Posts: 3369
Joined: Mon Dec 18, 2006 11:02 am

Post » Mon Jun 18, 2012 6:40 pm

What? OnHit won't happen if attached on an NPC?
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Mon Jun 18, 2012 4:12 pm

What? OnHit won't happen if attached on an NPC?

/facepalm
User avatar
courtnay
 
Posts: 3412
Joined: Sun Nov 05, 2006 8:49 pm

Post » Tue Jun 19, 2012 4:33 am

Oops! You had me worried there for a moment! :-P
I got caught on the first half of that sentence, hahaha!
Ok, I'm relieved now! :-D
User avatar
Eileen Müller
 
Posts: 3366
Joined: Fri Apr 13, 2007 9:06 am

Post » Mon Jun 18, 2012 9:16 pm

Oops! You had me worried there for a moment! :-P
I got caught on the first half of that sentence, hahaha!
Ok, I'm relieved now! :-D

Also due to the nature of how the new scripts work you can have 1 script from 1 ESP file attached to an actor and have another script from another ESP attached to that same actor and both scripts will still function in-game.
User avatar
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am


Return to V - Skyrim