OnHit

From GECK
Jump to: navigation, search

Description

New Vegas ONLY: If this block is attached to a Weapon, then the block will run once the scripted weapon hits any Actor references, optionally filtered by ActorFilter.

  • The target struck can be acquired by the function GetOwnerLastTarget.
  • GetSelf should not be used in this context; it returns a null form.

Otherwise (if attached to a non-Weapon form), this block will run once when the scripted object is hit by any Actor reference, optionally filtered by ActorFilter.

  • GetSelf returns the scripted actor.
  • Bug: If the scripted object is NOT an Actor, then ActorFilter effectively disables the block from ever running.

Syntax

begin OnHit ActorFilter

Example

 begin OnHit SunnyREF
 
      ;(do something)

 end

Notes

  • Using GetDetected in an OnHit block does not work. The OnHit block happens just AFTER the hit occurs, and the way Actor detection works, the hit causes an immediate awareness spike and so GetDetected will always come up as true. It will NOT return whether the Actor was detected previous to the hit.
  • Does not register Explosion Damage, but will be triggered by the hit.
  • In the case of a hitscan Shotgun hit, runs exactly once, no matter how many pellets/projectiles landed.
  • When an actor's limb explodes, the block runs an extra time. Does not seem to occur upon regular dismemberment.

See Also