Blueprint Nodes for : Casting a spell by pushing input

Hi everyone !

I here today to know if someone can find an answer about my problem :

I got a pawn (a mech) and with that one you can press the shift button to “cast” (it disable some movements) and then when you released the shift button, you make a quick dash forward.

All is ok but I can’t find how to tell : "hey ! press the button while 2sec ! if not the cast will be break and not launch the dash !

Here the pics about my nodes :

https://www.mediafire.com/convkey/4db3/o8majk2os0uq8o04g.jpg

so you want to release the cast only if you pressed the button 2 seconds long other wise its not launched? make a timer that activate a bool after 2 sec. and only if this bool is true you can cast after release. if you release before cancel the timer “clear timer by handle”

Ho nice tips ! But I find another way that work nice too !

https://www.mediafire.com/convkey/98be/r5yal4wpxjtvklt4g.jpg

Thanks a lot !

It is good practice to avoid using the event tick as you did, becausee it check every frame for that bool to be true or false, if you use the event tick too much it can result in poor performance.

if you run the game at 60 fps. It will check that bool 60 times per second, if you do too many of these on too many BP, it will cause problems.

Thanks you for that answer JX53mb !

It’s the first time I use event tick in all of my project.