Hallo everybody.
I have two armies (10 vs 10) with are suppose to fight against another.
My problem is, I don`t know how to create a local targets for each AI. The target they search now is global.
So Team A looks for:
ENTITY* enemy_target;While Team b looks for:
ENTITY* ally_target;Team A searching code:
function AI_find_target()
{
result = c_scan(my.x, my.pan, vector(360,180,2000), SCAN_ENTS | SCAN_LIMIT | IGNORE_ME);
if(result > 0)
{
if(you.team != my.team)
{
while ((vec_dist (my.x, you.x)<2000) && (you.health>0))
{
enemy_target = you;
wait(1);
}
enemy_target = NULL;
}
}
}
Team B searching code:
function AIfriendly_find_target()
{
result = c_scan(my.x, my.pan, vector(360,180,2000), SCAN_ENTS | SCAN_LIMIT | IGNORE_ME);
if(result > 0)
{
if(you.team != my.team)
{
while ((vec_dist (my.x, you.x)<2000) && (you.health>0))
{
ally_target = you;
wait(1);
}
ally_target = NULL;
}
}
}
Obviously this can`t work as soon there are more AIs on each side...
Any ideas how to make this better?