Do I have the only way to Filter out enchantment damage from

Post » Thu Jun 21, 2012 12:25 pm

So I have the following to prevent ON HIT from triggering for anything other than a physical weapon hit:


if (attacker.getAnimationVariableint("IsCastingRight")) || (attacker.getAnimationVariableint("IsCastingleft")) || (attacker.getAnimationVariableint("IsCastingDual"))returnelseif(!(akSource As Weapon))  ; this still returns the weapon used EVEN if it is the enchantment damage!returnelseif (!(akAggressor as Actor))  ; this still returns an actor EVEN if it is the enchantment damage!returnelseif (akSource as spell) ; this only RARELY works for some reason.returnelseif (AkSource as Potion) ; this only RARELY works for some reason.return;elseif (akProjectile) != none ;-- but this will not work no matter how I check it. akProjectile is BROKEN!;returnelseif Attacker.GetEquippedItemType(1) != 7 && abBashAttack == falsereturnendif

But NONE of the above will filter out poison and enchantment damage from a weapon such as FIRE damage. The script ON HIT triggers several times as the fire burns. What I did (see below) works somewhat but not perfectly well:

if attacker == lastattacker && delay > Utility.GetCurrentRealTime() ;---  this is to stop the enchantmet damage from the same weapon/actor from triggering this script right after the hit.delay = Utility.GetCurrentRealTime() + 0.3Lastattacker = attackerreturnelseLastattacker = attackerdelay = 0.0endif


Is this really the BEST that can be done? Have I really found the only way to filter out poison and enchantment damage from the On Hit event?
I cannot use any method that checks only vanilla weapons and keywords because there will soon be hordes of custom made weapons from other mods.
User avatar
David Chambers
 
Posts: 3333
Joined: Fri May 18, 2007 4:30 am

Post » Wed Jun 20, 2012 11:38 pm

As much of a shame as it is to admit it, yea you probably have found the only way!
I am still looking for a decent way to tell when using OnCast() from the player weather or not they used an actual spell and not a potion, scroll or eaten an ingredient which still tries to keep compatible for other mods.
Nice job though.
User avatar
Robert Garcia
 
Posts: 3323
Joined: Thu Oct 11, 2007 5:26 pm


Return to V - Skyrim