FirstThingInView


Returns the thing with the highest thing number that meets the given FOV and mask requirements. FTIV() will find things behind walls; so HasLOS() should be used to make sure the player can see whatever FTIV() returns. Like other verbs that return a value, FTIV() will return -1 if is given the right parameters but cannot find anything. Syntax:

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).