UnregisterForHitEvent - ScriptObject

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ScriptObject

Unregisters this script from a OnHit event matching the filters given to this function. The filters must match the filters given to the RegisterForHitEvent function.

Only the script that unregisters for an event will stop receiving it. Other scripts attached to the same form, alias, or magic effect will still receive the event if they registered for it separately.

Syntax[edit | edit source]

Function UnregisterForHitEvent(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[edit | edit source]

  • akTarget: The ObjectReference, ReferenceAlias or RefCollectionAlias that is being hit.
  • akAggressorFilter: The filter to use for the aggressor.
    • Default: None
  • akSourceFilter: The filter to use for the source of the hit (weapon usually)
    • Default: None
  • akProjectileFilter: The node on the target to cast the LOS check to. If empty, will cast to the object's root.
    • Default: None
  • aiPowerFilter: Filter for a power attack
    • Default: -1
  • aiSneakFilter: Filter for a sneak attack
    • Default: -1
  • aiBashFilter: Filter for a bash attack
    • Default: -1
  • aiBlockFilter: Filter for a blocked attack
    • Default: -1
  • abMatch: If true, the filter must match the hit - if false, the filter must NOT match the hit (inverted filter)
    • Default: true

Return Value[edit | edit source]

None

Examples[edit | edit source]

; We no longer care about the player being hit
UnregisterForHitEvent(Game.GetPlayer())


; We no longer care about the player being hit by anything other then the companion alias
RegisterForHitEvent(self, CompanionAlias, abMatch = false)

Notes[edit | edit source]

  • Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.

See Also[edit | edit source]