1
0
EQ2Emu/docs/lua_functions/CheckLOS.md
2025-05-28 21:48:33 -04:00

19 lines
681 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### Function: CheckLOS(Origin, Target)
**Description:** Checks line-of-sight between two spawns. Returns true if Origin can “see” Target (no significant obstacles in between), false if line of sight is blocked.
**Parameters:**
`Origin`: Spawn The entity from whose perspective to check line of sight.
`Target`: Spawn The entity to check if visible.
**Returns:** Boolean true if there is line-of-sight; false if something blocks the view between origin and target.
**Example:**
```lua
-- Example usage (sniper NPC only shoots if it has line of sight to the player)
if CheckLOS(SniperNPC, Player) then
CastSpell(SniperNPC, SNIPER_SHOT_ID, 1, Player)
end
```