Using the Gameplay Ability System and jumping

Hello, I am trying to learn the Gameplay Ability System and I thought I would implement it to make the character jump using the logic that UE provides. However, once GAS was implemented I created an ability for Jump and added the below logic in the blueprints but the character won’t jump. Do I need to go about it differently?

As a note, if I print a string after the cast it prints correctly, so I know it’s getting to the Jump node, it’s just not executing it.

Event OnEndAbility does not execute the cast node. The cast node is only executed by Event ActivateAbility, because that event is hooked to the execute input.

Add another cast node connected to event OnEndAbility.

Thanks for the reply! I did that and here is what I have below. Unfortunately the character still won’t jump :confused:

The cast failed output should not be hooked to StopJumping. Because, if it fails there is nothing valid to call StopJumping on which will result in a crash.

You can also add a breakpoint on selected nodes (F9) , these will pause the game when you play if they get executed, so that you can inspect this problem more closely. If both Jump and StopJumping are hit properly, it is time to inspect why the hit nodes don’t work.

Every character has a component which controls their movement ability (CharacterMovementComponent) which you can find on their Components tab in the Blueprint editor. Click the component and take a look at the Details panel. Enter “Jump” in the search.
You should verify that the property “CanJump” there is enabled.

1 Like

AH! It looks like it was because I was calling the end ability right after calling jump. My thought process was that the jump would still happen then it would stop but that is not the case! Thank you for your guidance!

1 Like

Here is the solution I came up with - I am not aware of a better way to handle this so any advice would be good :slight_smile: I also tried using the Wait Input Release node too and that worked, not sure which is “better” to use

Why are you trying to do this async?
Is this not cancelling your jump after 0.001ms after you start to jump? That doesn’t look right.

It is working, and no, the jump finishes just fine. I just don’t know a better way to wait for the Jump function to actually execute. If I put the End Ability right after the Jump function the character doesn’t jump. I changed it to the Wait Input Released node instead. Still Async but at least it’s not based on a flat amount of time. Do you know of a way to do this non-async?

  1. I would implement this logic on the BP_ThirdPersonCharacter itself, because a character is the only actor that is able to jump (because of the CharacterMovementComponent). That way you don’t need to cast anymore.

I assume that the Event ActivateAbility and Event OnEndAbility are bound to a delegate of some ability system. So, if you activate an ability the first event will execute and whenever it ends the second event will execute. Then there is no need to set up any task, just execute Jump and StopJumping on their events, nothing else.

BP_ThirdPersonCharacter
  > Event ActivateAbility
    - Jump
  > Event OnEndAbility
    - Stop Jumping

Have you ever checked the Lyra Starter Game? There is a GA_Hero_Jump done there.

yep this is what I ended up using, the Wait Input Released node!

Have you guys noticed that when we add lag simulation, sometimes the jump doesn’t work and gets stuck in a “still jumping” state until the falling state is triggered?
I’ve been trying to fix this, but it’s been a week and I haven’t found anything.

How do you reproduce this bug?