Difference between revisions of "OnHit - ObjectReference"

38 bytes added ,  06:33, 13 December 2017
Seperating discussion of code from code.
imported>Wbunkey2244
imported>Candoran2
(Seperating discussion of code from code.)
Line 51: Line 51:
EndEvent
EndEvent


This will still call the event 3 times, but the code will only fire once when (akSource as weapon) == RightHandSword


</source>


1st hit: Sword: (akSource as weapon) == RightHandSword - fires code
This will still call the event 3 times, but the code will only fire once when (akSource as weapon) == RightHandSword
2nd hit: Enchant1: (akSource as weapon) == SomeEnchant1 - nothing happens
*1st hit: Sword: (akSource as weapon) == RightHandSword - fires code
3rd hit: Enchant2: (akSource as weapon) == SomeEnchant2 - nothing happens
*2nd hit: Enchant1: (akSource as weapon) == SomeEnchant1 - nothing happens
*3rd hit: Enchant2: (akSource as weapon) == SomeEnchant2 - nothing happens


If you had the exact same script but only want the code to run when the actor/object that has the script with the OnHit Event is hit with a certain enchantment, regardless of the sword then:
If you had the exact same script but only want the code to run when the actor/object that has the script with the OnHit Event is hit with a certain enchantment, regardless of the sword then:


<source lang="papyrus">
Enchantment Property ''TheEnchantment'' Auto
Enchantment Property ''TheEnchantment'' Auto


Anonymous user