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"

How to play a sound once all 4 objects are found?

I apologize if a question like this has already been asked but I can’t seem to figure it out. I’m fairly new to UE4. But let’s say I have a cube, sphere, and a cylinder all in different parts in the level and once you find all three (in no particular order) then a sound plays.

I tried setting up a blueprint were you press “F” within the bounds of 1 of the three objects and it toggles a bool but I believe my issue comes down to referencing the three objects together and seeing once all 3 bools are true to play the sound.

Thanks for any and all help. :)

Product Version: UE 4.21
more ▼

asked Feb 21 '19 at 01:17 PM in Blueprint Scripting

avatar image

1 1 1

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

1 answer: sort voted first

Use something like the game instance (if you need to access this from other BPs for more than just playing a sound) or the level blueprint which can easily create references to your selected objects in the world. When you collect one, have it set a bool to true. So you need 4 bools, 1 for each object and when you collect each one set the bool to true, and after have a branch node with an AND bool that checks all 4 booleans if they are true or not. If all 4 are true, execution flows through the branch and a sound is played. If any one are false, execution flows out the false pin and nothing happens.

more ▼

answered Feb 21 '19 at 02:06 PM

avatar image

Nebula Games Inc
4.9k 27 9 14

avatar image ThompsonN13 Feb 21 '19 at 02:36 PM

you could also use do method using a integer variable that gets incremented each time you find one of the objects.

avatar image BAIL3YISTHEB3ST Feb 21 '19 at 05:23 PM

Thank you both for your replies. How would I go about doing it the integer variable way? I figured out the level blueprint way. I wanna learn both ways to educate myself for the future. Thanks

avatar image ThompsonN13 Feb 21 '19 at 10:51 PM

for the integer method you would just need one variable and when you pickup a item you increment the variable ( add one), then you check the variable against a preset value (in your case 4). this is a useful method for something like a door with many switches required. it works well in the door case since you can easily target a door actor for direct communication.

its not something that can easily be done in the level bp though since its hard to reference the level bp. though i suppose you could base it on the pickup actor being destroyed like in the below example.

alt text

capture.png (179.9 kB)
(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