Hello, TLDR: How do I determine when all actors have ended their overlap?
Enemies enter trigger box and the flag lower timeline plays. Once completed run the raise flag timeline. If enemies are killed or just leave the trigger box then stop the timeline. However, if 3 enemies are in the trigger box and if one leaves the box (leaving 2 inside) the flag stops. This is happening due to the component ending overlap being triggerd by the one that left.
I have tried the following below which is getting overlapping actors and setting the length of the array to a variable and then hook a branch after the end overlap.
I was going to suggest something like that! Get the Length of overlapping actors and then when one leaves, check if that Length <= 0. Don’t set it as a variable, though, unless you update it every time one ends overlap or is killed. This will also need to be run if an enemy is killed and destroyed within the flag radius, which is more of a dealer’s choice situation on that. I am actually not sure if something being destroyed triggers “On Component End Overlap”.
I’d suggest a function that you can run with all of that, and run it during both instances so it’s one set of code.
Hope this helps, let us know if you have any questions!
Thank you for the feedback. I tried to compare the length of the array coming form overlapping actors to <= 0. If true then stop flag movement. However, this does not work as the flag stops when one enemy leaves the base and there is another another enemy in the base.
Ah I’m seeing something here I missed. You have “OtherActor” plugged into “GetOverlappingActors”.
“OtherActor” would be your enemies. So you’re checking to see if your enemies are overlapping your enemies, instead of if your enemies are overlapping your DropFlagEnemies.
You need to plug Self in here instead, and if that doesn’t work we need to rewrite it to use your collider component!