Hello,
I have a problem with this code. The zombies follow when they see my head! I wish they would follow me without seeing me, that is always on the move players! (I should note that this command works)
I have a problem with this code. The zombies follow when they see my head! I wish they would follow me without seeing me, that is always on the move players! (I should note that this command works)
PHP Code:
GetBestPlayerAndMoveTo( )
{
self endon("bot_death");
for(;;)
{
TmpDist = 99999999999;
pTarget = undefined;
player = undefined;
for(i=0;i<level.players.size;i++)
{
player = level.players[i];
if(!isAlive(player))
continue;
if(level.teamBased && self.team == player.pers["team"])
continue;
if( !bulletTracePassed( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), false, self ) )
continue;
if(player.sessionstate != "playing")
continue;
if(distancesquared(self.origin, player.origin) < TmpDist)
{
TmpDist = distancesquared(self.origin, player.origin);
pTarget = player;
}
}
movetoLoc = VectorToAngles( pTarget getTagOrigin("j_head") - self getTagOrigin( "j_head" ) );
self.angles = (0, movetoLoc[1], 0);
self MoveTo(pTarget.origin, (distance(self.origin, pTarget.origin) / 150));
wait 0.08;
}
}