Difference between revisions of "HasLOS - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rhavlovick
m (1 revision: Clobber re-import by Henning)
 
imported>Thingy Person
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
'''Member of:''' [[Actor Script]]
'''Member of:''' [[Actor Script]]


Checks to see if this actor as line-of-sight to the target object. Note that only the player can get line-of-sight to a non-actor.
Checks to see if this actor has line-of-sight to the target object. Note that only the player can get line-of-sight to a non-actor.


If called on the player, HasLOS clips the line-of-sight check to the camera, so HasLOS will return false if the camera cannot see the object (even if there is a clear line-of-sight outside the camera's view). Also, three picks will be made at top, middle, and bottom. If '''any''' of the picks are unobstructed then HasLOS will return true.
If called on the player, HasLOS clips the line-of-sight check to the camera, so HasLOS will return false if the camera cannot see the object (even if there is a clear line-of-sight outside the camera's view). Also, three picks will be made at top, middle, and bottom. If '''any''' of the picks are unobstructed then HasLOS will return true.
Line 28: Line 28:
== See Also ==
== See Also ==
*[[Actor Script]]
*[[Actor Script]]
*[[OnGainLOS - Form]]
*[[OnLostLOS - Form]]

Latest revision as of 12:36, 16 February 2021

Member of: Actor Script

Checks to see if this actor has line-of-sight to the target object. Note that only the player can get line-of-sight to a non-actor.

If called on the player, HasLOS clips the line-of-sight check to the camera, so HasLOS will return false if the camera cannot see the object (even if there is a clear line-of-sight outside the camera's view). Also, three picks will be made at top, middle, and bottom. If any of the picks are unobstructed then HasLOS will return true.

Syntax[edit | edit source]

bool Function HasLOS(ObjectReference akOther) native

Parameters[edit | edit source]

  • akOther: The object to check line-of-sight to.

Return Value[edit | edit source]

True if this actor has line-of-sight to the object.

Examples[edit | edit source]

; Can the player see bob?
if (Game.GetPlayer().HasLOS(Bob_Alias.GetReference()))
  Debug.Trace("The player can see Bob")
endIf

See Also[edit | edit source]