Category: Objects
/ Search
Since engine version: 1.0 OC
FindObject
Description
Returns an object fulfilling the specified search criteria. Search criteria are composed of special Find_x() values.
Syntax
object FindObject(array Criteria, ...);
Parameters
- Criteria:
- Search criterion in the form of a Find_* function
- ...:
- [opt] Additional search criteria in the form of Find_* functions
Remarks
An object using FindObjects in local calls will also find itself. This can be avoided through use of Find_Exclude().
Search criteria are specified as in FindObjects and ObjectCount. See FindObjects for additional samples.
An object using FindObjects in local calls will also find itself. This can be avoided through use of Find_Exclude().
When this function is called in object context, only objects in the same layer as the calling object are considered, i.e. an implicit check Find_Layer(GetObjectLayer()) is added. To turn off this check, either supply a manual criterion with Find_Layer() to check for another layer, or allow objects in any layer to be returned by passing Find_AnyLayer().
Example
if(FindObject(Find_Distance(10), Find_OCF(OCF_CrewMember), Find_Hostile(GetOwner())) Explode(20);
If an enemy clonk gets closer than 10 pixel to the object, it explodes.
See also: FindObject, FindObjects, Find_Action, Find_ActionTarget, Find_ActionTarget2, Find_ActionTargets, Find_Allied, Find_And, Find_AnyContainer, Find_AnyLayer, Find_AtPoint, Find_Category, Find_Cone, Find_Container, Find_Distance, Find_Exclude, Find_Func, Find_Hostile, Find_ID, Find_InArray, Find_InRect, Find_Layer, Find_NoContainer, Find_Not, Find_OCF, Find_OnLine, Find_Or, Find_Owner, Find_Property, Find_Team, ObjectCount, Sort_Distance, Sort_Func, Sort_Mass, Sort_Multiple, Sort_Random, Sort_Reverse, Sort_Speed, Sort_Value