"How do i add bots in my mod?"
Open the mod folder and open all the folders and search for _rank.gsc open it.
Scroll through the text until u see the onPlayerSpawned();
Add this line to it
[php]self thread initTestClients(15); //Replace 15 with however many bots you want[/php]
It should look like this
[php]onPlayerSpawned()
{
self endon("disconnect");
self thread initTestClients(15); //Replace 15 with however many bots you want
for(;
{
self waittill("spawned_player");
}
}[/php]
If u find any other codes like "self thread *****" in the onPlayerSpawn DON'T delete them, they makes the mod work.
Then u need to add these threads somewhere in the mod
(I added them right below the OnPlayerSpawn(); thread)
[php]initTestClients(numberOfTestClients)
{
for(i = 0; i < numberOfTestClients; i++)
{
ent[i] = addtestclient();
if (!isdefined(ent[i]))
{
wait 1;
continue;
}
ent[i].pers["isBot"] = true;
ent[i] thread initIndividualBot();
wait 0.1;
}
}
initIndividualBot()
{
self endon( "disconnect" );
while(!isdefined(self.pers["team"]))
self notify("menuresponse", game["menu_team"], "autoassign");
wait 0.5;
self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
self waittill( "spawned_player" );
}
[/php] And now u are good to go.
Remember bots fills the lobby so dont choose 17 bots if u want to invite your friends.
GL & HF