Creating a charge build up to jump?

Im using the third person blueprint file, what i want to accomplish is, while the player holds the spacebar, it can take the amount of time the button is held, and multiply that by a “jump force”. So that the longer/shorter the player holds the button, the more or less charge he builds up. And when the button is released, do a jump based on those parameters. Of course there needs to be a maximum force the player can charge up.

how would i go about doing this in blueprints?

Howdy!

I’m sure there’s a bunch of ways to do this (may already be on AnswerHub) but here’s one way you could do it:

You’ll have to play with the variables to get the desired effect. The Charge_Jump Event is called by an Event Tick so it runs every frame into the Gate. The functionality is there, have at it and make it better!

-W

Thank you so much! This is awesome!

Hey this works awesome but when I mash space, my character just flies up into the air endlessly. Any ideas on how to fix this?

And also, the first jump doesn’t work, the process only starts with the second jump. I think its because I have an Event Tick calling Charge_Jump then that to gate, but im not 100%.

Hello,

I have made my own Charge Jump by using this video tutorial as a basis:

Here is an image of my setup with my own personal changes:

Charge Cooldown’s Default is 1.5, every other float is 0. All Bools are False by default.

You will need to do a “View Image” to see the whole thing. Let me know if you have any questions or if this helps you.

How would we remove the double jump so taht we only get on single charged jump?

Disconnecting should be fairly simple. You can just get rid of the “Is Double Jump” Branch, the Sequence After “On Landed” and the Double jump section.

Then hook the executions up as shown here. I hope this helps. Let me know if you have any other questions.

Ok so i did the BP however i’m not 100% sure its working (its either too small to be noticeable or not working). Is there some way I can change the jump height so i can see whats going on? Thanks!

Also what is that blue icon thing next to add floats and set ChargeUpdate at the top in the node connectors? Cause I dont have it on mine :frowning:

It’s just a debugging icon, completely not needed to get anything working. You can right-click a pin and choose “Watch this value” to get it. That allows you to watch values change live during runtime.

You have to hold down jump for a while. I would suggest using the “Watch this Value” feature to see if they are changing. Make sure to set your Debug Filter to target the character.

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Debugging/index.html

Let me know if you have any more questions.

I cant seem to find the “magnifying glass” next to a variables name. The box is blank with text in it stating the variable’s name.

Are you right-clicking the pin of the node or the node itself? You must click the exact pin to get the option. Pins are the colored circles on the nodes that you can drag from.

You’ll have to Play or Simulate in order for that to activate. Also, make sure to set the “Debug Filter” to be the character instance or it will have no target and display as empty as well.

Oh ok, I was just clicking on the entire node! Thanks!

Also, I tried Wes’ option and it works awesome, however I can just infinitely spam space and fly away. So if you could find a way to resolve this, it would be amazing!

Hey AemonBarz,

Try updating my original post with the following instead:

The commented sections will fix the issue you are having as well as improve the overall functionality of it by adding a cap and setting defaults so, as well as eliminate spamming the button.

-W

Yeah this works all well and good, but for some reason the first jump doesnt work, my character just has a screen bounce but doesnt move in the z axis. Thanks Wes!

What does your Blueprint look like, is it the same as the one I posted?

The edges of the nodes on the sides are a bit cut off but you can still see the nodes