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.
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.
you could also use do method using a integer variable that gets incremented each time you find one of the objects.
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
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.