x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to end a level, after all items in level have been collected?

Hi there, I'm rather new to UE4 and I have created a simple level where you have some coins to pick up scattered throughout the level. I would like to create a system where you have to collect all the coins in order to progress to the next level. I've been looking around the forums and have been seeing the function node Get All Actors of Class and think this is probably the direction I have to go, but not certain. (May even be wrong). As of now I only have three levels a Main Map, Title Screen and Game Over screen, however I soon will be creating more levels and each one will have a random number of coins. So it is imperative that I use a system that checks to see if all coins in level have been destroyed (or collected). Any help would greatly be appreciated thanks.

Product Version: Not Selected
Tags:
more ▼

asked Nov 15 '14 at 08:25 PM in Using UE4

avatar image

Nevco24
36 2 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

I'd have collected objects be destroyed when they are picked up. Then after the destroy call get all objects of class (as you mentioned) if it returns nothing, they are all picked up :)

more ▼

answered Nov 15 '14 at 10:08 PM

avatar image

Justin.Dooley
2.1k 104 72 163

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hm, this is one of these points where i don't know WHERE to put it. You could make a variable inside your LevelScriptActor, or LevelBlueprint if you aren't using c++. If a player collects a coin, you could run a function inside this LevelBlueprint that increments the coint counter and after that, checks if a given maximum coint value is reached. After that you could show a UMG Widget (HUD) where a button lets the player continue to the next level.

But it could be that you might place this inside the GameState, rather than the LevelBlueprint :X hmpf.but in general you just create a variable where you add 1 if the player collects a coin and a variable that you set to a maximum value. If the value is reached, you either directly open the next level, or use the UMG like i said above.

more ▼

answered Nov 15 '14 at 08:44 PM

avatar image

eXi
6.8k 332 184 467

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

So first off thank you for the quick replies. After a bit research though, I found a solution in the Level Scripting Content example. Where I spawned all the coins in the level from the EventBeginPlay node then connected them to a Bind On Destroyed which then delegated a Custom event in which I checked to see if all coins had been collected and if so opened the new level. Still seems a little choppy, however it works for the meantime until I learn more in blueprints.

more ▼

answered Nov 16 '14 at 10:17 AM

avatar image

Nevco24
36 2 2 5

avatar image ultrask14 Jun 12 '16 at 10:21 AM

can you provide examples and screenshots?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question