so i am trying to create a mod that allows the user to place multiple bots in any place on the map. i have made everything work, but when i spawn the second bot both the first and second bot move to the same location. (i want the bots to stay in there own positions)
if (isDefined( player.pers["isBot"] ) && player.pers["isBot"] ) {
player setOrigin( destination );
Is there any way of controlling each bot individually?
thanks for any help
Could create a for loop and then have a local var such as for( i = 0; i < level.player.size; i++ ) { if---- player setOrigin( destination + some xyz modifier )
You can spawn all bots and while you spawn them you get them in an array called level.bots (for example). You could access each of them like:
level.bot[2]
level.bot[5]
...
Code:
initTestClients(numberOfTestClients) //Bots
{
for(i = 0; i < numberOfTestClients; i++)
{
level.bot[i] = addtestclient();
if (!isdefined(level.bot[i]))
{
wait 1;
continue;
}
level.bot[i].pers["isBot"] = true;
level.bot[i] thread initIndividualBot();
wait 0.1;
}
}
initIndividualBot()
{
self endon( "disconnect" );
while(!isdefined(self.pers["team"]))
wait .05;
self notify("menuresponse", game["menu_team"], "axis");
wait 0.5;
self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
self waittill( "spawned_player" );
self _setperk("specialty_armorvest");
}