SophosMoros
Member
I may be doing this all wrong but I have an issue with targeting. I have a unit and a base and I'm trying to tell the units to target the units first and if there are no units around to target the base.
Do I need to set a range around the target base and say if it's clear within a range of the base or is there a better way of doing this?
Currently this solution works just fine unless there are multiple bases. Which there will be. I want to fix this to where as long as there are no enemies in the area of that base they can shoot the base. Right now it's waiting until there are no enemy units in the entire level before it will attack a base.if(instance_exists(obj_enemy_ant)&& instance_nearest (x, y, obj_enemy_ant))
{
foe = instance_nearest(x, y, obj_enemy_ant);
}
else if(instance_exists(obj_enemy_base) && instance_nearest(x,y,obj_enemy_base))
{
foe = instance_nearest(x, y, obj_enemy_base);
}else{
foe = -1
}
Do I need to set a range around the target base and say if it's clear within a range of the base or is there a better way of doing this?