Download

Question about Input Action and blueprints

Hello,

I’m working on a blueprint in Third Person, and I have a question about Input Actions. Currently, I have a blueprint that, when inside the trigger zone and when holding down the [E] Input Action key, disables my movement, and then allows my [A] Input Action key to be used only while I’m holding down E. So as long as I’m holding down E, I can press A to toggle stuff. However, my issue is that even after I let go of E, the A action key is still enabled, which means I can’t move Left (using the A key) while I’m in the trigger zone. And even when I’m not holding down E, pressing A will toggle the mechanic regardless.

Basically, my question is, how can I disable/return an Input Action to normal? There is no trigger for any of the Key nodes, only a start – so I can’t disable it once I initiate it. Thanks.

For a quick clarification* Since by default, the A key is mapped to the Axis Mapping as left, I simply want to override the [A] axis map with an [A] Input Action – but only while E is held down. When it’s not held down, I want [A] to resume its primary function.

You could use a branch based on what trigger volume you are in and call the appropriate function(s).

HTH

Morning Ashern,

Without actually laying hands or seeing the blueprint setup, I would assume that having two **booleans ** and a few branches would sort this out.

Create a boolean variable called IsInTrigger, and set this to true when you are overlapping the triggerbox and false when overlap ends.

Create another boolean variable called EIsHeld, then set EIsHeld is to true when E is pressed and when released is then set back to false.

Then you want a branch node from the Input Action [A] to check if EIsHeld is true or false, if true then it will do whatever you want A to do when E is held, and if false then it will just move you character.

Below is a quick integration of what I described above:

260823de7278f603d3db05012272f697ce4e9d14.jpeg

Hope it helps,
Connor.

Hi, thanks for the responses. I was really hoping your graph helped Connor, but sadly it put me back in the same position. In your graph, where you have a branch to print screen if E is held down, well instead of that string, I want it to be “If E is held down, enable Input Action; if it’s not held down, Disable Input Action.” As it stands, I can’t disable or even control an input action once I place it into my graph, it becomes 100% automatically activated permanently. Here is my scenario with bullet points so you’re able to see where things go wrong:

  • WASD are my basic movement keys.

  • I have a door blueprint that includes a box trigger and has a boolean “Is Door Locked” that is a public variable.

  • When I enter the trigger zone, a text render is displayed in front of the door. If “Is Door Locked” = true, display Locked render text. If false, display “Unlocked” render text.

  • Instead of assigning a single specific key to open the door, I instead created an Input Action named [Action], and the key is set to E (since I read that it’s easier to remap an Input Action than it is to remap a specific key).

  • When I press [Action] while inside the trigger zone, the door opens or closes.

  • For the next mechanic, I created a new Input Action called [Lock/Unlock] and I set the key to A.

  • While in the trigger zone, and if [Action] is held down, my movement is halted until I let go of [Action]. Also while it’s held down, I get the ability to then press the [Lock/Unlock] key. Each time I press that button, it gets the current state of the “Is Door Locked” boolean and then it toggles it on or off accordingly.

  • Once I let go of [Action], [Lock/Unlock] is then disabled and my original Input Axis: MoveRight (Scale -1, for left movement, which is set to A by default) returns to its default functionality and is no longer overwritten by the Input Action [Lock/Unlock] “A” key.

Those last two things are where everything goes off the rails. For starters, the moment I enter the trigger zone, the Input Action [Lock/Unlock] immediately overwrites my Left Movement, which means I can’t move left at all while I’m inside the zone. Everything else I have the functionality of, but it’s this Action Input thing that’s causing the issue for me in that I’m not able to control when or how the Input Actions occur. To put it simply, I only want [Lock/Unlock] to work IF I’m holding down [Action]. When I’m not holding it down, then [Lock/Unlock] shouldn’t work at all, and I should still be able to move left.

How would I achieve that? I’ve seen it a lot in games, such as an example on a Playstation controller, pressing R1 will activate a melee attack, holding L1 will aim down the sights, and if you press R1 while aiming, you’ll shoot your weapon instead of melee-ing. The moment you let go of L1, R1 returns back to being a melee attack.

Oh…I kept searching around vigorously and came across someone that had similar issues, and they resolved it by unchecking “Consume Input” on the Input Action node’s details panel… This fixed my problem! I can still use A to move left and move around normally even when I’m inside the trigger box, but when I hold on to E, I’m able to press A and it calls the Lock/Unlock input action and it allows me to get done what I needed to get done.

If anyone would care to explain exactly what “Consume Input” does, though? The tooltip says “Prevents actors with lower priority from handling this input,” but I don’t get it. What is considered lower priority than the input and what isn’t?