How do I stop an event firing through a branch?

Hi guys. I’ve tried googling around the place but can find no answers. Forgive my incompetence. If the answer is already elsewhere, please point away!

My issue is that I have an event firing that a continues through a branch. I’m making a twin stick style system where one stick moves and another directs the aim, but instead of firing outright when the stick is moved, it makes a check to see if ‘aiming’ is true. Aiming is made true by pressing the right trigger.

What happens is I fire the weapon, by moving the stick to where I want to fire, then holding the trigger for a machine gun-like automatic fire (Making ‘aiming’ true). But when I release the trigger, setting the ‘aiming’ to false, my firing with continue until I actually allow the analogue stick to center.

I also have a problem I think is of a similar ilk for a car possession blueprint, where input resumes if you depossess the vehicle whilst pressing another input (i.e leaving the car while accelerating makes it perpetually accelerate until repossessed)

Thank you for anyone who looks at this, I hope it can help myself and any others who have a similar issue.
If images of the blueprints are necessary, do ask. I’ve tried to be thorough in my description of it but understand if actual visuals are required.

Look into custom events. Whenever you want something to happen, fire an event. That way you never have to use the event tick, or have loops that run constantly. Like firing an automatic weapon.

There’s many ways to do automatic weapons, but the best (in my opinion) way to do this:

On your trigger’s input, on press set the Boolean to true, on release set it to false. Next create a custom event that will be used for your “firing” logic.

When you press the trigger, fire the custom event.

In the custom event create your firing logic however you want to. RIGHT after that, do your branch node and check if the trigger is pressed or not. If it is still pressed, then off the “true” pin run your custom event again. You don’t need to do anything off the false node. Unless you want to do something specific when it’s false.

Doing it this way, your weapon will only fire when you have the trigger pressed.

Ok I added another branch on the end and I’m afraid to say it made little difference. Perhaps my description wasn’t all that thorough, I’ll post pics.

Thank you for your answer so far nonetheless!

Just gathered these together;

The left shows what my custom events are, (and at the bottom, a bool that sets when the trigger is pressed released). To the right is what actually fires those events: Rotating the right analogue stick a certain amount.

The branch right after ‘pull trigger’ is whats meant to be stopping the firing, I’ve also tried gates previously (Though maybe wrong XD never used them before)

The branch and custom event has been added at the end of the firing logic as advised.

And as further information, the firing does stop if I release the analogue but hold the trigger, but just not visa versa it seems :frowning:

Oh ■■■■■! I found the answer! You inspired me to think more about bools and I’ve found the solution. Also your mention of the even tick reminded me that existed. Perhaps theres a more efficient way, but it works!

Instead of just activating the firing logic from the movement of the right stick, that instead sets a bool ‘aiming’ , just like pressing the trigger does. (the bool activated by the trigger is now called ‘firing’)

Also works fine when I switch weapons out. I might have walked through the door myself, but it was you who opened it for me Ronnie, and I thank you for it!

Im gonna leave this open for a small while longer incase someone sees any problems with this method or knows an outright better way.

Timers shall do the job nicely!

After looking this over, I would suggest trying to put the branch node (condition is aiming) immediately after your “shoot” custom event.

I think you have the right logic, but in the wrong place (currently in the pull trigger custom event)

Putting this branch immediately after the shoot custom event will hopefully intercept the actual shooting process when “Aiming” becomes false

hope that works for you, let me know

I don’t know how to set a comment as the correct answer, because that worked perfectly! and is far less demanding than anything with event tick. Thank you very much it works exactly as intended!

my pleasure dude

Btw - you can answer it yourself and mark it as resolved

Best of Luck

As recommended by Vicecore -

Simply move the branch to where the ‘Shoot’ event occurred (where the bullet actually spawns)

lol no problem. Glad it worked out for you.