LineOfSightObject(object, object)
Is there a line of sight between two objects.
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 GetFirstObjectInShape/GetNextObjectInShape, 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 for single target or ground targeted spells.
Note that LOS is done at a Z = Ground Height + 1.0. NWN LOS is...pretty wacky (given it's a 2.5D game, this means something "flying up high" could be invisible if they're standing behind a small rock still, and that Dragons who are huge could be hidden by a small wall).
Version
1.61
Example
void main()
{
object oTarget=GetObjectByTag("bob");
int bCanISee=LineOfSightObject(OBJECT_SELF, oTarget);
}
See Also
functions: |
author: Lilac Soul, editor: Jasperre