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"

State Checking

I have tiles that toggle on and off when someone steps on them. The object of the game is to activate all the tiles. I just need some way to check if all of my tiles are active. I already have a boolean set up for this. what would be the most efficient way to go about this?

Product Version: UE 4.16
more ▼

asked Jun 03 '17 at 04:01 PM in Blueprint Scripting

avatar image

1 3 5 11

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

2 answers: sort voted first

You can use the Get All of Actors of class node, and then select your tile blueprint. This will give you an array with all your tiles in it. You can loop through these and make sure they are all activated by checking your boolean.

Hope this helps, be sure to mark answer as correct if I helped, leave a comment if you need more help :)

more ▼

answered Jun 03 '17 at 04:09 PM

avatar image

Reuben Ward
343 8 4 16

avatar image Slashscreen Jun 03 '17 at 07:45 PM

how can I test for am individual boolean

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

The best way to approach this is, in my opinion, to have a parent blueprint that acts as a manager. Let us call it the MapBlueprint. Each MapBlueprint spawns NxN tiles where each tile is either off. Then, this manager class stores a variable that holds the number of total tiles as well as the number of activated tiles. Each time a tile switches it calls a function of the manager class that increments or decrements the NumActiveTiles variable, followed by a call to a function that checks if the game is finished by comparing the two variables. If NumActiveTiles == NumTotalTiles, then the game is done.

This is the most effective way to solve this problem from a performance point of view. Using the node GetAllActorsOfClass is much slower since it requires the code to loop through all objects in your game and then loop through each tile every time you change a tiles state. If you do it on tick, you would have to do it every single frame.


more ▼

answered Jun 03 '17 at 05:50 PM

avatar image

2.7k 107 35 180

(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