How to trigger volumes with widgets?

I am trying to figure this out. So I begin overlap with a point light followed by a trigger volume so when I walk into that trigger volume it shows up a widget that says “Press “F” to start toggle” and then you press F and it turns off the point light. I got this far. But the problem is, is that I can be outside of that trigger volume and still press F to toggle I want to be inside that trigger volume for the effect to work. How would I go about doing this?

Check if you’re overlapping the trigger volume when pressing F.

Am I right to assume this will get more complicated since you’ll most likely want to do more with the F key later on, rather than just turning lights on/off?

How would I do this? I tried branch nodes and booleans I am a newbie to blueprints and I am starting out with point lights trying to understand how this works and coming up with random things to add to the lighting effect. If you can give me an working method that would help out alot

Yes it is ok to assume that. I forgot to mention that this project is to practice blueprints not to develop an actual game. I’m just trying to learn blueprints.

There’s half a dozen ways of doing what you need. Here’s the most straightforward implementation I can think of:

The actor (triggeredLight) has a trigger box, a light and a custom event:

I placed 2 instances of that actor in the level:

And the character can interact with any number of those actors like so:

Image from Gyazo

The F only works if you’re actually overlapping at least one of them. Otherwise the cast fails and it’s OK to let it fail.

edit: do tell if something does not add up!

Thank you so much. Was I doing it wrong by trying to do it within the level blueprint?

It depends.

In this situation it’s the character that is responsible for the interaction so I’d keep it all in the character. Especially that player keyboard input is involved.

If player stepping into the box were to trigger opening of the door (another actor) somewhere in this level, I’d place the script in the Level Blueprint since this behaviour is unique to this level only.

Imagine what happens with the F interaction (the lights you flip) once you to go to Lvl 2. You would need to write the interaction code again for this level… and every other level you may have. By keeping the script in the character, you get to interact with whatever you encounter, friend or foe, and wherever it is.

Hope this makes sense.

Hi there.

Have a look a this.

Create an Action Mapping in your Project Settings → Input
I set my to P and named it InteractUse

PS. On Component End Overlap (Box) New Visibility should not be ticked. In case you have added text.

Made a quick video to show the end result:

Hope it helps.

You can add a Cast to your character when you Begin and End overlap (Box) so that only you can operate the switch, otherwise if any other actor walks into the trigger box you will be able to switch the light on and off.