Download

Attacking at the end of a jump

Im working on a 3D platformer and my character has a jump where he flips, i have a special attack i want him to be able to do at the end of the flip of the jump. I want it to only be able to be performed at this time. Any way i can do this?

(I can get it to to play the animation after the jump, jut not where i want it to start, and i cant isolate it to only work when the jump is performed, and i cant use “is falling” because he has another jump he can do that the attack shouldn’t be able to be done on

Depending on how you handle the landing, you can trigger/set a boolean you check that only allows that/those attacks if true. Set a time to run the .5 (or whatever seconds to disable the bool (also disable if you do execute the attack as well).

Is this run via an animation? Can you use an animation notify?

So i tried making a boolean in my character blueprint that states if the button for the attack is pressed then the action activates and if its released it deactivates, then i set a delay on the action to time it with the apex of the jump (approximately 0.8s) thinking that should make it so .8 seconds after i push the jump then attack combo the attack would trigger.
In my animation blueprint i casted the Get Attack Boolean from my Character Blueprint in and then used that to make another boolean stating if that value from the previous boolean is true. i plugged this into my machine for the event transition between the jump and the attack telling it to play the animation if the value is true, i also linked it back to my idle and walk animations using an InAir T/F Boolean i made.
I thought that this should work but what i was left with is a situation where sometimes the animation will trigger and sometimes it wont (im assuming this is caused by my keypress delay timing being off) but when it does activate it cancels all my other animations until I hit the button combo again, my character hets stuck in the final frame pose of the attack animation and just slides around in that pose. If i hit the button combo again it resets back to idle and im good to go.
If that made no sense I apologize, im new to coding and it barely makes sense when i explain it to myself.

I forgot to mention in the character blueprint i also set up a branch with an action cancel if the character is crouching or on the ground, that didnt seem to help though.

You’re probably going to want to handle your attack through an animation montage call in your character blueprint.

What SE_JonF said, I’d recommend the use of an animation montage. Inside the montage you can add markers along the timeline to call events as/when you want. So, for example in my attack-swing, I don’t want the hitbox to immediately appear, so I have an AddHitbox event that is called and at the end of the attack a RemoveHitbox. As these are ‘just events’ you can attach code to them.

In you case, you could use notifies to mark when you specific windows to start/stop, call particle effects, add damage, whatever you want.

1 Like