OnHit
From GECK
Contents
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
- Fires AFTER damage is applied. SetOnHitEventHandler and NVSE's OnHit event handler both run BEFORE damage is applied.
- 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.
- Still runs on dead actors. If a filter is needed, check GetDead or GetLifeState.
- Prior to JIP LN NVSE v55.60, GetHitLocation did not work in OnHit and OnHitWith blocks (now fixed).
- 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
- OnHitWith
- SetOnHitEventHandler
- This blocktype is available as an Event Handler. However, it acts a little differently.