How to stop a "line" of nodes on input release?

I have this input action that executes a timer to set a attack as charged , holding this key for 1 second starts the charging and after 2 more seconds the charging is completed and sets the variable charged as true, until here its ok, but if i release the key before the charging is complete the charging will go on even if I no longer holding the key. Once i press the charging key even if not holding anymore it will continue to do the code of the key pressed part.

The problem with this is that dont mater if i finish the charging time, once I press the key the timer will trigger always setting the charged as true, and this will
cause me trouble.

How do I stop from executing the pressing part as soon i release the key?

Here is the nodes:

You have to basically keep testing if the key is still pressed. So each of the nodes needs to check a bool first ‘key still pressed’.

You might be able to do something with a DoOnce right before the bool set at the end of the chain. If the DoOnce is opened by the key press, but closed again by the key release, the bool can’t get set.

Im sorry, how can i close the doOnce with de key release?

edit:

Nevermind i think i managed to do that with a sequence a the begining of the release chain and link the reset to the sequence node, i dont know if this is problematic or not:

@ClockworkOcean Thank you very much for answer. Can you help me with this problem also with the input action event?
This charged attack is triggered when i press shift+left mouse button and release left button. It works ok if i release left mouse first, but if i release shift button first the nodes that come after the input action dont execute, resulting in the character to idle in the charging pose, how do i fix or prevent this from happening?

OK, you haven’t quite got it there. Put a custom event in the Reset pin of the DoOnce and call that custom event from the Released chain of your input event.

I’m gonna think a while…

Do it like this:

I don’t have the same nodes as you of course, it’s the idea that matters.

If they release the button while the charge is taking place, that counts as releasing.

EDIT: Ah, still a problem with letting go of shift early, gimme 5…

Ok, it’s a nightmare. All the programming goes into the fact that the input action doesn’t work properly.

This works. The charge:

Notice, the release isn’t connected, because you can’t trust it. The release is done as an event:

And you need this on tick to watch and see if they let go of either key/button:

The only downside of this is, you can’t start another charge until the amount of time it takes to run the charge section has completed. That might be ok for you as it will have time to play the animations etc.

If you want to be able to stop mid charge and start again. You have to write that charge chain with a check for charging at every step. It really depends on how important it is to you…