Trigger Box and Key pressed

Hi, thank you for your answer! I tried your suggestion but it and it still doesn’t work properly. I explain it another time: Whenever I start the game outside the TriggerBox I can press “1” and the sound plays. If I then run into the TriggerBox and “OnActorBeginOverlap” and “OnActorEndOverlap” is triggered it works perfectly fine (Then the sound doesn’t play outside the TriggerBox). But why does my sound start at the beginning? Cheers.

Thanks dude, you saved my life. Another question is: I want to make several Triggerboxes in a room that will be activated by pressing “E”. By now all the “Code” is in my level blueprint. I’ve read several things, that it’s not really “good” to do these things in the level Blueprint. So where is the right place for this? Cheers dude!

Hey guys,
I attached a screenshot showing, what I’m trying to do. It works fine, whenever I walk into the TriggerBox and out of it. But if just start the game and press “1” (without going in and out of TriggerBox) the sound will be played. I’m looking for a way to stop this. It’s obvious that I just want this sound to be played, when I’m standing in the TriggerBox.

Hello ocamR!

Check the start closed and everything will be fine!

Oh! Sorry… I didn’t notice the overlap event…

Cast other actor to your character and plug in to open and close gate. That way you avoid other actors triggering the overlap and enable the sound.

It is always good to keep thing tidy and follow OOP rules like encapsulation for example.

Then the last word is a really important concept which generally mean that an object is protected and isolated.
This means that the functionality and parameters of something resides in it and other objects can access this one only using the specific methods of it, they cannot corrupt it.
You should read something about ObjectOrientedProgramming concepts on the web and try to understand really well those concepts, like encapsulation for example.

Another important thing is that when you need to do some changes to an object you’ll have to touch only it and not all the giant project, this is why it’s recommended to not use level BP.

In your instance you should make a room actor whit all the functionality in it, like the light actor of the overlap tutorial of the documentation but a bit bigger and more complicated.

Can you accept the answer if your problem is solved?
Thank you!