I found this function
function AIPlayer::hFindClosestPlayerFOV( %bot, %range, %hear )
{
%type = $TypeMasks::PlayerObjectType;
//Need to scale it to the player
%scale = getWord(%bot.getScale(),0);
//FOV Search
// %a = 1.2*%range*%scale;
// %b = 1*%range*%scale;
// %pos = vectorAdd(%bot.getPosition(),vectorScale(%bot.getEyeVector(),3.5*%scale+%a));//+1.5// default is 5 : 1//Switched to eye vector to see how it reacts RoTemp
// %radius = %b;//+1
%pos = %bot.getPosition();
if(%bot.hSearchRadius == 0)
%bot.hFinalRadius = 0;
else
%bot.hFinalRadius = brickToRadius( %bot.hSearchRadius )*%scale;
if(%bot.hSearchRadius == -2)
%bot.hFinalRadius = 2000000000;
%n = 0;
initContainerRadiusSearch( %pos, %bot.hFinalRadius, %type );
while( ( %target = containerSearchNext() ) != 0 )
{
%target = %target.getID();
if( %bot == %target )
continue;
if( !%bot.hFOVCheck( %target ) ) // <= 0.7 )
continue;
if( %target.getState() !$= "Dead" && !%target.isCloaked && %bot.hIgnore != %target && checkHoleBotTeams(%bot,%target) && hLOSCheck(%bot,%target) && miniGameCanDamage( %target, %bot ) == 1)
{
return %target;
}
}
if(%bot.hHearing && %hear)
{
%pos = %bot.getPosition();
initContainerRadiusSearch( %pos, %bot.hFinalRadius/2, %type );
while((%target = containerSearchNext()) != 0)
{
%target = %target.getID();
%speed = vectorLen( %target.getVelocity() );
if(%bot != %target && %speed > 3 && %target.getState() !$= "Dead" && !%target.isCloaked && checkHoleBotTeams(%bot,%target, 1) && miniGameCanDamage( %target, %bot ) == 1)
{
%bot.clearMoveY();
%bot.clearMoveX();
%bot.maxYawSpeed = 10;
%bot.maxPitchSPeed = 10;
%bot.setAimLocation( vectorAdd(%target.getPosition(), "0 0 2") );
if(%bot.hEmote)
%bot.emote(wtfImage);
cancel(%bot.hFOVSchedule);
%bot.hFOVSchedule = %bot.scheduleNoQuota( 500, hDoHoleFOVCheck, 0, 0, 0 );
return -1;
}
}
}
return 0;
}
Sorry for the big function but I need to know if this is what I need and if so, how to use it.