Hey y’all. So I’m new to Unreal and I’m just getting started on blueprints. I created a simple blueprint where I have a lever I modeled that is triggered once the player goes up to it and presses the F key. But I also have an interaction prompt that says “[F] Pull” that goes on and off depending on whether or not the player is in the collision box. My idea is that you can only pull the lever once and not back and forth.
The problem is, I want to disable the widget completely after the player has pulled the lever. But since I’m using the On Begin Component Overlap node, the widget will show up whenever I leave and re-enter the collision area. I tried exploring a few other nodes but the overlap node can only connect to one other node. (I also want to note that I have two separate collision boxes in my lever blueprint, one for detecting the player and another for triggering the widget visibility.)
I tried the Do Once node, but then the widget won’t appear if I exit the collision area even if I haven’t hit the prompt yet. I still find Booleans a bit confusing as well, as can’t connect any of these conditions to them. What am I missing or glossing over?
As a bonus: The lever animation has a similar problem where it won’t play the animation until the player comes up to it and hits the trigger, but if they enter and leave the collision box the trigger will still work.
User input goes into the player BP or its controller, not into the controlled item (there are exceptions, ofc). Having F inside the level BP is not a good idea - same goes for enabling input. It’s disabled by default for a reason. Have a look at how a standard interaction system is made:
Once you have a system like this set up, have it set a boolean variable inside the lever indicating it has been activated. Whenever we send a message to the level, we query that variable and act accordingly.
In short:
the lever has a boolean variable
the player presses F and uses a interaction object
the object (here, the lever) acts:
if its variable is True, it does nothing
if it’s False, it plays the Timeline, and sets its variable to True
Hey! I’m sorry for the late response!
I’m still very new to unreal, so I was unfamiliar with good interaction systems.
This is one of the first blueprint tutorials I followed, where he attached the BP to the object (door) itself so I’m a little confused. Is this just a bad example?
I also watched this tutorial, which also created the bp inside of the object.
It’s just that blueprint interfaces are a bit advanced for me and hard to understand.
I reorganized my blueprint a bit, and decided to get rid of one of the collision boxes and use a sequencer node (which I discovered after I started this thread).
I also want to add that I had simple on overlap/end overlap casts to third person character nodes in my previous blueprint with a get player controller node.
This still didn’t work, so I tried using a destroy widget node connected to my input key.
This did work, but then when I exited active play, it gave me this message. This only happens if I leave the collision box before I exit playing. I know it has something to do with the visibility node.
The other problem is that the lever still animates if I enter and leave the box, then press the input key. I don’t understand this either since I have a disable input node attached to my cast to BP_ThirdPerson node.
You still have F implement in the lever, right? Input goes into the player BP, not into the interactive item. Think about it - do you really want to put input script inside hundreds of items?
Could you briefly explain how it’s supposed to work?
• the player walks around and sees a lever
• we get close to it, press F, the lever animates one way
• we press F and the lever goes the other way
• what is the role of the widget? who owns the widget, the player or the lever? Is it just an interaction prompt?
Am I close? If so, any Interface tutorial covers this, one of the most common interactions. My suggestion is to double down and try it again. Once you wrap you mind around it, there will be no looking back.
Let’s say you don’t and manage to hack around this problem, can be done and will work for now. You will be immediately stuck on the next thing as now you will also want to interact with something else. But now it’s harder because the lever is allowed to fiddle with input.
Interface is by no means an answer to everything, but it’s an indispensable tool.