For that problem, heres a solution:
Each bot has a sepearate Int, String or Array dpending on which works. Once a bot sees an enemy, his Int/String/Array will change to that targets GUID/IP, or if its another bot, the bots personal number, and attack the target until the bot or the target dies, which then makes the int go back to 0, or another number indicating they have no target. Like this:
Sorry for my fail coding and use of TAB:
Of course a LOT more code is needed, but here are some basics. I also included a part to prevent a bot from TKing if putteamed and found a target.
Int/Array/String bot1 = 0
{
If (botnumber1 SeeEnemyTarget)
{
if EnemyTarget = bot
{
bot1 = EnemyBotNumber;
}
if EnemyTarget = player
{
Bot1 = EnemyPlayerGUID;
}
}
if (bot1 != 0) //The whole following process was mainly to reduce Teamkilling when putteamed
{
SearchGuid
{
If (SearchGuid = False) /*If it doesn’t find the GUID/*
{
SearchBotNumber
{
If (SearchBotNumber = True) /* does find the bot with this number*/
{
If Bot1 = Teammate/*Putteamed?*/
{
Bot1 = 0;
}
If BotNumber = Enemy
{
EngageBotNumber;
}
}
If (SearchBotNumber = False) /* doesn’t find the bot with this number*/
{
Bot1 = 0
}
If (SearchGuid = True) /*Found a matching GUID*/
{
If Bot1 = Teammate
{
Bot1 = 0;
}
If Bot1 = Teammate
{
EngageGUID
}
}
If (Botnumber1 = died)
{
Bot1 = 0;
}
If (Bot1Target = died)
{
Bot1 = 0;
}
}