Hello! I would love for some help and guidance on this problem.
So I’m currently working on a horror project and I’m using the AIPerception system.
So first of all, the patrol code is just not working. After the enemy loses the player completely, they’re supposed to just move around the map. I don’t know what the problem is here.
The follow player code works-ish, however there are problems in tandem with the two next blueprints.
When it comes to checking the nearest locker. The enemy just doesn’t do it. It might follow me to the closet, and if the player is just slow enough to get in, open that very same locker, and kill the character. However, it doesn’t do that if it has lost sight of us. That’s what I kind of want to implement. Like if I run around a corner, the enemy checks the first locker that they see, and then a random one.
This brings me to the next problem. It doesn’t check a random one. It checks the same ones all the time. I just don’t get it. What can I do here?
The idea is this, I’m being chased, and get out of the enemies sight. They’re still following me but don’t know which locker I went into. First I want them to check the nearest one, and then a random one in the area. Then they should start patrolling again. But that just doesn’t happen. He literally just stands there. Doesn’t start patrolling. I’ve debugged and it registers me as seen all the time, and the chase music keeps playing.
It opens ONE locker, and then just stands there. I haven’t worked with the AIPerception system that much before, so all sorts of guidance is welcome.
The second to next picture is of the settings for sight perception. The last one is for collisions for lockers if that helps.
You should keep questions simple because very rarely will people rewrite code for you. It certainly does happen, but usually it’s when the person has little to no code to begin with.
Start with this:
I’ve personally had issues with GET_RANDOM_REACHABLE_POINT_IN_RADIUS and GET_RANDOM_LOCATION_IN_NAVICABLE_RADIUS. I find that one or the other works, depending on the situation.
I would attempt converting all of your vector patrol nodes to one or the other, testing them both to see which is more responsive.
I’ve changed things quite a bit. So idk how helpful it’ll be. Right now, I’m mostly concerned with trying to solve the problem of the AI’s behavior with the lockers.
I decided to put things back to the way they were with patrol. But honestly the enemy just stands there.
This is as far as I get when it comes to being able to detect when the AI is, or isn’t seeing the player. I can’t do anything more with that.
The next step is to essentially figure out how make the codes for having the enemy go to the nearest locker after not seeing me anymore, and then a random locker, functional. This is where I’m completely stuck
The FOR LOOP cycles through an array in ORDER. That’s why your enemy goes to the same locker. Whichever locker is first in the array is always going to be selected. You need to randomize this property.
If the distance is too far, you can loop the function in on itself to try again. I’m just showing the first part of what you could do. You would get rid of the FOR LOOP.
Dude, I really think you should start over, because if you placed something in the wrong place or used the wrong node, it can take forever to figure out what’s going on.
Again, step by step. Make sure that you can do all of these things SEPARATELY and then if you know for sure it is possible, combine them.
You’re going to have to “scrub” (look through it very carefully) your code.
I know you think it’ll take longer to start over, but I really disagree.
It’s been 2 days and you still haven’t figured out the issue.
I think you’re mixing up the perceived effort of starting over with the actual time it’ll take to redo the code. The effort, not the time, is what irks you.
I’m talking from experience, but it’s up to you. Just keep in mind that if you code on a shaky foundation, you’ll have more issues down the road. Your stuff needs to be AIR-TIGHT.