Hello there,
I am having an issue with my AI scripting. I have set up an enemy character, as well as an actor called AiTarget. I have made the enemy create an array of all the targets, pick a random one, and move to it. Then, when it overlaps on the target point, the script is run again. This worked fine, until I modified it so that I could have multiple paths, with an enemy following a path each.
My way of managing this was to give the AiTarget an editable integer variable called ‘PathNumber’, and give the enemy character an editable integer variable called ‘target’. I then placed two enemy characters into the world, and 6 target points, half with a path number of 1, half with a path number of 2. I gave one enemy character a target of 1, and the other a target of 2. This is my blueprint for the enemy character:
First, I trigger on begin play, and when the character overlaps a targetPoint. This should make the script keep going.
I then go on to add every targetPoint to the array, and then remove ones that aren’t part of the target path.
Finally, I delay for between 2 and 8 seconds, then move to a random targetPoint in the array.
For some reason though, when I click play, the code works for a bit, and then one of the characters tends to stop moving, and the other starts going to points from both parts. Sometimes the last character then stops. The code works fine with one character. Here is a video showing what happens:
I have tried a few other methods as well, but to no avail. Any idea why the AI stops after some time? Help is much appreciated.
Thanks a lot.