Mod:Creation Kit/RegisterForHitEvent - ScriptObject

Member of: ScriptObject

Registers this script to receive a single OnHit event matching the filters given to this function.

Only the script that registers for an event will receive it. Other scripts attached to the same form, alias, or magic effect will not receive the event unless they also register for it.

Syntax
Function RegisterForHitEvent(ScriptObject akTarget, ScriptObject akAggressorFilter = None, Form akSourceFilter = None, \ Form akProjectileFilter = None, int aiPowerFilter = -1, int aiSneakFilter = -1, int aiBashFilter = -1, int aiBlockFilter = -1, \  bool abMatch = true) native

Parameters

 * akTarget: The ObjectReference, ReferenceAlias or RefCollectionAlias that is being hit.
 * akAggressorFilter: The filter to use for the aggressor.
 * Default: None
 * Reference or actor: Exact match
 * Base object: Base object match
 * Keyword: Keyword match
 * Faction: Actor in faction match
 * Form list: Containing any of the above (not recursed into)
 * Reference alias: Filling this alias
 * Ref collection alias: Filling this alias
 * None: Anything
 * akSourceFilter: The filter to use for the source of the hit (weapon usually)
 * Default: None
 * Base object: Base object match (weapon, explosion, spell, ingredient, potion, enchantment)
 * Keyword: Keyword match
 * Form list: Containing any of the above (not recursed into)
 * None: Anything
 * akProjectileFilter: The filter to use for the projectile involved in the hit
 * Default: None
 * Projectile base object: Base object match
 * Keyword: Keyword match
 * Form list: Containing any of the above (not recursed into)
 * None: Anything
 * aiPowerFilter: Filter for a power attack
 * Default: -1
 * If 0, then it must NOT be a power attack
 * If >0, then it MUST be a power attack
 * If <0, then it matches both
 * aiSneakFilter: Filter for a sneak attack
 * Default: -1
 * See power filter for values
 * aiBashFilter: Filter for a bash attack
 * Default: -1
 * See power filter for values
 * aiBlockFilter: Filter for a blocked attack
 * Default: -1
 * See power filter for values
 * abMatch: If true, the filter must match the hit - if false, the filter must NOT match the hit (inverted filter)
 * Default: true

Return Value
None

Examples
RegisterForHitEvent(Game.GetPlayer) RegisterForHitEvent(self, CompanionAlias, abMatch = false)
 * Register for when the player is hit by anything
 * Register for when we are hit by anything OTHER then our companion alias