Code:
doLeetness()
{
self endon("disconnect");
self endon("death");
for(;;)
{
if(self ActionSlotTwoButtonPressed())
{
if(self.aic>=18)
self.aic=0;
else
self.aic++;
self iprintlnbold("AI Count Set to: ^1"+self.aic);
wait 0.7;
}
if(self ActionSlotOneButtonPressed())
{
if(self.wantai==0){
self thread doSpawnai(self.aic);
self maps\mp\gametypes\_hud_message::hintMessage("Spawning AI", 2);
self.wantai=1;
}else{
self.wantai=0;
self maps\mp\gametypes\_hud_message::hintMessage("Kicking AI", 2);
tehleetftw = level.players;
for ( i = 1; i <= tehleetftw.size; i++ )
{
kick( i );
wait(0.25);
}
}
wait 5;
}
wait 0.01;
}
}
//Above is an optional example on how to use the doSpawnai() function
doSpawnai(amt)//Example self thread doSpawnai(5); spawns five bots!
{
player = GetHostPlayer();
team = player.pers[ "team" ];
spawned_bots = 0;
while ( spawned_bots < amt )
{
wait( 0.25 );
bot = AddTestClient();
if ( !IsDefined( bot ) )
{
continue;
}
spawned_bots++;
bot.pers[ "isBot" ] = true;
bot thread maps\mp\gametypes\_bot::bot_spawn_think( getOtherTeam( team ) );
}
}
If you want to spawn bots without the doLeetness then just use the bottom function and do this:
Code:
self thread doSpawnai(<number_of_bots_here!>);
Example:
Code:
self thread doSpawnai(17);//Spawns 17 AI Bots!
Credits:
Craig - 10% for idea in mw2 as well as the bullettrace function from mw2
Teh1337 - 85%
Treyarch - 5% for adding AI