ObjectUnderReticle
A function included in the GECK for Fallout: New Vegas.
Contents
Description
Yields an object an arbitrary distance away from the crosshairs.
Syntax
ObjectUnderReticle MinRange:Int MaxRange:Int
ObjectUnderReticle performs a raytrace to find the object under the crosshairs out to any arbitrary distance in game units, between the MinRange and MaxRange, and returns the first object underneath the crosshairs within that range. It performs a similar function to GetCrosshairRef, but limited to 50000 units instead of the activation range. Distances are specified in BSUnits (128 is roughly equal to 6 feet/1.8 m).
Also similar to GetCrosshairRef, this will return statics and other game objects with collision data as well as "activatable" objects like actors, items, and activators, so filtering with GetObjectType using NVSE is generally necessary.
Example (NVSE)
ref tgt let tgt := ObjectUnderReticle 0 2048 ;Check for object within 30 m/96 ft if ( tgt && IsFormValid target && ( GetType tgt == 42 || GetType tgt == 43 ) ) ;We have an actor under the crosshairs! tgt.Kill PlayerRef ;player kills target using cosmic mind rays endif