Background for Fallout 4
Member of the ObjectReference script
boolfunctionHasDirectLOS(ObjectReferenceakTarget, stringasSourceNode="", stringasTargetNode="")Native

Description

Wiki Description

Checks to see if this reference has line-of-sight to the target object.

Documentation Comment

Checks to see if there is a direct line-of-sight between us and the target, using the specified nodes
If the node strings are empty, the check will be done from the roots of the objects


Caveats

CK Wiki - Notes

  • Most of the time you actually want to use Actor.HasDetectionLOS(...) on Actor instead as that takes other things into account and may perform a better pick.

Parameters

ObjectReferenceakTarget

CK Wiki Description

The object to check line-of-sight to.

stringasSourceNode=""

CK Wiki Description

The node to cast the line of sight check from. If empty, will cast from the root of the object.

  • Default:""

stringasTargetNode=""

CK Wiki Description

The node to cast the line of sight check to. If empty, will cast to the root of the object.

  • Default:""

Examples

; Can the spotlight "see" bob?
if (SpotlightRef.HasDirectLOS(Bob_Alias.GetReference()))
  Debug.Trace("The spotlight can see Bob")
endIf
; Can the spotlight "see" bob's head?
if (SpotlightRef.HasDirectLOS(Bob_Alias.GetReference(), asTargetNode = "Head"))
  Debug.Trace("The spotlight can see Bob's head")
endIf

Auto-Generated Example

ObjectReference myObjectReference__akTarget
string myString__asSourceNode
string myString__asTargetNode

bool returnedValue = myObjectReference__toCallFunctionOn.HasDirectLOS(myObjectReference__akTarget, myString__asSourceNode, myString__asTargetNode)

Related Pages


Additional References

View this function’s page on the Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.