Download

Any way to change the consume input value on blueprint axis events at runtime?

I have a system where I need to have a certain keybinding only take effect when a confirmation has been pressed. I am creating a lever switch system, where the character can walk up to the lever and once within range, can press a dedicated button to start operating the lever.

Situation A. When the player walks up to the button, all the way until the player has pressed the dedicated button, the player character needs to move around when pressing the analog stick.

Situation B. When the button has been pressed, the player cannot move around anymore and instead the analog stick is used to move the lever instead.

Now, this situation seems simple enough, except for one problem. When I set up the axis controls in the blueprint, their mere existence will consume the input of the controller, even if the effect of their input only starts when pressing the dedicated button. In other words, the moment I get within range of the switch, I loose the ability to move my character. If I turn off the consume input on the axis events, I can move around alright, but once I try to operate the switch, the character will obviously keep moving around making operating the switch a royal pain in the butt.

Now my question is; I want to know whether there’s a way of disabling/enabling the consume input on a per-node basis at runtime.

Even just telling me where the bindings for the K2node_InputAxisEvent are stored would be enough. If I can access the bindings through C++, I may be able to make something that alters the Consume Input values of those bindings. I have tried sifting through the source classes, but couldn’t find anything resembling what I am looking for.

Cant you use a Boolean flag and a Branch Node to prevent the execution flow of the axis on each object (player and lever)?

No, I tried that already. The problem is that the moment you set the input to enabled in the blueprint, any present axis/action event nodes in that blueprint will essentially “overwrite” the axis/action events in the character class. Even if you set a branch node to only use the input when you want it to, as long as consume input is true it will keep ignoring the C++ functions in favor of the ones in blueprint. Hence why I wanted to know whether the Consume Input bool can be set at runtime.