Created a jump scare, but it’s not working right

Hello, I’m currently working on a horror survival game. I’m currently taking a Udemy course on the horror game.

I made an AI enemy that not only scopes out the rooms i set the target too, but i made a mechanic where if the AI sees the player (me) they chase you, and if they chase you and catch you, the chase triggers an animated jump scare.

The chase and the jump scare worked, however, the jump scare didn’t start when the AI reached the player, instead, i had to move to either the right, or left side of the AI in order to trigger the jump scare.

The AI stops in place when it reaches me, but when i move away for a few seconds, the chase begins again, however, if i move the character to either the right or left of the AI character WITHOUT stepping away from the AI, the Jump scare starts.

I don’t want that, i want it to be so no matter where my character is facing, if the AI reaches the player, the jump scare starts, no matter what angle the player is on of the AI

Hey there @AdamFabrizio! Welcome to the community! It sounds like your player detection method might be offset a bit. I’d recommend showing your blueprints so we could take a look at how you’re detecting the player. Are you using collisions/overlaps or traces?

Hello SupportiveEntity!

The only collisions i have is object collisions when i was laying out my map, so the only collisions i have are object collisions. But when i click “P” on my keyboard and it shows that green floor layout that shows where the enemy AI can walk around the map i made object collisions in.

When you say trace do you mean blueprints? If then, yes. My AI enemy, as well as my player character is using blueprints for controls

For my enemy AI thats patrolling the rooms, his patrolling, chase trigger, and jump scare are fine, but with the jump scare, i have to move to either the left, or right side of the enemy AI for it to trigger the animation cutscene.

I designed the cutscene so that no matter where my player is looking at, if the enemy AI patrols, finds, chases, and catches the player, it will trigger the player to look face at the enemy AI, with the AI doing his jump scare, then going to the game over screen.

Also, going to the game over screen wasn’t an issue either, just the jump scare.

The images I sent you are all the blueprints I was able to find in hopes that maybe one of them is set wrong that’s causing my player to move to the enemy AI’s left or right in order to trigger the jump scare.

Here is the problem I was talking about, when the AI reaches me, the attack animation doesn’t trigger

It’s possible that the distance check isn’t being run again until the bot does another search, which is causing you to be unable to start it without moving slightly away from the bot but still within distance range. Check this by printing the distance check when it occurs.

Hey SupportiveEntity! Thank you for reaching back!

Would i have to do the check distance node in the L1_character event graph, or the AI_Classic? Or in the Behavior Tree? Do you also have an example possibly of what it should look like in blueprints?

First we have to figure out how the Can See Player blackboard branch is failing, it seems that it is evaluating back to searching for player, but misevaluating if it’s close enough to the player.

So first print the Distance in your branch where you evaluate CanAttackPlayer. Does it only go under 100 when they move to the side or does it continue looping to find the player when it gets that close?

I’m not sure exactly how to add a distance to the CanAttackPlayer branch, I tried but I couldn’t get it up.

The picture I’m going to show you is the branch for CanSeePlayer, which has the canAttackPlayer, and the jumpscare audio.

I’m also going to show you a video of the outcome again with the sequence. In the video though, I did notice that if the player is in range while the AI turns around, the AI detects the player, and the jumpscare audio repeats several times before it ends, and the ai starts walking to the player.

I also noticed the enemy AI, if I move forward slightly, will move itself to MY character side, and the jumpscare sequence starts.

(PS, I didn’t make any changes to the tree, I looked at what you said, I tried adding a distance to the branch, no luck)