I’m trying to make a togglable Bunny Hop key and I’m having problems. I want it to auto jump for some time unless you press the button again. I’m still pretty new and have no clue what to do.
Hi @887807 , What you want is to use Event Timers.
Basically you want to save the state of hopping in a boolean variable, if your character is not currently jumping then it triggers an event timer which, in this example, triggers a jump every 0.5 seconds. This Timer is connected to another event timer for a cooldown, this does a similar thing except it clears the first timer after 2 seconds, therefore it stops the character from jumping and sets that boolean variable to false so you can start the timer again when you press the button.
Hope this helps.
I don’t know how to save the state of hopping inside a variable. and I don’t really understand custom events lol. I tried doing this,
but it sometimes doesn’t change my speed and air control amount. I’m pretty sure I did it wrong.
If you preffer you could use the tick event with a gate, using the flip flop to open/close the gate.
Also you could have in the event tick a branch connected with the flip flop is A pin, (exec A and B don’t have to be connected to anything)
Seeing as you are using the Character Movement Component (CMC), let’s not over engineer and make this complicated.
CMC has built in Jump functionality. Bunny Hopping is literally user timed jumps. You cannot “Jump” unless you are on the ground. Using Timers, Delays etc will not work. They can fire mid air, when falling, swimming, flying etc. You only want to execute a sequential jump/hop when you have landed. So you use “Event On Landed” to execute the next jump.
Write a custom function (Can Hop?) to determine if you can in fact toggle on bunny hopping. You should consider cmc movement mode changes toggling off this action.
e.g. If you bunny hop off an edge into deep enough water to trigger swimming. You’ll want to call a custom event that sets “hop toggle on?” to false. This applies to many other situations. Crouching, Prone, Flying, etc.
I’m sorry for your time but I still don’t understand I should have said I was very new lol. I don’t know what to put in the function for the Dool condition thing. I also don’t understand the custom event or variables, do I put like options in them? I’m also not sure if and/or where I would add this to the original blueprints. Thanks for the fast replies but im still lost
What you put in the “Can Hop?” function is dependent on your games needs/requirements. In general though you want to check the cmc movement mode to see if Walking is the current mode. That will bypass the need to check if is falling/in air etc.
Other conditions are up to you. If you don’t want a player to be able to toggle it on when say shooting a gun, then you’d check against that.
Example structure…
Resources:
Take the needed time to learn these fundamentals.
My prior post code goes in your character class event graph.
Thank You I definitely need to get better but when I tried making it I wanted to try and finish it but I don’t even know if I can even with your second picture. Thanks again for the help I will have to look at the resources.