02-24-2011, 15:06
How to add a speed command in GetBestPlayerAndMoveTo() ?
Quote:GetBestPlayerAndMoveTo( )
{
self endon("bot_death");
for(;
{
TmpDist = 999999999;
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) / 200));
wait 0.08;
}
}