I’m currently making a 3D platformer and have multiple of the same collectables put throughout the level. I’m trying to set it so that if you collect all of them in the level, a prompt tells you “YOU WON” and you can go to the next level. I searched for similar questions but couldn’t find the exact answer I’m looking for. I’d appreciate the help.
So make a blueprint (BP_Collectables) for example. In viewport add Box Collision or Sphere Collision. Bind OnBeginOverlap on that collision and you will have a callback everytime something goes through that collision (including player). Handle anything you need there.
This is a bad practice but can help you: When pickup collectables you can GetAllActorsOfClass, Get(0) on that array and check if iits Valid. If its Not Valid means you have none of the actors on the level (you picked all of them)
NOTE: i posted no pictures so that you start exploring ue4 (: . happy coding
I tried a few different methods with the GetAllActorsOfClass. And even tried making a function, but still no luck. I’m probably making a dumb mistake but I don’t understand what.
This is what I set up.
I would use the GetAllActorsOfClass in the BeginPlay to store a integer TotalColectibles contaning the quantitny of all the collectibles in the level (considering this value won´t change) and then in another integer CurrentCollectibles you add +1 everytime you get a new collectibles and in the same function check if TotalCollectibles = CurrecntCollectibles. This way you will be able to use the variables to show to the player in a HUD
I did this exact thing in my beginner series you can jump around for the parts you need. Specifically video #11 goes over the part I think you are struggling with. Check it out and let me know if it helps.
And I would want to add these integers in the event graph and not into a function right? And should I place the GetAllActors before or after the CastToPlayer?