Actions on tapping and holding the same button

Found out I don’t understand a thing about new input system.

Basically, what I want to do:

  1. I have my reload on R button
  2. I want by holding the same button for 2 seconds, perform a “mag check” animation

So basically I have an animation montage that consists of 2 things:

  1. Get the mag out
  2. Put the mag inside

I wanted to make a system where if you hold a button enough (not to trigger reload), my character would get the mag out and hold it at the last animation frame

And then by releasing the button, would put the mag inside

What I found out…

If I choose to “Hold” modifier, one of two things would happen:

  1. If trigger is one shot → my character get the mag out and put it back inside because right after trigger gets shot → it calls “Complete”

  2. If trigger is not one shot → the “get the mag out” animation will loop it’s first frame because input system fires the triggers rapidly untill I stop holding the R button

I need something like this:

  1. A modifier, that fires a trigger only if the button is held down for N seconds
  2. That will fire this trigger once (and I would bind my “get the mag out” animation to it)
  3. That then will fire another trigger (and I would bind i guess a looped 1 frame animation of holding a mag in front of my head)
  4. And will fire “complete” only after I release the button

( P.S. I tried pulse, coz its the closest to “fire several triggers” thing I could probably have, but as soon as the last trigger fires, it completes and i put the mag inside despite the fact im still holding the button)

If anybody has a solution, I would be so glad that I’ll name my kids after your nickname

Thank you beforehand

Hey!

So if I understand correctly

you press R to reload but if you press and hold it, it should do the mag check? and after releasing the R key it should continue with the reload?

Not quite.

On tap - reload only

On hold - check ammo animation “pull out mag” and then loop “hold mag in front of your face”
On release - check ammo animation “put mag back inside”

Well, I managed to do it like this:

Just added a delay after “Completed” and now I have 1.5 seconds to look at the mag :smiley:

Have no clue how to do this “loop while holding” still tho.


And now I can break all the “CheckAmmo” animations when I need to reload, because holding R starts checking ammo animation and reloading at the same time.