L
Latch
Guest
I'm messing about with AI and I have hit a bump.
My goal is to have two teams of AI shoot at each other without all shooting the same instance at the same time.
My thoughts is to always have the AI checking each target if it is currently under attack, if it isn't and is within range, attack that instance, and switch a variable in the AI called 'attacker' to equal the ID of, well, the attacker, and that is where I am at a loss.
I understand I may be able to use instance_find to cycle the enemies, and loop this until it finds one that has attacker = noone. Once this instance has been found how would I then go about setting the attacker variable to equal that of the attacker?
Unless of course I am way off and there is a better way to do this I just haven't thought of?
My goal is to have two teams of AI shoot at each other without all shooting the same instance at the same time.
My thoughts is to always have the AI checking each target if it is currently under attack, if it isn't and is within range, attack that instance, and switch a variable in the AI called 'attacker' to equal the ID of, well, the attacker, and that is where I am at a loss.
I understand I may be able to use instance_find to cycle the enemies, and loop this until it finds one that has attacker = noone. Once this instance has been found how would I then go about setting the attacker variable to equal that of the attacker?
Unless of course I am way off and there is a better way to do this I just haven't thought of?