OSRS Plugin API
    Preparing search index...

    Function lineOfSight

    • Returns whether there is a line of sight from the starting coordinate to the end coordinate. Returns false if not in direct line of sight or if the given coordinates are on different levels.

      Parameters

      Returns boolean

      function testSight(startingCoord, endCoord)
      local color = osrs.Colour.new(255, 255, 0, 100)
      osrs.ClientOp.highlightTileOn(endCoord:toBitPacked(), 6, true);
      if(osrs.Collision.lineOfSight(startingCoord, endCoord)) then
      osrs.print("This tile is within line of sight")
      else
      osrs.print("This tile is not within line of sight")
      end
      end

      local playerCoord = osrs.ClientOp.coord()
      testSight(playerCoord, playerCoord:move(0,2,0))
      testSight(playerCoord, playerCoord:move(0,-2,0))