Warhorse ScripBind documentation
ContentsIndexHome
PreviousUpNext
CScriptBind_AI::FindObjectOfType Method
Syntax
C++
int FindObjectOfType(IFunctionHandler* pH);
Parameters 
Description 
entityId 
AI's entity id as a center position of the search (if 1st parameter is not a vector) 
position 
center position of the search (if 1st parameter is not an entity id) 
radius 
radius inside which the object must be found 
AIObjectType 
AIObject type; see ScriptBindAI.cpp and Scripts/AIAnchor.lua for a complete list of AIObject types available 
flags 
filter for AI Objects to search, which can be the sum of one or more of the following values: ! AIFAF_VISIBLE_FROM_REQUESTER: Requires whoever is requesting the anchor to also have a line of sight to it ! AIFAF_VISIBLE_TARGET: Requires that there is a line of sight between target and anchor ! AIFAF_INCLUDE_DEVALUED: don't care if the object is devalued ! AIFAF_INCLUDE_DISABLED: don't care if the object is disabled 
(optional) returnPosition 
position of the found object 
(optional) returnDirection 
direction of the found object 

the found AIObject's name (nil if not found)

!

AI.FindObjectOfType( entityId, radius, AIObjectType, flags [,returnPosition [,returnDirection]] ) ! AI.FindObjectOfType( position, radius, AIObjectType, [,returnPosition [,returnDirection]] ) !

! returns the closest AIObject of a given type around a given entity/position; ! once an AIObject is found, it's devalued and can't be found again for some seconds (unless specified in flags). ! !  

!  

!  

!  

!  

!  

!  

!  

static void DrawDebugBox(const AABB& aabb, uint8 r, uint8 g, uint8 b, float t) { Vec3 verts[8]; 

verts[0].Set(aabb.min.x, aabb.min.y, aabb.min.z); verts[1].Set(aabb.max.x, aabb.min.y, aabb.min.z); verts[2].Set(aabb.max.x, aabb.max.y, aabb.min.z); verts[3].Set(aabb.min.x, aabb.max.y, aabb.min.z); 

verts[4].Set(aabb.min.x, aabb.min.y, aabb.max.z); verts[5].Set(aabb.max.x, aabb.min.y, aabb.max.z); verts[6].Set(aabb.max.x, aabb.max.y, aabb.max.z); verts[7].Set(aabb.min.x, aabb.max.y, aabb.max.z); 

gEnv->pAISystem->AddDebugLine(verts[0], verts[1], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[1], verts[2], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[2], verts[3], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[3], verts[0], r, g, b, t); 

gEnv->pAISystem->AddDebugLine(verts[4], verts[5], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[5], verts[6], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[6], verts[7], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[7], verts[4], r, g, b, t); 

gEnv->pAISystem->AddDebugLine(verts[0], verts[4], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[1], verts[5], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[2], verts[6], r, g, b, t); gEnv->pAISystem->AddDebugLine(verts[3], verts[7], r, g, b, t);

Copyright (c) 2012. All rights reserved.