LineOfSightObject(object, object)

Is there a line of sight between two objects

int LineOfSightObject(
    object oSource,
    object oTarget
);

Parameters

oSource

Source object

oTarget

Target object


Description

Returns whether or not there is a direct line of sight between the two objects. (Not blocked by any geometry).

PLEASE NOTE: This is an expensive function and may degrade performance if used frequently.



Remarks

With this function came a fix to GetFirst/NextObjectInShape, and makes sure fireballs do not go through walls or doors.

This is hardly ever needed practically - for spell scripts, it is not required unless an area-of-effect spell doesn't use GetFirst/NextObjectInShape, because the game already has internal restraints on Line-Of-Sight checks.


Version

1.61

Example

//Can I see bob?
void main()
{
object oTarget=GetObjectByTag("bob");

int bCanISee=LineOfSightObject(OBJECT_SELF, oTarget);
}

See Also

functions: LineOfSightVector
categories: Get Data Functions | Targeting Functions


 author: Lilac Soul, editor: Jasperre