How to end level after collecting all items?

Hello,
I am really new to UE4 and cannot find an answer to this. I did do a lot of research to try and find an answer before asking here, but all I can find is a lot of pieces that I can’t put together to make it work.

I am making a 2D scroller game and when all of the items in the level are collected, the level ends. I have read a lot about other similar issues, but I cannot find something that will help me. I am not asking for someone to do it for me, I just need a push and maybe some blueprint snippets that can get me in the correct direction.

I appreciate all help and again I am brand new so simplest terms are extremely appreciated.

Using 4.7.6

Thank you.

Well if it’s specific collectibles it would make sense to do a parent class “Collectible”, then do your specific collectibles.

Place those in your level and then whenever you pick up one (wherever you decide to handle this) do a “Get All Actors Of Class”. This will provide you with an array of all actors of a specific class. If you select your “Collectible” class there it will select all child classes so as soon as the length of the resulting actor is 0 you should do your level end routine.

Another way would be doing the same via the level blueprint. Simply reference all actors and bind “On Event Destroyed”. If it happens set a boolean in an array or check somehow if all actors are collected. If so end the level.

The first solution is more dynamic but requires you to create a new actor class for every collectible while you could use everything in the second method.

Cheers

could you provide examples please?

Hello

First of all a quick note, this is in UE4.12.2

I have done something similair for a zombies game mode, here is what I did:
I created an interface wtih a function called “Change of num zombies”, in this there is a function with just one node that contains the input: NumOfZombies
I have I manager class and a zombie class which both have this interface.
In the zombies class I have an event destroyed. when this is called I send a interface message to the manager and all zombies(I would reccomend you making a base class for the collectables). with the new number of zombies

Then in my manager class I check if the number is <= 0 and in my ase update the wave, in your case you end the level.

94330-updated+numzombies.png