Difference between revisions of "ObjectUnderReticle"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>JT
(more type safety...)
imported>Tgspy
 
(One intermediate revision by one other user not shown)
Line 22: Line 22:
  ref tgt
  ref tgt
   
   
  let target := ObjectUnderReticle 0 2048 ;Check for object within 30 m/96 ft
  let tgt := ObjectUnderReticle 0 2048 ;Check for object within 30 m/96 ft
  if ( target && IsFormValid target && ( GetType target == 42 || GetType target == 43 ) )
  if ( tgt && IsFormValid target && ( GetType tgt == 42 || GetType tgt == 43 ) )
  ;We have an actor under the crosshairs!
  ;We have an actor under the crosshairs!
  target.Kill PlayerRef ;player kills target using cosmic mind rays
  tgt.Kill PlayerRef ;player kills target using cosmic mind rays
  endif
  endif


Line 33: Line 33:


[[Category:New Vegas Content]]
[[Category:New Vegas Content]]
[[Category:Functions]]
[[Category:Functions (GECK Vegas 1.1)]]
[[Category:Functions (GECK Vegas 1.1)]]
[[Category:Godsend Functions]]
[[Category:Godsend Functions]]

Latest revision as of 07:27, 14 December 2016

< [[::Category:Functions|Category:Functions]]

Link to TES4 Construction Set Wiki: ObjectUnderReticle.

A function included in the GECK Version 1.1.0.262 for Fallout: New Vegas.

Description

Yields an object an arbitrary distance away from the crosshairs.

Syntax

[help]
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 it is not limited to 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

See Also