How to make enemies jump at player?

Hi
I’m trying to create a scenario where the player will have to cross a lake. The enemies in this area will be fish. That will jump at the character from the water, I also want them to take a break after jumping so the party isn’t constantly bombarded with fish. I’ve only ever created Ai that is based on sight and will follow/attack the player when spotted. So, I’m not sure how much of that I can copy into the new enemy.

Any advice or links would be great, Thanks!

in your case your fish is your AI, this video series will show you how you can make an AI jump, you will need to do extra logics to make the fish jump ex: overlap character or something like this and play the animation of fish jump along with the logic that will make damage to the character and make the fish follow the character position in range … so the fish will not only jump but it will follow the character in limited range while jumping like targeting character and play with its velocities too to make it smooth…

hope it will help, cheers!

2 Likes

Not sure how advanced this needs to be but I feel that setting up a behaviour tree for what’s needed is overkill. Here’s what I got after 5 mins with projectile movement - the fish are projectiles:

Do tell if that’s anywhere close to what you need and I can post some details (if needed). If you prefer to crack it yourself, consider the following:

  • player enters a spawner volume which starts a timer
  • the timer produces a random spot in a radius around the player
  • we predict the arc and fire a projectile

Will need more work, for sure, but seems like it could work OK!

2 Likes

That’s actually pretty spot on to what I imagine thank you so much!
Yeah if you could post some detail even just screenshots that would be great!

The Fish:

  • Rotation Follows Velocity so the fish fly head forward, hopefully
  • the fish deals damage to a hit pawn
  • the fish only live for 10s via Initial Life Span
  • there is an Exposed on Spawn and Instance Editable vector variable - New Velocity
  • that variable is set in the Construction Script - that’s how the projectile component knows the direction and force needed to launch the fish actor accurately (there’s no movement predication / target leading - so it’s easy to dodge, but can be added):

The Pond

It’s an actor that spawn fish when the player enters the overlapping collision:

  • when the player enters the sphere collision we start a looping timer, and stop it when they leave
  • the timer generates a random position in the radius of the collision sphere, but not too close to the pawn
  • the Suggest Projectile Velocity Custom Arc does the heavy lifting of figuring out the vector needed to reach the player

This is very bare (fish) bones and needs a ton of functionality to make sense. Hope it helps.

Project Link v4.27:

6 Likes

Hello from 2024… Very useful, thanks! :o)

3 Likes