thing=FirstThingInView(view_thing, FOV, distance, mask_flags);
view_thing: This is the thing whose view will be used.
FOV: This is the field of view to look inside of. See the picture below. Despite the picture, the field of view is three dimensional.
distance: This should be the distance in JKUs from the view_thing, but FTIV() will find things well past the given distance. Set this number to the distance that you want, but use VectorDist() and GetThingPos() to check the distance.
mask_flags: The Mask Flags screen out things that should not be returned. The most common combination of Mask Flags is 0x404. This will return only players (0x400) and actors (0x4).