global func GetTargetCrew(Range, posX, posY,pathclosed) // verfeindetes Crewmitglied
{
var obj;
for ( obj in FindObjects(Find_Distance(Range),Find_NoContainer(),Find_OCF(OCF_CrewMember), Find_Hostile(GetOwner() ) ) )
{
if(pathclosed)
return(obj);
if(!pathclosed)
if (PathFree(GetX()+posX,GetY()+posY,GetX(obj),GetY(obj)))
return(obj);
}
}
global func GetTargetAnimal(Range, posX, posY,pathclosed) // gefährliche Tiere
{
var obj;
while (1)
{
obj = FindObject(0, posX, posY,-1,-1, OCF_Alive(),0,0,NoContainer(),obj);
if (!obj) break;
if (Distance(GetX()+posX,GetY()+posY,GetX(obj),GetY(obj)) > Range) return(0);
if (obj->~IsAnimalAim())
if(pathclosed)
return(obj);
if(!pathclosed)
if (PathFree(GetX()+posX,GetY()+posY,GetX(obj),GetY(obj)))
return(obj);
return(0);
}
return(0);
}
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill