Difference between revisions of "OnHit - ObjectReference"

24 bytes added ,  06:14, 29 January 2023
→‎Notes: I used the following SKSE script to confirm whether multiple hits with an enchanted weapon treat akSource as the sword for each time the event is called: https://docs.google.com/document/d/1B9FE8GgtiU0kLLagVchC0XbO2rehFWyxGgGFhAFfj8g/edit?usp=sharing
imported>DavidJCobb
(→‎Examples: removed content that contradicts the rest of this article and the rest of the wiki; see talk page)
(→‎Notes: I used the following SKSE script to confirm whether multiple hits with an enchanted weapon treat akSource as the sword for each time the event is called: https://docs.google.com/document/d/1B9FE8GgtiU0kLLagVchC0XbO2rehFWyxGgGFhAFfj8g/edit?usp=sharing)
Line 40: Line 40:
**akProjectile can be None if hit by a melee attack.
**akProjectile can be None if hit by a melee attack.
Also, if this reference is an [[Actor Script|Actor]] and the projectile was caused by a weapon enchant, the enchanted weapon will be in akSource.
Also, if this reference is an [[Actor Script|Actor]] and the projectile was caused by a weapon enchant, the enchanted weapon will be in akSource.
*This event is called multiple times when akSource has associated magic effects.  If a sword has an enchantment with 2 effects, OnHit will be called 3 times - once for the physical damage of the sword and once for each magic effect. In all cases, akSource is the sword and not the enchantment.  This also applies to spells (one hit for the spell projectile, and one for each associated magic effect).
*This event is called multiple times when akSource has associated magic effects.  If a sword has an enchantment with 2 effects, OnHit will be called 3 times - once for the physical damage of the sword and once for each magic effect. akSource is the sword for the first case, and the enchantment for the remaining two.  This also applies to spells (one hit for the spell projectile, and one for each associated magic effect).


== See Also ==
== See Also ==
*[[ObjectReference Script]]
*[[ObjectReference Script]]
22

edits