08-15-2013, 04:38 AM
Code:
int get_closest_enemy(){
int lowest = 99999;
int final;
for(i = 0; i <= 399; i++)
{
if (loadTarget(i)!=-1 && xdistance < lowest)
{
lowest = xdistance;
final = i;
}
}
return final;
}
loadTarget() itself returns the object type of the loaded object; -1 if it doesn't exist.
(change !=-1 into ==0 and also add a team check to only get enemies - this one will actually get the closest object right now)
favorite dcing techniques: wpoint | double key inputs | holding back | alternate basic moves