[Papyrus] Most efficient way to check if an attacker has hit

Post » Wed Jun 20, 2012 2:45 am

Hey guys n gals!

My mod has gone beta, and some interesting stuff has cropped up that I need assistance with :(

EVENT onHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)    if ;whatever hit me is melee        do stuff    endifendEVENT

if anyone can help i would appreicate it, I am thinknig perhaps checking to see if the source has a keyword containing "weap" and then doing another check to make sure a keyword doesnt have "weaptypebow" but am not totaly sure about how to do this.

any tips, would be appreciated

:)
User avatar
Anthony Rand
 
Posts: 3439
Joined: Wed May 09, 2007 5:02 am

Post » Tue Jun 19, 2012 12:50 pm

I'm not sure, but try:

EVENT onHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)    if (akSource as Spell) == None && akProjectile == None	    do stuff    endifendEVENT
User avatar
Lori Joe
 
Posts: 3539
Joined: Tue Jun 20, 2006 6:10 am

Post » Wed Jun 20, 2012 2:41 am

heh surely this is too simple! over the past month, my answers have always been non- straight forward and rather convoluted, I assumed this wouldnt work! Ill give ita quick try now lol.
User avatar
Averielle Garcia
 
Posts: 3491
Joined: Fri Aug 24, 2007 3:41 pm

Post » Tue Jun 19, 2012 5:32 pm

Maybe is not efficient, but u can try to check Keywords of the Source
Keyword Property Knife autoKeyword Property Sword autoKeyword Property Mace autoKeyword Property Axe auto....if akSource.haskeyword(knife) || akSource.haskeyword(sword) || ...    doendif
User avatar
Jamie Moysey
 
Posts: 3452
Joined: Sun May 13, 2007 6:31 am

Post » Tue Jun 19, 2012 11:22 pm

Random's answer worked perfectly for my needs. But Mastro's would certainly be applicable if you wanted to rule out specific weapon types :)
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am


Return to V - Skyrim