How to I check for length of an array append?

Hello, I am attempting to create a win-state when all of two different enemy types in the level are dead/gone. I have attached the code that I’ve tried to create.

I’m trying to check for the length of both of these enemy bp’s (array appended together), triggering a print text when the length is equal to 0. But I don’t know how to check for the length of both of the BP’s and not just one.

Any help is appreciated. Thank you!

Why not just create an array of type actor or even object => basically a base class to these two classes and add to that array in the final step just get it’s length.

Edit => Simplified sum function:


It would be better to have a dispatcher on each enemy that is called on their death.

Then have an actor => an enemy manger that binds to the dispatch and calls an event on enemy death

enemyCounter.zip (152.2 KB)

Click to destroy enemies.

The bp could be optimized to cache the ui into a map and just use that as a target instead of recreating it but it’s not worth the effort for a test project

UI

Thanks so much! I’ll check these solutions out and will update when I do.

Hey, how did you get the “mixed class local” array? Is that an array containing both enemy classes?

you can either put the base class or even a base actor. You can even put a base object :).

As long as the array class type encompass both classes it can be used.

okay, thanks for the information! I ended up making them the same base class and tweaking the individual parameters. But for the future, your 2nd solution definitely helps.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.