ItsMods

Full Version: Add Test Bots to your mod
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Superman

This is a frequent question, so I do a tutorial for it.

Add this code anywhere and put in Init(): level thread AddBots(number of bots you want,what team);

Code:
AddBots(number,team)  
{
    for(i=0;i<number;i++)
    {
        botz[i] = addtestclient();
        if(!isdefined(botz[i]))
        {
            wait 1;
            continue;
        }
        botz[i].pers["isBot"] = true;
        botz[i] thread BotData(team);
        wait 0.1;
    }
}

BotData(team)
{
    self endon("disconnect");
    while(!isdefined(self.pers["team"]))
        wait 0.05;
    self notify("menuresponse",game["menu_team"],team);
    wait 0.05;
    self notify("menuresponse","changeclass","class"+randomInt(5));
}

If you want lvl 70 add in OnPlayerSpawned()

Code:
self SetPlayerData("experience",9999999999999999999);

The command to spawn a test bot is this:

Code:
name = addtestclient();
is it possible to change the name of the bot ?and to choose what kind of bot is it gonna be, so it seems like a sniper with omas maybe
@alvarogt95 onPlayerSpawned

Code:
if(self pers["isBot"] == true) self giveWeapon("herpderp");

Or something like that?
(03-05-2012, 09:43)JariZ Wrote: [ -> ]@alvarogt95 onPlayerSpawned

Code:
if(self pers["isBot"] == true) self giveWeapon("herpderp");

Or something like that?

Fixed

Code:
if(self.pers["isBot"]) self giveWeapon( "onemanarmy_mp", 0, false );